πŸ’¬Chat with Chatbot

Send a question to a chatbot and receive a response. This endpoint also returns a chatlogId for maintaining conversation context and a list of sources used for the answer (max 5), ordered by relevancy.

Endpoint

POST https://app.wonderchat.io/api/v1/chat

Request Parameters

Parameter
Type
Required
Description

chatbotId

string

βœ… Yes

The ID of the chatbot you want to chat with

question

string

βœ… Yes

The question you wish to ask your chatbot

chatlogId

string

❌ No

The ID of your current chat session for conversation continuity

context

string

❌ No

Additional custom context about the chat session (e.g., user information)

contextUrl

string

❌ No

URL of the page the user is on to provide additional context

Example Request

curl --location --request POST 'https://app.wonderchat.io/api/v1/chat' \
--header 'Content-Type: application/json' \
--data-raw '{
  "chatbotId": "YOUR_CHATBOT_ID",
  "question": "Hello there!",
  "chatlogId": "YOUR_CHATLOG_ID",
  "context": "You are speaking with John, a 28 year old salesperson from Canada. English is not his native language, so please refrain from using complicated words.",
  "contextUrl": "https://yourwebsite.com/john-info"
}'

Response Format

{
  "response": "Hello there, how may I help you?",
  "chatlogId": "cli7n0vvs000008l43ez2bxa0",
  "sources": [
    {
      "url": "https://www.yourwebsite.com/source1",
      "title": "About Us"
    }
  ]
}

Response Fields

Field
Type
Description

response

string

The chatbot's response to your question

chatlogId

string

Unique identifier for this chat session

sources

array

List of sources used to generate the response (max 5)

sources[].url

string

URL of the source document

sources[].title

string

Title of the source document

Use Cases

  • Customer Support: Integrate chatbot responses into your support system

  • Website Chat: Power your website's chat widget

  • Mobile Apps: Add conversational AI to your mobile applications

  • Workflow Automation: Chain chatbot responses with other automated processes

Last updated

Was this helpful?