Messenger
Messenger API
Build a custom web or mobile chat client on top of dimmi's /widget/v1 HTTP API.
The Messenger API lives at /widget/v1 on https://trydimmi.com (or your self-hosted server URL). It uses JSON requests and responses and never reads or sets cookies.
Start a session
Section titled “Start a session”curl https://trydimmi.com/widget/v1/sessions \ -H "Content-Type: application/json" \ -d '{"app_id": "<app_id>"}'Copy <app_id> (wgt_...) from Settings → Messengers. The 201 response returns data.token (dmi_ws_...) once. Save it and send Authorization: Bearer <session_token> on every later call.
| Optional field | Purpose |
|---|---|
user_jwt |
An identity token that binds the session to a signed-in customer. |
previous_token |
Sent alongside user_jwt to merge an anonymous session’s threads into the signed-in customer. |
locale, timezone |
Language tag and IANA time zone. |
page |
Current page object: url (required), title, and referrer. |
website |
Honeypot field. Leave omitted; filling it flags the session as a bot and marks threads as spam. |
Send messages and poll for updates
Section titled “Send messages and poll for updates”curl https://trydimmi.com/widget/v1/conversations \ -H "Authorization: Bearer <session_token>" \ -H "Content-Type: application/json" \ -d '{"client_id": "7f9c2b1e-4a53-4d0e-9c1f-2b6a8e0d3f15", "body": "Where is my order?"}'
curl "https://trydimmi.com/widget/v1/updates?since=<cursor>" \ -H "Authorization: Bearer <session_token>"Generate a fresh UUID for client_id on every message so retries never create duplicates.
Omit since on your first /updates call. Each response gives you meta.cursor (pass as the next since), meta.poll_after_ms (wait interval), and meta.has_more.
event in /updates |
payload |
|---|---|
message.created, message.updated, message.deleted |
Message object |
conversation.updated, conversation.closed |
Conversation object |
Public endpoints (no session token)
Section titled “Public endpoints (no session token)”| Endpoint | What it does |
|---|---|
POST /sessions |
Starts a session. |
GET /apps/{app}/config |
Returns messenger appearance, copy, and enabled features. |
GET /apps/{app}/availability |
Returns office hours status and estimated reply time. |
GET /apps/{app}/help |
Returns public help center collections and articles. |
GET /apps/{app}/changelog |
Returns published changelog entries. |
GET /apps/{app}/ticket-types |
Returns customer-visible ticket types. |
POST /apps/{app}/article-views |
Records an article view. |
Authenticated endpoints (session token required)
Section titled “Authenticated endpoints (session token required)”| Endpoint | What it does |
|---|---|
GET /session |
Returns the session, contact profile, and unread count. |
PATCH /session |
Refreshes a signed-in session with a new user_jwt. |
DELETE /session |
Ends the session. |
GET /contact, PATCH /contact |
Reads or updates name, email, phone, and custom_attributes. |
POST /email-verifications |
Sends a 6-digit verification code to email. |
POST /email-verifications/checks |
Verifies the customer’s code. |
GET /conversations |
Lists customer conversations, newest first. Filter with filter[status]=open or closed. |
POST /conversations |
Starts a conversation with an opening message. |
POST /openers |
Opens a thread before the customer types so a workflow can greet them. |
GET /conversations/{conversation} |
Fetches one conversation. |
GET /conversations/{conversation}/messages |
Lists messages oldest first (before, after, limit up to 100). |
POST /conversations/{conversation}/messages |
Sends a message (client_id, body, up to 10 attachment_ids, or choice for reply buttons). |
PATCH /conversations/{conversation}/read-state |
Marks messages read up to last_read_message_id. |
POST /conversations/{conversation}/typing-indicators |
Sends a customer typing indicator. |
GET, PATCH /conversations/{conversation}/action-calls/{call} |
Reads or resolves a pending action confirmation (status: confirmed or canceled). |
GET, PATCH /conversations/{conversation}/rating |
Reads or submits a conversation rating (score 1 to 5, optional comment). |
POST /attachments |
Requests a presigned upload (filename, content_type, size_bytes), then upload bytes to data.upload.url. |
PATCH /attachments/{attachment} |
Finalizes an upload with status: "uploaded" so messages can reference it in attachment_ids. |
GET /ticket-types, GET /tickets, GET /tickets/{ticket} |
Lists ticket types and the customer’s tickets. |
POST /tickets |
Creates a ticket (client_id, type_id, title, description, fields). |
GET /help |
Returns help center articles this customer is allowed to read. |
POST /help-passes |
Generates a signed link to open the help center already signed in. |
POST /article-views, POST /article-ratings |
Records an article view or helpfulness rating. |
POST /events |
Sends 1 to 20 events. |
POST /pings |
Records the customer’s current page. |
POST /realtime-tokens |
Issues a realtime stream token to receive updates without polling. |
GET /updates |
Fetches up to 100 changes since a cursor. |
Errors, CORS, and rate limits
Section titled “Errors, CORS, and rate limits”Errors return {"code": "...", "message": "...", "errors": {}}. If you get 401 with session_invalid, session_expired, or session_revoked, start a new session.
Browser requests must come from a domain listed in Allowed sites when that list is non-empty. Requests without an Origin header (such as native mobile apps) require native_apps_enabled to be turned on via the REST API.
| Resource | Per session | Per IP / network |
|---|---|---|
| Messages | 20 / minute | 600 / hour |
| New conversations | 5 / hour | 60 / hour |
| File uploads | 10 / minute | 300 / hour |
| Event batches | 30 / minute | 3,000 / hour |
Max message body |
64 KB |