Send a message

Send a message to your Chatbot and get an AI generated response

This endpoint allows you to send a message to your Chatbot, if you haven’t started a conversation one will be created, and the conversationId will be returned.


The fields marked with * are mandatory


Request Body

  "success": true,
  "conversationId": "ea74ba3d-6645-4a88-92d1-7f78b1f83688",
  "response": "The average distance from the Earth to the Moon is about 238,855 miles (384,400 kilometers)."

Continue a conversation

If the field conversationId is set to true in the request body, the message will be added to the same conversation.

Streaming responses

If the field stream is set to true in the request body, the response will be streamed returning partial message deltas.

This allows the implementation of the ChatGPT-like experience, in which the response from the Chatbot is shown progressively. This usually provides a better user experience, as they don't have to wait until the full response is provided.

This is an example of NodeJS code to use the streaming response:

const response = await fetch("", {
  headers: {
    Authorization: "Bearer 1234567890",

// Stream response
if (!response.body) throw new Error("No response body");
const reader = response.body.getReader();

let message = ""
while (true) {
  const { done, value } = await;
  if (done) break;
  const text = new TextDecoder("utf-8").decode(value);
  message += text;
  // progressive message
// message complete

Interested in Userdesk?

Create your AI Chatbot today

Last updated