Webhooks
A webhook is a message Atlas sends to your system when something happens. You give Atlas a URL. Atlas sends a signed POST with the details, and tries again for about an hour if your endpoint doesn’t answer.
Use webhooks to log calls in your own database, start a workflow when a call ends, or keep a CRM current. You don’t have to ask Atlas over and over.
This is the other direction from Atlas actions. An action lets your agent call out to your system during a conversation. You add one in the app under Connections, then Actions, then New action, then Custom action (“Call your own API or webhook”). A webhook is the reverse: Atlas tells your system after something happened.
If you use Zapier, Make, Keragon or GoHighLevel, set up triggers from those tools instead. Webhooks are for sending events to your own endpoint.
Where you set it up
Event webhooks are set up through the API or the CLI. The Atlas app has no screen for them. The one thing you need from the app is the ID of the job to watch.
The API calls a job a campaign. That is why the fields below say campaignId. To find the ID, open the job in the app. The ID is in the page address, after id=. Or list your jobs with GET /campaign.
How it works
- You subscribe to one event for one job, and give a URL.
- When the event happens, Atlas sends a
POSTto that URL. The body is JSON. - Your endpoint answers with a
2xxstatus. If it doesn’t, Atlas retries on a schedule. See Delivery.
Events
You can subscribe to five events. triggerName is the value you send when you subscribe.
Subscribe
Send a POST to /events-gateway/trigger/subscribe:
With the CLI:
A good subscription returns 201:
The id is your URL. Each subscription is one event on one job. To get both call_started and call_completed, subscribe twice. To watch two jobs, subscribe once for each. To watch all of them, subscribe once with "campaignId": "*".
Atlas does not check for duplicates. If you subscribe the same URL to the same event twice, you get every event twice.
If a value is wrong you get 400. The body says why:
What Atlas sends
Atlas sends POST with Content-Type: application/json. The body is a JSON array that holds one event object. Read the first item.
Every request also carries three headers from the open Standard Webhooks specification. The body is the same as before, so a receiver that ignores the headers keeps working.
call_started
call_completed
Everything in call_started, plus the result:
The call length comes as durationMs, durationSeconds and durationMinutes (seconds divided by 60, not rounded). status is the final outcome of the call: Accepted, Rejected or Missed. endedReason is the raw reason the call ended, passed through as is.
Calls that ran a flow can carry extra fields, such as collected, flowId, flowVersion, blocksVisited, flowOutcome and answeredBy. They are only there when the call used that feature. Don’t depend on them being present.
When a job’s workflow handles the end of the call
If the job’s workflow has a step for how the call ended (a post-call step, a voicemail step or a no-answer step), that workflow handles the call. Then the call_completed webhooks you subscribed to for that one job do not fire for that call. Webhooks subscribed with "campaignId": "*" still fire. If you move a job onto a workflow, check which of these you rely on.
message_received and message_sent
message_sent carries sentAt in place of receivedAt.
message_session_completed
Sent once per chat session, after the chat has been quiet for inactivityTimeoutMinutes. If the customer writes again before then, the wait starts over. A message or follow-up that Atlas has scheduled for later also keeps the chat open: the wait starts after that message is due. If a session is marked completed on purpose, the event goes out without waiting. If you have several session-completed subscriptions on one job, the shortest inactivityTimeoutMinutes among them decides when Atlas checks. The event has the whole conversation and a summary.
In messages, role tells you who spoke. user is the customer. Any other value is your agent. Match on user and treat everything else as the agent.
Get a sample payload first
Build your receiver against real-shaped data. This returns a sample for a job you own. With the CLI it is atlas events-gateway events-get-sample-payload call_completed --campaignId YOUR_CAMPAIGN_ID.
List your webhooks
This lists the subscriptions on one job. With the CLI it is atlas events-gateway events-get-campaign-triggers YOUR_CAMPAIGN_ID.
Unsubscribe
Send a DELETE with the same values you subscribed with. A good call returns 200.
Or with curl:
Atlas finds the subscription by its URL. It removes one subscription per call, and it does not look at campaignId or triggerName to choose. If you use one URL for several events, put a different path on the URL for each event (for example /atlas/webhook/call-completed). Then you can remove each one on its own.
Delivery
- Atlas sends one
POSTper event per subscription, and waits up to 30 seconds for your reply. - Any
2xxstatus counts as delivered. - Atlas retries when the request times out, can’t connect, or gets
429or any5xx. It sends the same body with the samewebhook-id. - Atlas does not retry other
4xxstatuses. Your endpoint said the request itself is wrong, so sending it again won’t help. - Atlas does not follow redirects. A
3xxreply counts as a failed delivery and is not retried. Give Atlas the final URL. - Atlas does not send to a URL that points at a private, loopback or link-local address. That delivery fails and is not retried. Use a public URL.
- An event larger than 200 KB is sent once. If that attempt fails, it is not retried.
- A failed delivery does not cancel your subscription. Later events still go out.
- If you unsubscribe a URL, pending retries to it stop.
- Atlas does not promise an order. Two events close together, or a retry and a newer event, can reach you in either order.
Retry schedule
Five attempts in total, over about an hour:
Each wait varies by up to 20% so retries don’t all land at once. If your reply has a Retry-After header (seconds or an HTTP date) that asks for a longer wait, Atlas waits that long, up to one hour.
After the fifth attempt fails, Atlas stops. The event is not sent again. Atlas keeps a record of every attempt (time, status code and how long it took). It does not keep a copy of the body in that record.
So a webhook can still miss events if your endpoint is down for more than an hour. Don’t use it as your only record. After an outage, read the gap from the API. For calls, use the call records endpoints.
Build a reliable receiver
- Answer with
2xxfast, well within 30 seconds. Do the heavy work after you reply. - Store the event first. Process it from your own queue.
- Dedupe on
webhook-id. The same event can reach you more than once: a retry after a timeout you did reply to, or Atlas handling the same call twice. Keep the ids you’ve seen for at least a day and skip repeats. - Read
body[0]. The body is an array. - Reconcile on a schedule. List recent calls and compare against what you received.
Verify signatures
Atlas signs every request with a secret that belongs to your account. Check the signature, and drop any request that fails. Then you know Atlas sent it and nobody changed it on the way.
Your signing secret
Your secret looks like whsec_ followed by base64 text. It is the same for every webhook on your account. Atlas creates it the first time it signs a request for you.
To read your secret:
With the CLI: atlas events-gateway events-get-webhook-signing-secret. In the 24 hours after a rotation, the answer also has previousExpiresAt.
Keep it like a password. Store it in your secret manager, not in code.
How the signature is made
Atlas joins three things with dots: the webhook-id, the webhook-timestamp and the raw request body. It signs that text with HMAC-SHA256, using the base64-decoded part of your secret after whsec_. The header is v1, and the base64 result.
You don’t need to build this yourself. Use a Standard Webhooks library. It checks the signature, compares in constant time, and rejects old timestamps.
Use the raw body
Verify the body exactly as it arrived, byte for byte, before you parse it. If your framework parses JSON first and you turn it back into text, spacing or key order can change and the signature won’t match. In Express, use express.raw() on the webhook route. In Flask, use request.get_data().
Node.js
Python
Timestamp tolerance
The libraries reject a request whose webhook-timestamp is more than 5 min older or newer than your server’s clock. That stops someone from replaying an old request they captured. Keep your server clock synced (NTP). Every retry is signed again with a fresh timestamp, so retries pass this check.
Rotate your secret
If your secret leaks, or on your own schedule, rotate it. With the CLI: atlas events-gateway events-rotate-webhook-signing-secret.
For the next 24 hours (until previousExpiresAt) Atlas signs each request with both secrets. The webhook-signature header holds two v1, values separated by a space, and a library accepts the request if either one matches. Put the new secret in your receiver during that window. After it, only the new secret signs.
Other good habits
- Use an
https://URL. - Answer
400or401to a request that fails verification. Atlas won’t retry it. - When a step is risky, such as moving money, take the
callIdand fetch the call from the API with your key before you act.
Troubleshooting
- If no events arrive, then list the job’s subscriptions and check the
hookUrlandtriggerName. A subscription watches one event on one job, or every job with"campaignId": "*". - If
call_completedstopped after you moved a job onto a workflow with a post-call, voicemail or no-answer step, then subscribe with"campaignId": "*". See When a job’s workflow handles the end of the call. - If you get every event twice, then you subscribed the same URL to the same event twice. Unsubscribe one, and dedupe on
webhook-id. - If your endpoint gets nothing and your URL redirects, then give Atlas the final URL. Atlas does not follow redirects.
- If your URL points at a private or local address, then expose a public HTTPS URL. Atlas won’t send to private, loopback or link-local addresses.
- If events stop after your endpoint was down for over an hour, then read the gap from the API. Atlas does not send an event again after the fifth attempt.
- If subscribe returns
400, then read theerrorslist in the body. The table in Subscribe lists each message.
