Real-time events

MCP Events let a compatible client receive Chatway activity as it happens, without polling and without separately configured Chatway webhooks. Events carry IDs and routing metadata only; the client reads the full details through MCP tools.

Setup

  1. Connect Chatway at https://mcp.chatway.app/mcp with a client that supports MCP Events, not only MCP tools:
    • ChatGPT: connect Chatway through its plugin, then use a Work chat on ChatGPT web, a Work chat in the desktop app with Cloud selected, or dots. Workspace controls for plugins and event-triggered tasks apply.
    • OpenClaw: enable the mcp-events plugin and set its callbackOrigin to a public HTTPS origin (no path) that reaches your OpenClaw gateway. Expose only /plugins/mcp-events/callback/ through it, not the rest of the gateway.
  2. As a Chatway owner or admin, authorize the widgets and channels the events should cover. Enable Receive real-time events (receive_events) and the read permissions listed below. New connections have it selected by default. Existing connections can add it under Manage access.
  3. Ask the assistant what to monitor and what to do. Check that it confirms the subscription was created, then test with a new visitor message.

Example:

Notify me here when a new visitor message arrives in Chatway. Include a summary and the conversation link. Do not reply to the visitor.

Connecting through OAuth and discovering events does not create a subscription. Automatic replies also need send_replies, an explicit instruction from you, and your client's normal approval rules.

Events and permissions

Every event requires Receive real-time events, plus one read permission:

Event Sent when Additional permission
conversation.created A new conversation is created, whether started by a visitor, an agent, an automation, or the API. read_conversations
message.received A visitor sends a message. Agent, AI, and system messages are never sent. read_conversation_messages
agent.assigned A conversation is assigned directly to an agent, not to a group. read_conversations
conversation.resolved A conversation is resolved. read_conversations

To react to customers, use message.received. Reading both the conversation details (get-conversation) and its messages (list-conversation-messages) needs both read permissions. Call events/list for the connection's live event catalog and schemas; it returns only the events the connection can subscribe to.

Filters

The optional widget_ids and social_account_ids arrays narrow the authorized sources. Omit both to receive events from every authorized source. If both are supplied, an event matching either list is delivered. Do not send empty arrays. Each list takes up to 100 values, and values outside the connection's access are rejected, so filters never widen what the connection can see.

Argument Values
widget_ids Widget identifiers, the same strings as widget_id in event payloads. Not the numeric widget_id returned by MCP tools.
social_account_ids Channel (social account) IDs as strings. Not the social_account_identifier returned by get-conversation.

Subscription methods

These are protocol methods on the authenticated MCP endpoint, not ordinary tools:

Method Purpose
events/list Discover events and their schemas.
events/subscribe Create or renew a subscription.
events/unsubscribe Stop a subscription. Safe to call more than once.

Example request with placeholders, using MCP protocol version 2026-07-28. That version requires the MCP-Protocol-Version and Mcp-Method headers to match the body, and protocol metadata in params._meta. Clients on an older, initialize-based session send the same params without _meta and without the Mcp-Method header.

POST /mcp
Authorization: Bearer <access-token>
Content-Type: application/json
MCP-Protocol-Version: 2026-07-28
Mcp-Method: events/subscribe
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "events/subscribe",
  "params": {
    "_meta": {
      "io.modelcontextprotocol/protocolVersion": "2026-07-28",
      "io.modelcontextprotocol/clientCapabilities": {}
    },
    "name": "message.received",
    "arguments": { "widget_ids": ["<authorized-widget-identifier>"] },
    "delivery": {
      "mode": "webhook",
      "url": "https://receiver.example.com/chatway-events",
      "secret": "whsec_<base64-signing-key>"
    },
    "ttlMs": 86400000
  }
}

A successful response, abbreviated. The MCP server also adds protocol fields such as _meta["io.modelcontextprotocol/serverInfo"].

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "resultType": "complete",
    "id": "sub_<40 hex characters>",
    "refreshBefore": "2026-11-05T09:15:02Z",
    "cursor": null,
    "truncated": false,
    "deliveryStatus": { "active": true, "lastDeliveryAt": null, "lastError": null }
  }
}

id is a string that stays the same for the same event, arguments, and callback URL. refreshBefore is an ISO 8601 UTC timestamp.

The client supplies the callback URL and secret. If you use a client that manages subscriptions for you, never paste a callback URL or secret into chat.

Callback verification

Chatway posts a signed {"type":"verification","challenge":"..."} request to the URL when it is first used with a secret, on a subscribe or renewal more than 24 hours after that URL and secret were last verified, and when a suspended or disabled subscription is reactivated. Respond with any 2xx and the JSON body {"challenge": "<same value>"}.

Renewal and unsubscribe

Store the returned id and refreshBefore. Delivery stops at refreshBefore, so call events/subscribe again before then with the same event, arguments, and callback URL. The subscription keeps its id. You may send a new secret when renewing; for one hour after the change, deliveries carry signatures from both the old and the new secret.

Unsubscribe with the same event, arguments, and callback URL. Refreshing the OAuth token does not renew an event subscription. Removing a required permission or inbox stops the matching deliveries immediately; the subscriptions stay, and deliveries resume as soon as access is given back, as long as refreshBefore has not passed. Disconnecting the connection, or reconnecting it with a different client, deletes its subscriptions, so the client has to subscribe again.

Each connection can hold up to 25 subscriptions and run up to 10 callback verifications per minute.

Delivery and handling

Each event is one signed HTTPS POST with the headers webhook-id, webhook-timestamp, webhook-signature, and X-MCP-Subscription-Id, and a body like:

{
  "eventId": "evt_...",
  "name": "message.received",
  "timestamp": "2026-10-28T09:15:02.000Z",
  "data": {
    "conversation_id": "...",
    "message_id": "...",
    "widget_id": "...",
    "channel": "website",
    "created_at": "..."
  },
  "cursor": null
}

The payload never includes the message body. widget_id can be null for conversations outside a website widget. Follow each event's live payloadSchema from events/list.

  1. Verify every request, including verification challenges, with a Standard Webhooks library that checks both the signature and the timestamp tolerance. Verify against the raw body using webhook-id, webhook-timestamp, and webhook-signature. A valid signature alone does not prove the request is recent. webhook-timestamp is when the request was signed, not when the event happened; the body's timestamp is the event time. Use X-MCP-Subscription-Id to identify the subscription.
  2. Respond with a 2xx within 10 seconds and do the work afterwards.
  3. Deduplicate by X-MCP-Subscription-Id and eventId together. Retries reuse the same eventId, so an event can arrive more than once. One occurrence that matches several subscriptions is delivered to each of them with the same eventId, so deduplicating by eventId alone across subscriptions is a choice your application has to make on purpose.
  4. Read the current state with get-conversation and list-conversation-messages. The conversation may already be answered, reassigned, or resolved.
  5. Avoid duplicate replies, replies to agent or AI messages, and conflicts with human handoffs.
  6. Keep the usual permissions and confirmation rules. Receiving an event never authorizes an action by itself.

Delivery and client processing are asynchronous, so a visible response in your client can lag behind the event.

Retries and failures

Response Result
2xx Delivered.
Timeout, connection error, 408, 425, 429, 5xx Retried up to 5 attempts within 15 minutes, signed afresh each time. Retry-After is honoured up to 5 minutes.
410 Gone The subscription is disabled.
Redirects and any other 3xx or 4xx Failed without a retry.

If the endpoint keeps failing for at least an hour, with 20 or more failures since the last successful delivery, the subscription is suspended. Fix the endpoint, then call events/subscribe again to verify it and resume. Missed events are not replayed; after downtime, use the read tools to catch up on current conversations.

MCP Events and webhooks

MCP Events and the webhooks configured under Settings → Developer Tools → Webhooks are separate systems with different payloads, signatures, and retry rules. Do not use the X-Chatway-* signature examples from Webhook docs → Overview to verify MCP Events.

Troubleshooting

Symptom Check
No events listed Call check-connection: its events field lists the events available and names any missing permission. Also check that the client supports MCP Events and has reloaded its event list (reconnect if it cached an older one).
Events listed but nothing subscribed events/subscribe returned an id. A Connected connection alone does not mean a subscription exists.
No deliveries The source matches the filters and is still authorized, the message came from a visitor, refreshBefore has not passed, and the callback is not returning errors.
Callback accepted but nothing visible The client's processing of the event. Do not replace a requested event subscription with scheduled polling.

Related pages