Send event

💡️ This guide is for sending events from inside an Inngest function. To send events outside an Inngest function, refer to the client event sending guide.

Sends 1 or more events to the Inngest server. Returns a list of the event IDs.

Arguments

  • Name
    step_id
    Type
    str
    Required
    required
    Description

    Step ID. Should be unique within the function.

  • Name
    events
    Type
    Event | list[Event]
    Required
    required
    Description

    1 or more events to send.

    Properties
    • Name
      data
      Type
      dict
      Required
      optional
      Description

      Any data to associate with the event.

    • Name
      id
      Type
      str
      Required
      optional
      Description

      A unique ID used to idempotently trigger function runs. If duplicate event IDs are seen, only the first event will trigger function runs.

    • Name
      name
      Type
      str
      Required
      required
      Description

      The event name. We recommend using lowercase dot notation for names (e.g. app/user.created)

    • Name
      ts
      Type
      int
      Required
      optional
      Description

      A timestamp integer representing the time (in milliseconds) at which the event occurred. Defaults to the time the Inngest receives the event.

      If the ts time is in the future, function runs will be scheduled to start at the given time. This has the same effect as sleeping at the start of the function.

Examples

@inngest_client.create_function(
    fn_id="my_function",
    trigger=inngest.TriggerEvent(event="app/my_function"),
)
async def fn(
    ctx: inngest.Context,
    step: inngest.Step,
) -> list[str]:
    return await step.send_event("send", inngest.Event(name="foo"))