# Status and inbound message callbacks

> Get message delivery statuses and incoming SMS, WhatsApp, iMessage and RCS messages pushed to your app instead of polling — where to set the callback URL, the two events, their payloads, verifying the signature, and what is and isn't sent today.

Source: https://docs.mycrmsim.com/guides/app-callbacks
Updated: 2026-11-26

Your app can poll `GET /api/v1/ext/messages` for new messages and statuses, or it
can have myCRMSIM **push** them to a URL of yours as they happen. This guide covers
the push.

---

## No code? Give a workspace its own webhook

If you only want messages sent to another tool (an automation platform, a
helpdesk, a sheet), you don't need an API app. A **Custom Location workspace**
can post every incoming message, and every status change, to a webhook URL you
paste in:

1. In the sidebar, open [Manage Workspaces](https://docs.mycrmsim.com/guides/manage-workspaces) (the **Workspaces / Webhooks** page) and click **Add Workspace**.
2. Give it a **Name**, then open **Advanced (optional)**.
3. Under **External system (webhook)**, paste the tool's webhook **URL**. Use
   **Add Header** if the tool needs a key in a header. The same URL and
   headers show on [Developers → Webhooks](https://docs.mycrmsim.com/guides/developers#webhooks), where
   you can also send a test.
4. Click **Create Workspace**.
5. Open **Subaccount SIM**, assign a line to the new workspace, and set its
   **Message Routing**.

Your tool now receives a `POST` for each message:

| `type` | When | Fields |
|---|---|---|
| `MESSAGE` | A message arrived, or was sent from the phone | `message`, `phone`, `isMe` (true for messages you sent), `attachments`, `location_id` |
| `STATUS-UPDATE` | A message you sent changed status | `message_id`, `status` (such as `sent`, `delivered`, `failed`) |

To send from your tool, `POST` to the send URL shown under **Instructions** on
the workspace's row. The message goes out on the workspace's routing; a
`channel` field is ignored. Deleting the workspace stops both directions.

> **Tip:** for Zapier or Make there's a ready-made app, so you don't need the
> webhook: see [Zapier](https://docs.mycrmsim.com/guides/zapier) and [Make](https://docs.mycrmsim.com/guides/make).

---

## Set the callback URL

The URL belongs to your API app. Set it when you request the app, under
**Integrations → Custom Integration → Request API app**, in the
**Callback URL** field. To change it later, open the card's
**View details**, choose **Edit**, and send the change for review; your app keeps
using the current URL until the change is approved.

One URL receives every event below. It must be a public `https://` (or `http://`)
address that answers a `POST` quickly.

> **Custom Location workspaces** don't need this URL for inbound messages: they
> already receive them on the inbound webhook set on the workspace itself (see
> *Get workspace* / *Update workspace*).
> They do need it for call events, which go only to this URL.

---

## Who gets a callback

A callback is sent to every app that:

- is **installed and active** on the account that owns the message, and
- is itself **active** (not disconnected), and
- has a callback URL set.

If two apps share the same URL, that URL is called once.

### Standard and Custom Location workspaces

| Event | Standard workspace | Custom Location workspace |
|---|---|---|
| `message.status` | Your app's callback URL | Your app's callback URL, and the workspace's own webhook as before |
| `message.inbound` | Your app's callback URL | **Only** the workspace's own inbound webhook, unchanged |

So a Custom Location integration keeps working exactly as it did; the callback URL
adds inbound messages for standard workspaces.

---

## The events

Every callback is a `POST` with a JSON body. Read the **`event`** field to tell the
two apart, and `app_id` to see which of your apps it is for.

### `message.status` — a delivery status changed

Sent when an outbound message moves to a new status: `sent`, `delivered`,
`read` or `failed`. Today this covers **SMS, iMessage, WhatsApp and RCS**, for every kind of
workspace.

| Channel | Statuses you receive |
|---|---|
| SMS | `sent`, `delivered`, `failed` |
| iMessage | `sent`, `delivered`, `read`, `failed` |
| RCS | `sent`, `failed` |
| WhatsApp | `sent`, `failed` |

**WhatsApp:** WhatsApp reports when a message leaves your WhatsApp line, not when it
reaches the contact's phone, so you get `sent` (or `failed`) and never `delivered`.
If the WhatsApp line was briefly unreachable, the message is held and sent again
automatically; you receive its `sent` or `failed` when that resend finishes, which
can be a few minutes later.

**RCS:** like WhatsApp, RCS reports whether the message left your RCS line, so you
get `sent` or `failed` (with `error_message`), not `delivered`.

**iMessage:** you can receive all four statuses for an iMessage:

| Status | Meaning |
|---|---|
| `sent` | The Mac sent the message to Apple. |
| `delivered` | It reached the contact's Apple device. |
| `read` | The contact opened it (only when they have read receipts turned on). |
| `failed` | It could not be sent; `error_message` says why. |

A message usually moves `sent` → `delivered` → `read`. `read` and `delivered` may
arrive without `sent` before them when the Mac reports late, and `read` never
arrives for a contact with read receipts off.

```json
{
  "event": "message.status",
  "message_id": 84213,
  "status": "delivered",
  "channel": "sms",
  "phone": "+61412345678",
  "message": "Thanks for your enquiry — we open at 09:00.",
  "error_message": null,
  "app_id": "6f1c0a9e2b3d4c5e6f7a8b9c"
}
```

- `message_id` is the same id *Send message* returned and *Get message* takes.
- `error_message` explains a `failed` status. It is sent for SMS, RCS and iMessage,
  not yet for WhatsApp; treat it as optional. *Get message* returns the stored
  reason for any channel.
- A status only ever moves forward: you won't get `sent` after `delivered` (or
  `delivered` after `read`), and a repeat of the same status is not sent again.
- `read` is iMessage only: the contact opened the message. It comes after
  `delivered`, and only when the contact has read receipts on.

### `message.inbound` — a message was received

Sent when a contact messages the workspace. Today this covers **SMS (including MMS),
RCS, and one-to-one WhatsApp and iMessage messages on standard workspaces**. Not
covered: Custom Location workspaces, which use their own inbound webhook; group
chats; iMessage tapback reactions; and calls, which have their own events (see
*Call events* below). `channel` tells you which line the message came in on.

```json
{
  "event": "message.inbound",
  "message_id": 84290,
  "direction": "inbound",
  "channel": "sms",
  "phone": "+61412345678",
  "message": "Yes, Tuesday works for me",
  "attachments": ["https://cdn.example.com/mms/84290-1.jpg"],
  "received_at": "2026-11-06T09:30:00",
  "app_id": "6f1c0a9e2b3d4c5e6f7a8b9c"
}
```

- `attachments` is always a list of file URLs; empty for a plain text. A WhatsApp
  file of 5 MB or more is not attached: `message` then says to view the file on the
  phone that received it.
- For WhatsApp, `phone` is the contact's WhatsApp number.
- For iMessage, `phone` is the handle the contact wrote from: a phone number, or
  their Apple ID email when they message from an email address.
- A message the contact's inbound Do-Not-Disturb blocks is not stored and sends
  no callback.

### Call events

The same URL also receives **`call.status`** (an outgoing call is ringing, was
answered, ended), for apps granted `calls.read` or `calls.write`. They are signed the same way as the events above; the payloads
are in [Build calling into your own system](https://docs.mycrmsim.com/guides/call-events).

---

## Verify the signature

Each callback carries an **`X-MyCRMSIM-Signature`** header:

```
X-MyCRMSIM-Signature: sha256=5d41402abc4b2a76b9719d911017c592...
```

It is an HMAC-SHA256 of the **raw request body**, keyed with your app's
**client secret**. Compute the same value and compare before trusting the body:

```js
// Node.js (Express): keep the raw body for verification
app.post('/hooks/mycrmsim', express.raw({ type: 'application/json' }), (req, res) => {
  const expected = 'sha256=' + crypto
    .createHmac('sha256', process.env.CLIENT_SECRET)
    .update(req.body) // the raw Buffer, not re-serialised JSON
    .digest('hex');
  const given = req.get('X-MyCRMSIM-Signature') || '';
  const ok = given.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
  if (!ok) return res.sendStatus(401);

  const event = JSON.parse(req.body);
  // event.event === 'message.status' | 'message.inbound' | 'call.status'
  res.sendStatus(200);
});
```

```python
# Python (Flask)
import hmac, hashlib
expected = 'sha256=' + hmac.new(CLIENT_SECRET.encode(), request.get_data(), hashlib.sha256).hexdigest()
if not hmac.compare_digest(expected, request.headers.get('X-MyCRMSIM-Signature', '')):
    abort(401)
```

If you **regenerate** the client secret, callbacks are signed with the new one
from then on — update your verifier at the same time.

---

## Respond fast, and keep polling as a backstop

- Answer with any **2xx** within **4 seconds**; do slow work after you respond.
- A callback is sent **once**. A timeout, a non-2xx answer or an unreachable URL is
  not retried, so treat the push as the fast path and *List messages* /
  *Get message* as the source of truth.
- Callbacks can arrive out of order and, rarely, more than once: use `message_id`
  (and `status`) to make handling idempotent.
