Event payload format

The event payload is a JSON object that must contain a name and data property.

Required properties

  • The name is the type or category of event. Event names are used to trigger functions. For example, app/user.created or billing/invoice.paid. See tips for event naming below.
  • data contains any data you want to associate with the event. This data will be serialized to JSON. For example, if you're sending an event for a paid invoice, you might include the invoice's id, the amount, and the customerId in the data property. The data property can contain any nested JSON object, including objects and arrays.

Optional properties

  • user contains any relevant user-identifying data or attributes associated with the event. This data is encrypted at rest. For example, you might include the user's id, email, and name in the user property. The user property can contain any JSON object, including nested objects and arrays.
  • id is a unique identifier for the event used to prevent duplicate events. Learn more about deduplication.
  • ts is the timestamp of the event in milliseconds since the Unix epoch. If not provided, the timestamp will be set to the time the event was received by Inngest.
  • v is the event payload version. This is useful to track changes in the event payload shape over time. For example, "2024-01-14.1"
{
  "name": "billing/invoice.paid",
  "data": {
    "customerId": "cus_NffrFeUfNV2Hib",
    "invoiceId": "in_1J5g2n2eZvKYlo2C0Z1Z2Z3Z",
    "amount": 1000,
    "metadata": {
      "accountId": "acct_1J5g2n2eZvKYlo2C0Z1Z2Z3Z",
      "accountName": "Acme.ai"
    }
  },
  "user": {
    "email": "taylor@example.com"
  }
}

Tips for event naming

Event names are used to trigger functions. We recommend using a consistent naming convention for your events. This will make it easier to find and trigger functions in the future. Here are some tips for naming events:

  • Object-Action: Use an Object-Action pattern as represented by noun and a verb. This is great for grouping related events on a given object, account.created, account.updated, account.deleted.
  • Past-tense: Use a past-tense verb for the action. For example, uploaded, paid, completed, sent.
  • Separators: Use dot-notation and/or underscores to separate words. For example, user.created or blog_post.published.
  • Prefixes: Use prefixes to group related events. For example, api/user.created, billing/invoice.paid, stripe/customer.created. This is especially useful if you have multiple applications that send events to Inngest.

There is no right or wrong way to name events. The most important thing is to be consistent and use a naming convention that makes sense for your application.