Connect events and webhooks
Connect sends events to your server: an account that connects or needs a new sign-in, a post that publishes or fails, and messages for your customers. You register a webhook endpoint once, for all your customers.
These are the webhooks of the Connect API. The /v1/webhooks endpoints of the OmniSocials API, with their own signature, are not open to Connect keys.
Create a webhook endpoint
Terminal
events: []means every event. To receive fewer, list the types you want.- The answer includes
secret(whsec_…) once. Store it on your server, for example asOMNISOCIALS_WEBHOOK_SECRET. If you lose it, roll the secret in the console under Webhooks. - Register the final URL: redirects are not followed.
Event types
| Type | When |
|---|---|
account.connected | A customer connected an account |
account.needs_reconnect | An account needs a new sign-in. Create a connect link for that network, see Reconnects |
account.reconnected | An account that needed a new sign-in works again |
account.disconnected | An account was disconnected |
post.scheduled | A post was scheduled |
post.published | A post was published |
post.failed | A post failed |
post.approved | A post was approved |
post.rejected | A post was rejected |
notification.requested | A message for your customer, for you to deliver |
The body
JSON
livemodeisfalsein the sandbox andtrueon live.customernames the customer by both ids, so you can find it in your own database byexternal_id.datadepends on the type. Post events carry the post's id indata.post_id; read the post withGET /v1/posts/{id}and the customer header.
notification.requested
This event carries a message for your customer: data.subject, data.text and data.action_url, for example a reconnect link. Send it by email, SMS or in your product. OmniSocials never contacts your customers.
Verify the signature
Every request is signed the Standard Webhooks way, with the headers webhook-id, webhook-timestamp and webhook-signature. Verify it with the standardwebhooks package (npm, PyPI), your secret and the raw request body. Parse the JSON only after the check passes: a body that was parsed and serialized again may not match the signature.
Answer fast
- Answer
2xxwithin 10 seconds, and do slow work after you answered. - The whole answer must arrive within 15 seconds and be at most 1 MB. A slower or larger answer, or a redirect, counts as a failed attempt.
- A failed delivery is tried again for about a day.
- The same event can arrive twice. Keep the
idof each event you handled, and skip anidyou have seen before.
Send a test event
Terminal
The endpoint receives a sample event of that type with "test": true. Use it to test the parts of your handler that the sandbox does not trigger on its own, such as a reconnect.
In the sandbox, a test account that connects sends account.connected. The console shows every event and delivery under Logs for 30 days.