🤖 Chatbot
🔌 Integrations
API Integration

API Integration for YourGPT Chatbot

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.

image

  • Copy your Generated API key

image

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-3e0a221e3d0d78cf0ecd73be363a728e1dfa2a0ee01cc4ff8b8c99c21a45cff9' \
--data-urlencode 'widget_uid=8449240d-8454-4173-af6e-569477ac9013'
Response
{
    "type": "RXSUCCESS",
    "message": "Chatbot session created successfully",
    "data": {
        "id": 61889,
        "integration_id": 17,
        "status": "open",
        "device_type": null,
        "platform": null,
        "country": null,
        "project_id": 197,
        "visitor_id": null,
        "session_uid": "a2fa34b5-8b22-4cbf-acd0-222408ba53d0",
        "chat_mode": "1",
        "updatedAt": "2023-10-22T13:13:59.713Z",
        "createdAt": "2023-10-22T13:13:59.713Z"
    }
}

📌 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-3e0a221e3d0d78cf0ecd73be363a728e1dfa2a0ee01cc4ff8b8c99c21a45cff9' \
--data-urlencode 'widget_uid=8449240d-8454-4173-af6e-569477ac9013' \
--data-urlencode 'session_uid=39772b8d-d1c8-4d5a-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
            }
        ]
    }
}