Skip to main content
You can connect Watermelon to any external tool or API to exchange messages in both directions. This allows you to:
  • Build or connect your own chat interface;
When the Agent replies, Watermelon sends a POST request with the response payload to your callback URL. The conversation remains visible in Watermelon as usual.

Webhook authentication

  1. Method: POST: Webhook URL:
    <https://webhook-custom-prod-1080791310029.europe-west1.run.app/custom/v1/webhook>
    
    Authentication:
    • Type: Bearer
    • Credentials: Bearer <watermelon_api_key>

Request schema

Messages sent to the webhook are automatically routed to the correct AI Agent and Watermelon user. When the Agent responds, the reply is POSTed to your callback_url. To ensure the message is sent from the right Agent, include your Chat Widget ID in the channel_id field. You can find this ID under Placement in the chat widget settings in Watermelon — it appears in the embed code as data-watermelon-widget-id. You need to create a chat widget in order to use this feature. Optional fields like contact_id and socket_id can be used to send a message to an active conversation. Content type: application/json Request body:
{
  "channel_name": "chatwidget",
  "channel_id": "[watermelon-widget-id]",
  "text": "Text the contact",
  "contact_id": "<int>,"        // optional
  "socket_id": "<string>",    // optional
  "callback_url": "[your callback url]"
}

Response schema

Watermelon sends replies or user messages to your callback URL in the following format:
{
  "contact_id": "<int>",    // contact ID
  "socket_id": "<string>",// conversation ID
  "message": "<string>"   // agent response or user message
}
socket_id uniquely identifies the conversation. Together with the contact_id, you can use it to send follow-up messages to the same thread.