Build reliable event-driven applications by triggering Inngest functions from Postgres changes. Use Sequin to process database events with guaranteed delivery.
insert
triggers an Inngest event that your function can then process (i.e. exactly once processing guarantee).
You’ll need the following:
webhook/user.inserted
event is received.
functions.ts
file (typically located in src/inngest/functions.ts
), create a new function:webhook/users.insert
event as input, extracts the user data, and sends a welcome email to the user.Inngest.serve()
handler registers your function with Inngest so it can invoke the function.In your route.ts file (typically located in src/app/api/inngest/route.ts
) register the function you created above:sendWelcomeEmail
function by trigger a test eveng in the Inngest development server:send-welcome-email
function. Click the “Invoke” button and enter a sample event payload. For this example, use the following event payload:
webhook/users.insert
event is received. In the next step, you’ll trigger this event with Webhook.webhook/users.insert
) and the data from the record
field in the payload:public.users
or public
).30000 ms
for “Request timeout” as this is more than enough time for Inngest to process the request1
for “Batch size” so each change is processed individually.new_user_webhook_sink
) and click “Create Webhook Sink”.webhook/users.insert
), and open the “Logs” tab. You should see the event you just created: