Send events

💡️ This guide is for sending events from outside an Inngest function. To send events within an Inngest function, refer to the step.send_event guide.

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

import inngest

inngest_client = inngest.Inngest(app_id="my_app")

# Call the `send` method if you're using async/await
ids = await inngest_client.send(
    inngest.Event(name="my_event", data={"msg": "Hello!"})
)

# Call the `send_sync` method if you aren't using async/await
ids = inngest_client.send_sync(
    inngest.Event(name="my_event", data={"msg": "Hello!"})
)

# Can pass a list of events
ids = await inngest_client.send(
    [
        inngest.Event(name="my_event", data={"msg": "Hello!"}),
        inngest.Event(name="my_other_event", data={"name": "Alice"}),
    ]
)

send

Only for async/await code.

  • 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.

send_sync

Blocks the thread. If you're using async/await then use send instead.

Arguments are the same as send.