Send Message (Project API Key)
Send a message in a chat session using your project API Key. Use send_by to control whether the message is from the user, operator, or assistant.
Send a message in a chat session. Use send_by to control whether the message is from the user (triggers AI reply) or from an operator/assistant (no AI reply).
Authorization
apiKey
API key for authentication. Generate your API key from the Integration settings in your YourGPT dashboard.
In: header
Request Body
application/x-www-form-urlencoded
Your chatbot's Widget ID
Session UID obtained from Create Session API
The message to send
user (default) — triggers AI reply. operator — sends as human operator, switches chat mode to operator. assistant — sends as bot/system message. Both operator and assistant do not trigger AI.
"user""user" | "operator" | "assistant"Response Body
application/json
application/json
curl -X POST "https://api.yourgpt.ai/chatbot/v1/sendMessage" \ -H "Content-Type: application/x-www-form-urlencoded" \ -d 'widget_uid=string&session_uid=string&message=string'{
"type": "RXSUCCESS",
"message": "AI reply",
"data": {
"send_by": "assistant",
"origin": "api",
"session_uid": "39772b8d-d1c8-4d5a-a473-a6841bc4c880",
"type": "text",
"message_id": 241043,
"message": "Hello! How can I assist you today?",
"content_type": "picker",
"id": 241043,
"choices": [
{
"icon": "👍",
"text": "I am satisfied",
"value": "like",
"enabled": true
},
{
"icon": "👎",
"text": "I am not satisfied",
"value": "dislike",
"enabled": true
},
{
"icon": "🦸",
"text": "Request a human operator",
"value": "requesthumanoperator",
"enabled": true
}
]
}
}{
"type": "RXERROR",
"message": "string"
}send_by
| Value | Description |
|---|---|
user (default) | Sends as end-user. Triggers AI auto-reply. |
operator | Sends as human operator. No AI reply. Chat mode switches to operator. |
assistant | Sends as bot/system message. No AI reply. |
Operator Mode
send_by: "operator" automatically switches chat mode to operator. AI stops auto-replying until mode is changed back to bot via updateSession.