How callbacks work
When you include acallback URL in a send request, Sling makes a POST request to that URL after the message is processed. Your endpoint should:
- Accept
POSTrequests with a JSON body. - Return an HTTP
200 OKresponse promptly to acknowledge receipt. - Perform any heavy processing asynchronously after acknowledging.
200 OK, Sling may treat the notification as undelivered.
Setting a callback URL
Pass your endpoint URL in thecallback field of any send-sms or send-truecaller request.
SMS with a callback
Truecaller with a callback
Callback payload
When Sling calls your endpoint, it sends aPOST request with a JSON body. The payload mirrors the fields returned in the original send response:
| Field | Description |
|---|---|
status | Overall request status — success or fail. |
status_delivery | Delivery outcome, e.g. delivered. |
message_id | The same ID returned in the original send response. Use this to match the callback to your original request. |
sender | The sender ID used to deliver the message. |
message | The message content that was sent. |
recipient | The phone number that received the message. |
credit_used | Number of credits deducted for this message. |
Tips
Truecaller: synchronous vs. asynchronous delivery
For Truecaller messages, the
instant parameter affects when — and whether — a callback is sent:instant: true— Sling processes delivery synchronously and returns the outcome directly in the API response. No callback is fired.instant: false— Sling queues the message and fires yourcallbackURL when delivery completes. This is the recommended mode when using callbacks.
