Polling Endpoints
Polling Endpoints are a way for your users to get a stream of events by polling instead of listening to webhooks.
Enabling Polling Endpoints
Polling Endpoints can be enabled at the environment level in the Svix Dashboard.
When you enable Polling Endpoints, your users will be able to create them in the App Portal.
Usage
Like with webhook endpoints, Polling Endpoints support filtering messages by event types and channels.
In the App Portal, event consumers will get a unique URL and an API key to iterate through the full list of events sent to their Svix Application since the endpoint was created.
When creating a Polling Endpoint, consumers will get a unique URL like https://api.svix.com/api/v1/app/app_2mG6DgUaGlwCNdM5oRCUJec2kQC/poller/poll_59q
When first calling the endpoint, it will return an empty array and an iterator.
{
"data": [],
"iterator": "eyJvZmZzZXQiOi05MjIzMzcyMDM2ODU0Nzc1ODA4LCJhZnRlciI6bnVsbH0",
"done": false
}
Then, using the iterator in the next call, they can iterate through the events and poll for new ones.
curl \
-X GET "https://api.svix.com/api/v1/app/app_2mG6DgUaGlwCNdM5oRCUJec2kQC/poller/poll_59q?iterator=eyJv..." \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer sk_poll_*****.eu'
Messages will be returned in the order they were sent to Svix.
Polling Endpoints can be used in parallel with regular Svix webhooks, and you don't need to make any changes to how you create messages.