Complete integration example
Complete integration example
A typical integration flow from session creation to receiving a bot response.
Step 1: Create a session
curl -X POST "https://channels.moveo.ai/v1/custom/YOUR_INTEGRATION_ID/sessions" \
-H "Authorization: apikey YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"external_session_id": "chat-session-001",
"channel_user_id": "user-12345",
"context": {
"user": {
"display_name": "Alice Smith",
"email": "alice@example.com",
"language": "en"
},
"source_page": "pricing"
}
}'
Response:
{
"request_id": "req-001",
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"context": { ... }
}
Step 2: Send a user message
curl -X POST "https://channels.moveo.ai/v1/custom/YOUR_INTEGRATION_ID/sessions/a1b2c3d4-e5f6-7890-abcd-ef1234567890/messages" \
-H "Authorization: apikey YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"text": "What pricing plans do you offer?"
}
}'
Response:
{
"request_id": "req-002"
}
Step 3: Receive bot response on your webhook
Moveo delivers the AI Agent's response to your webhook URL:
{
"event_type": "message:brain_send",
"request_id": "req-003",
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"external_session_id": "chat-session-001",
"timestamp": 1704067200000,
"output": {
"responses": [
{
"type": "text",
"text": "We offer three pricing plans: Starter, Professional, and Enterprise.",
"options": [
{ "label": "See Starter", "text": "Tell me about the Starter plan" },
{
"label": "See Professional",
"text": "Tell me about the Professional plan"
},
{
"label": "See Enterprise",
"text": "Tell me about the Enterprise plan"
}
]
}
]
}
}
Best practices
- Verify webhook signatures — always validate the
X-Moveo-Signatureheader before processing webhook events. See webhook security. - Respond quickly to webhooks — process webhook events asynchronously. Return
200 OKimmediately and handle the event in a background job. - Store the session ID — after creating a session, store the
session_idin your system for all subsequent API calls. - Use context effectively — pass relevant user and session data in the
contextobject to give the AI Agent more information for generating responses. - Handle session expiration — listen for
session:expiredevents to clean up local session state.
Next steps
- AI Agents — configure the agent that powers your integration.
- Environments — understand how integrations work with environments.
- Live chat — set up human agent handover for your custom integration.
- Context variables — learn how to use context variables in your AI Agent.