This page documents the provider subscription system for webhooks that require active registration with external services. Provider subscriptions enable bidirectional webhook communication where Sim Studio must register callback URLs with third-party APIs (Teams, Telegram, Airtable, etc.) rather than passively receiving webhook calls.
For general webhook processing and authentication, see Webhook Processing Pipeline and Webhook Authentication. For webhook deduplication, see Webhook Deduplication.
Provider subscriptions manage the lifecycle of webhook registrations with external services that require explicit subscription creation. Unlike passive webhook providers (GitHub, Stripe) where users manually configure webhooks in the provider's UI, subscription-based providers require Sim Studio to programmatically:
The subscription system currently handles eleven providers: Microsoft Teams, Telegram, Airtable, Typeform, Calendly, Ashby, Grain, Fathom, Lemlist, Webflow, and Attio apps/sim/lib/webhooks/provider-subscriptions.ts14-25
Sources: apps/sim/lib/webhooks/provider-subscriptions.ts1-25
Diagram: Mapping subscription creation logic to code entities
Subscriptions are created during workflow deployment or when a webhook is saved. The system:
createExternalWebhookSubscription apps/sim/lib/webhooks/provider-subscriptions.ts1768-1810getCredentialOwner and refreshAccessTokenIfNeeded apps/sim/lib/webhooks/provider-subscriptions.ts35-60 apps/sim/lib/webhooks/provider-subscriptions.ts98-100externalSubscriptionId in the webhook.providerConfig to avoid duplicate registrations apps/sim/lib/webhooks/provider-subscriptions.ts110-126createTeamsSubscription, createAirtableWebhook) to register the notificationUrl apps/sim/lib/webhooks/provider-subscriptions.ts31-33Sources: apps/sim/lib/webhooks/provider-subscriptions.ts31-110 apps/sim/lib/webhooks/provider-subscriptions.ts1768-1810
Diagram: Mapping subscription deletion logic to code entities
Subscription deletion follows a best-effort strategy in cleanupExternalWebhook apps/sim/lib/webhooks/provider-subscriptions.ts1812-1850 Webhook deletion in the local database always succeeds even if the external API call fails.
The deletion process:
externalSubscriptionId from providerConfig apps/sim/lib/webhooks/provider-subscriptions.ts27-29DELETE /subscriptions/{id} for Teams) apps/sim/lib/webhooks/provider-subscriptions.ts241-260Sources: apps/sim/lib/webhooks/provider-subscriptions.ts211-272 apps/sim/lib/webhooks/provider-subscriptions.ts1812-1850
Teams uses Graph API subscriptions to monitor chat messages. These subscriptions are time-limited.
| Property | Value |
|---|---|
| API Endpoint | https://graph.microsoft.com/v1.0/subscriptions apps/sim/lib/webhooks/provider-subscriptions.ts146 |
| Max Lifetime | 4230 minutes (~3 days) apps/sim/lib/webhooks/provider-subscriptions.ts132 |
| Trigger ID | microsoftteams_chat_subscription apps/sim/lib/webhooks/provider-subscriptions.ts74 |
The implementation in createTeamsSubscription sets the resource to /chats/{chatId}/messages and includes a clientState set to the internal webhook.id for verification apps/sim/lib/webhooks/provider-subscriptions.ts128-143
Sources: apps/sim/lib/webhooks/provider-subscriptions.ts66-184
Telegram webhooks use the setWebhook method. Unlike other providers, Telegram only allows one webhook per bot token at a time.
| Property | Value |
|---|---|
| API Endpoint | https://api.telegram.org/bot{token}/setWebhook apps/sim/lib/webhooks/provider-subscriptions.ts316 |
| Authentication | Bot token in URL path |
| Method | POST |
The createTelegramWebhook function extracts the botToken from the config and registers the notificationUrl apps/sim/lib/webhooks/provider-subscriptions.ts278-345
Sources: apps/sim/lib/webhooks/provider-subscriptions.ts278-345
Airtable webhooks monitor changes to specific bases and return a macSecret used for HMAC signature verification.
| Property | Value |
|---|---|
| API Endpoint | https://api.airtable.com/v0/bases/{baseId}/webhooks apps/sim/lib/webhooks/provider-subscriptions.ts466 |
| Required Config | baseId, credentialId apps/sim/lib/webhooks/provider-subscriptions.ts402-404 |
| Stored Fields | externalId, expiresAt, macSecret apps/sim/lib/webhooks/provider-subscriptions.ts497-508 |
The createAirtableWebhook function validates the baseId format before calling the API and stores the returned macSecretBase64 for future request validation apps/sim/lib/webhooks/provider-subscriptions.ts392-511
Sources: apps/sim/lib/webhooks/provider-subscriptions.ts392-511
Grain subscriptions are view-scoped. Each view ID corresponds to a specific content type (recordings, highlights, or stories) apps/sim/triggers/grain/webhook.ts34
| Property | Value |
|---|---|
| API Endpoint | /_/public-api/webhooks apps/sim/triggers/grain/utils.ts51 |
| Required Config | apiKey, viewId apps/sim/triggers/grain/webhook.ts15-35 |
| Trigger Options | grain_item_added, grain_item_updated, grain_webhook apps/sim/triggers/grain/utils.ts8-11 |
The Grain implementation automatically creates the webhook when the trigger is saved and deletes it when removed apps/sim/triggers/grain/utils.ts52
Sources: apps/sim/triggers/grain/webhook.ts5-66 apps/sim/triggers/grain/utils.ts42-61
For services like Gmail and Outlook that do not support standard webhook subscriptions for all event types or require complex Pub/Sub setups, Sim Studio uses a Polling architecture.
These triggers use a polling: true flag in their configuration apps/sim/triggers/gmail/poller.ts33 apps/sim/triggers/outlook/poller.ts27
searchQuery apps/sim/triggers/gmail/poller.ts48-104Sources: apps/sim/triggers/gmail/poller.ts26-154 apps/sim/triggers/outlook/poller.ts20-113
Some providers perform reachability tests or challenges during the subscription process or upon receiving events.
validationToken query parameter during registration that must be returned as a plain text response.hub.mode, hub.verify_token, and hub.challenge parameters for endpoint verification.url_verification event with a challenge field that must be echoed back in the response.pending-verification store to return successful responses.Sources: apps/sim/lib/webhooks/provider-subscriptions.ts1-1766
| Provider | Auth Method | ID Storage Field | Signature Type |
|---|---|---|---|
| Teams | OAuth 2.0 | externalSubscriptionId | clientState |
| Telegram | Bot Token | N/A | None |
| Airtable | OAuth / API Key | externalId | HMAC-SHA256 |
| Typeform | OAuth 2.0 | Tag (Webhook ID) | HMAC-SHA256 |
| Calendly | OAuth 2.0 | uri | HMAC-SHA256 |
| Ashby | API Key | id | HMAC-SHA256 |
| Attio | OAuth 2.0 | webhook_id | HMAC-SHA256 |
| Grain | API Key | externalId | None |
Sources: apps/sim/lib/webhooks/provider-subscriptions.ts1-1766 apps/sim/triggers/grain/webhook.ts1-76
Refresh this wiki