# Since we are "fanning out" with events, these functions can all run in parallel
@inngest_client.create_function(
    fn_id="send-weekly-digest-email",
    trigger=inngest.TriggerEvent(event="app/send.weekly.digest")
)
async def send_weekly_digest(ctx: inngest.Context) -> None:
    # 3️⃣ We can now grab the email and user id from the event payload
    email = ctx.event.data["email"]
    user_id = ctx.event.data["user_id"]

    # 4️⃣ Finally, we send the email itself:
    await email.send("weekly_digest", email, user_id)

    # 🎇 That's it! - We've used two functions to reliably perform a scheduled
    # task for a large list of users!
```

</GuideSection>
</GuideSelector>

<Callout>
👉 Note: You'll need to [serve these functions in your Inngest API](/docs/learn/serving-inngest-functions) for the functions to be available to Inngest.
</Callout>

On the free plan, if your function fails 20 times consecutively it will automatically be paused.