Help Center › Features and settings

Open API and webhooks

Connect your member system so agents see member details, use the API to read chats and send messages, and receive webhooks for new messages.

4 min read · Updated 2026-11-27

This article is for developers. Everything is in Settings → Open API, in four tabs: Member identity, API keys, Webhook and API docs. The API docs tab has the full parameter list and examples.

Member identity

When a visitor is signed in to your website, you can pass their member details to your agents. Agents see them under Member in the right panel of the agent desk and no longer have to ask for an account number.

1. Send the details from your web page

After the member signs in, run this after the embed code:

<script>
  MeaiChat.identify({
    user_id: '10086',
    name: 'Alex Chen',
    email: 'alex@example.com',
    level: 'VIP3',
    balance: '1280.00'
  }, 'signature computed on your server');
</script>

Besides user_id, name, email and phone, you can send any fields you like, up to 20. You can also set window.MeaiChatSettings = { user: {...}, user_hash: 'signature' } before the embed code instead.

2. Compute the signature on your server

The signature stops visitors from changing the member ID to someone else's:

signature = HMAC-SHA256(identity secret, user_id), lowercase hex

Click Create secret on the Open API page. Each website has its own identity secret. Keep it on your server and never put it in a web page. The page has sample code for Node.js, PHP, Python and Java.

Member details without a signature are still shown, but agents see them marked "Unverified".

API keys

Available on the Pro and Business plans.

Click New key under API keys and choose:

  • Read only: can only read data.
  • Read & write: can also send messages, end chats and update visitor details.

Send the key in the request header:

Authorization: Bearer mc_your_key

Responses are JSON: { "data": ... } on success, { "error": { "code", "message" } } on failure. Each key can make up to 300 requests per minute.

Endpoints

MethodPathDescriptionNeeds
GET/api/v1/conversationsList chats, filtered by status, website, visitor or time, with pagingRead only
GET/api/v1/conversations/{id}One chat with visitor details and all messages (internal notes excluded)Read only
POST/api/v1/conversations/{id}/messagesSend a message to the visitor as an agentRead & write
POST/api/v1/conversations/{id}/closeEnd a chatRead & write
GET/api/v1/visitors/{id}Visitor details, including member detailsRead only
PATCH/api/v1/visitors/{id}Update a visitor's name, contact, notes, tags or member detailsRead & write
GET/api/v1/leavesOffline messagesRead only
GET/api/v1/agentsAgents and their current statusRead only

The base address is your console address, for example:

curl https://sunny-store.meaichats.com/api/v1/conversations?status=active \
  -H "Authorization: Bearer mc_your_key"

Webhooks

Available on the Pro and Business plans.

When there is a new chat, message, offline message or rating, we POST a JSON payload to your server right away. Click Add webhook under Webhook, enter your URL and choose the events.

EventSent when
conversation.createdA new chat starts (the visitor's first message)
conversation.closedA chat ends
message.createdA new message from the visitor or an agent (internal notes excluded)
rating.createdA visitor rates a chat
leave.createdA new offline message
visitor.identifiedA visitor signs in as a member
ticket.createdA new ticket
ticket.updatedA ticket changes

Good to know:

  • Headers include X-MeaiChat-Event (the event name), X-MeaiChat-Delivery (a delivery ID that stays the same on retries, useful for de-duplication) and X-MeaiChat-Signature.
  • A 2xx response within 8 seconds counts as delivered. Failed deliveries are retried after 30 seconds and again after 5 minutes. A webhook is turned off automatically after 50 failures in a row.
  • To verify the signature: signature = HMAC-SHA256(signing secret, timestamp + "." + raw body), hex. Use the raw request body; do not parse the JSON and convert it back to a string. Also check that the timestamp is within 5 minutes of now.

The API docs tab has sample code for verifying signatures.

Still stuck? Email us at support@meaichats.com