Overview
API Integration
Learn how to integrate your chatbot using the YourGPT Chatbot API
Connect Your Chatbot Anywhere with Chatbot API
Welcome to the Documentation page for YourGPT Chatbot APIs
Generating Keys
- Go to your Integration and click on manage API integration

-
Now create one key.
-
Copy your Generated API key

Note
The widget_uid is your chatbot's Widget ID.
For Example: 84292q0qw1eqw124-4173-af6e-569477ac9013
The Integration ID for the API is 17.
API Usage
- success code : 200, type: RXSUCCESS
- error code 400, type RXERROR
Create Session API
curl --location 'https://api.yourgpt.ai/chatbot/v1/createSession' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: pks-3e0a221e3dqweqwef0ecd123qe33a728e1dfa2a0ee01cc4ff8b8c99c21a45cff9' \
--data-urlencode 'widget_uid=84292q0qw1eqw124-4173-af6e-569477ac9013'Response
{
"type": "RXSUCCESS",
"message": "Chatbot session created successfully",
"data": {
"id": 1910677,
"session_uid": 17226012685401506,
"chat_mode": "1",
"project_id": 197,
"integration_id": 17,
"state": "pending",
"segment": "chat",
"status": "open",
"device_type": null,
"platform": null,
"ip": null,
"country": "IN",
"visitor_id": null,
"is_emulator": false,
"data": {},
"contact_id": null,
"updatedAt": "2024-08-02T12:21:08.540Z",
"createdAt": "2024-08-02T12:21:08.540Z"
}
}Note
To use the send message API, you must first establish a session. Obtain a session UID by executing the Create Session API.
Send Message API
curl --location 'https://api.yourgpt.ai/chatbot/v1/sendMessage' --header 'Content-Type: application/x-www-form-urlencoded' --header 'api-key: pks-3e0a221e3dqweqwef0ecd123qe33a728e1dfa2a0ee01cc4ff8b8c99c21a45cff9' --data-urlencode 'widget_uid=84292q0qw1eqw124-4173-af6e-569477ac9013' --data-urlencode 'session_uid=3977b1x2d-d1e1-0d5a-a473-a6841bc4c880' --data-urlencode 'message=hey there?'Response
{
"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
}
]
}
}