Skip to main content

Trigger Inbox quickstart

This article covers the core queue model of the Trigger Inbox API: create an inbox, send a message, lease it, and acknowledge it. It uses Webhooks by Zapier as the trigger so you can run the full lifecycle without connecting an external app. Follow the steps individually to understand each part of the flow, or skip to the complete script at the bottom to run everything at once. Once you understand this pattern, the app tutorial covers connecting to apps like Slack or Gmail using the user’s app connection.

Before you begin

Node.js 18 or later, installed and available as node.

Step 1: Get an access token

The Trigger Inbox API requires an access token to authenticate your requests. For local testing, use SDK client credentials. The webhook trigger used in this guide does not require an app connection, so SDK client credentials are all you need to follow along. 1. Install the Zapier Platform CLI: If you already have the Zapier Platform CLI installed, skip to step 2.
2. Log in and create credentials:
The response includes a client_id and client_secret. Copy both values. 3. Exchange your credentials for an access token:
4. Set the access_token value from the response:
SDK credentials are for testing only. For production applications that act on behalf of your users, use JWT authentication.

Step 2: Create the inbox

The webhook trigger requires two randomly generated values, a hook code and a seed, that form your unique webhook URL. 1. Generate webhook codes and create the inbox:
2. Set the inbox ID and webhook URL from the response:

Step 3: Wait for active

A new inbox starts in initializing while Zapier sets up the trigger subscription. Do not send events or lease messages until the status is active. 1. Poll until the inbox is active:
Go to inbox states for a full description of each status.

Step 4: Send a test event

1. Send an HTTP POST to your webhook URL:
The endpoint accepts the POST immediately. The message typically becomes available to lease within a few minutes.

Step 5: Lease messages

Leasing claims a batch of messages and locks them for exclusive processing. No other consumer can claim them during the lease. If you do not acknowledge within the lease duration, the messages return to the queue automatically. 1. Poll until messages are available:
The response includes: 2. Set the lease_id from the response:
Run your processing logic against the message payload before moving to the next step.

Step 6: Acknowledge messages

Acknowledging permanently removes messages from the queue. Only acknowledge after processing succeeds. 1. Acknowledge using the lease_id from Step 5:
A successful response returns each message with "status": "acked".
If processing fails, do not acknowledge. Let the lease expire and the messages will return to the queue automatically. To return them immediately, use release messages.The Trigger Inbox API uses at-least-once delivery. Build idempotent processing and check the message id before acting on a payload.
To acknowledge specific messages within a lease rather than the full batch, add "message_ids": ["id1", "id2"] to the request body alongside lease_id.

Step 7: Confirm the inbox is empty

After acknowledging, confirm there are no remaining messages. 1. Attempt to lease with a limit of 1:
An empty inbox returns "lease_id": null and "results": [].

Step 8: Delete the test inbox

In production, inboxes are long-lived. Create them once and run the lease-process-acknowledge cycle continuously. Delete an inbox only when decommissioning an integration entirely. For this tutorial, delete the test inbox to cancel the trigger subscription. 1. Delete the inbox:
Deletion is partially asynchronous. If you named the inbox, the name is freed immediately, so you can reuse it as soon as your DELETE call returns. The inbox status changes to deleting until Zapier finishes removing the inbox and any remaining messages on the backend, but you can treat the inbox as effectively gone as soon as you get a 202 response.

Complete script

Complete Step 1 first to get your access token, then set TOKEN and run the script:

Next steps