1MSG
ReferenceInbox API

Read the account inbox webhook

GET
/api/v1/inbox/webhook

One HTTPS URL per account. The owner sets it here or in Settings → Developer → API Settings. A user key cannot. When inbox state changes, 1MSG POSTs InboxWebhookEnvelope to that URL.

This is not the channel webhook. Incoming messages and delivery statuses stay on the channel URL.

Delivery

  • Content-Type: application/json
  • X-1msg-Event: the type
  • X-1msg-Delivery: the id
  • X-1msg-Signature: sha256=<hex HMAC of the raw body>

Compare the signature with HMAC-SHA256 over the exact request body with the signing secret. Reject a mismatch.

Delivery does not change the API response. A failed POST is stored as lastDeliveryStatus and lastDeliveryError.

Events

EventWhendata fields
inbox.conversation.status_changedConversation opened or closed. status is OPEN or CLOSED.conversationId, channelId, status, previousStatus, actorUserId
inbox.conversation.assignedAn assignee was set. assigneeUserId is the new assignee.conversationId, channelId, assigneeUserId, previousAssigneeUserId, actorUserId
inbox.conversation.unassignedThe assignee was cleared. assigneeUserId is null.conversationId, channelId, assigneeUserId, previousAssigneeUserId, actorUserId
inbox.conversation.blockedThe contact was blocked. Incoming messages are rejected.conversationId, channelId, actorUserId
inbox.conversation.unblockedThe contact was unblocked.conversationId, channelId, actorUserId
inbox.conversation.title_changedThe conversation title was renamed.conversationId, channelId, title, previousTitle, actorUserId
inbox.user.invitedThe owner invited a user. They are not a member until they accept.inviteId, email, channelIds, actorUserId
inbox.user.addedThe invited person accepted and is now an operator.memberId, userId, email, channelIds
inbox.user.removedAn operator was removed from the account.memberId, userId, actorUserId
inbox.user.channels_changedThe channels an operator can open were replaced.memberId, userId, channelIds, actorUserId
inbox.user.invite_revokedA pending invite was cancelled before it was accepted.inviteId, email, actorUserId

Authorization

bearer
headerAuthorizationBearer <token>

Key issued in Settings → Developer → API key. Inbox methods need the Inbox scope. Campaigns methods need the Campaigns scope.

Response Body

application/json
  1. response
url?|

HTTPS URL that receives POST deliveries. Null when no webhook is saved.

secretPrefix?|

First 12 characters of the signing secret. The full secret is not returned here.

createdAt?|
Formatdate-time
updatedAt?|
Formatdate-time
lastDeliveryAt?|

When the last delivery attempt finished.

Formatdate-time
lastDeliveryStatus?|

HTTP status from the last delivery. Null when the request did not get a response.

lastDeliveryError?|

Short error from the last failed delivery.

events*array<>

Every event this webhook can send. Message and delivery-status events stay on the channel webhook.

envelope*

Example of the JSON body 1MSG POSTs. data matches events[].example for the type in the body.

curl -X GET 'https://api.1msg.io/api/v1/inbox/webhook'
{  "url": "https://example.com/1msg/inbox",  "secretPrefix": "whsec_abc123",  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z",  "lastDeliveryAt": "2019-08-24T14:15:22Z",  "lastDeliveryStatus": 200,  "lastDeliveryError": "string",  "events": [    {      "type": "inbox.conversation.status_changed",      "description": "Conversation opened or closed. status is OPEN or CLOSED.",      "example": {        "conversationId": "d94a047f-5984-42af-9f89-0f26c7e70ef1",        "channelId": "QAF261225002",        "status": "CLOSED",        "previousStatus": "OPEN",        "actorUserId": "b2bb82f0-2253-4e05-b955-a21f3d699caa"      }    }  ],  "envelope": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "type": "inbox.conversation.status_changed",    "createdAt": "2019-08-24T14:15:22Z",    "data": {}  }}