Skip to content

Send a test message ​

Send a message as the contact into a test conversation, and let your AI agent answer it exactly as it would on the live channel: same pipeline, stage, instructions, knowledge and actions. Use it to test an agent end to end before (or while) it talks to real customers.

The agent's reply is saved in the conversation but never delivered to the channel, so no real contact receives anything.

POST/api/user/test-conversations/{conversation}/send-message
Required scope: conversations:test
Path parameters
integer
Request body (JSON)
curl -X POST "https://loopx-console.test/api/user/test-conversations/89328/send-message" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{"message":"How much is the Pro plan?"}'
<?php

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('POST', 'https://loopx-console.test/api/user/test-conversations/89328/send-message', [
    'headers' => [
        'Authorization' => 'Bearer $TOKEN',
        'Accept'        => 'application/json',
    ],
    'json' => [
        'message' => 'How much is the Pro plan?'
    ]
]);

$data = json_decode($response->getBody(), true);
const res = await fetch('https://loopx-console.test/api/user/test-conversations/89328/send-message', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer $TOKEN',
    Accept: 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "message": "How much is the Pro plan?"
  })
});

const data = await res.json();

Example response

{
  "status": true,
  "code": 200,
  "validation": [],
  "message": "Message sent successfully",
  "data": {
    "_id": "68e0f4a3c2b1a9f0d3e5a7b2",
    "role": "user",
    "status": "received",
    "is_test": true,
    "message": "How much is the Pro plan?",
    "external_chat_id": "201066278084",
    "conversation_id": 89328,
    "opportunity_id": 98314,
    "contact_id": 44016,
    "channel_id": 512,
    "stage_id": 189,
    "pipeline_id": 17,
    "call_type": "chat",
    "created_at": "2026-11-24T10:22:41.000000Z",
    "updated_at": "2026-11-24T10:22:41.000000Z"
  }
}

The runnable widget above sends JSON only

Attachments require a multipart/form-data request. See Sending attachments below.

The test flow ​

1. Create a test opportunity   POST /api/user/opportunities  { ..., is_test: true }   → conversation.id
2. Send a test message         POST /api/user/test-conversations/{conversation}/send-message
3. Read the AI reply           GET  /api/user/{conversation}/messages
  1. Create a test conversation. Create an opportunity with is_test: true (scope opportunities:write). The response includes conversation.id. Only conversations created this way are test conversations.
  2. Send the message. This endpoint saves it and hands it to the agent. It returns the saved contact message right away; it doesn't wait for the reply.
  3. Read the reply. The agent usually answers within a few seconds. Poll List messages (scope conversations:read) until the newest message has role = assistant and was created after your message.

Repeat steps 2 and 3 for a multi-turn conversation. The agent moves the opportunity between stages and runs actions just like in a live conversation.

Path parameters ​

NameTypeRequiredDescription
conversationintegeryesA test conversation id that belongs to your workspace (or a workspace you manage)

Request body ​

Provide message, files, or both.

FieldTypeDescription
messagestring | nullThe contact's message text. Required when no files are sent
filesfile[] | nullUp to 10 files, each ≤ 25 MB. Requires multipart/form-data
client_idstringOptional. Your own id for the message, stored on it and returned as-is, so you can match it later

Sending attachments ​

Upload files as multipart/form-data, repeating the files[] key. Use this to test how the agent handles images, voice notes or documents.

curl ​

bash
curl -X POST "https://api.genudo.ai/api/user/test-conversations/89328/send-message" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Accept: application/json" \
  -F "message=Is this model in stock?" \
  -F "files[]=@./product-photo.jpg"

Node.js ​

js
import fs from 'node:fs'

const form = new FormData()
form.append('message', 'Is this model in stock?')
form.append('files[]', new Blob([fs.readFileSync('./product-photo.jpg')]), 'product-photo.jpg')

const res = await fetch('https://api.genudo.ai/api/user/test-conversations/89328/send-message', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${token}`,
    Accept: 'application/json',
    // Do NOT set Content-Type — fetch sets the multipart boundary for you.
  },
  body: form,
})

Waiting for the reply ​

js
async function sendAndWait(conversationId, text) {
  const headers = { Authorization: `Bearer ${token}`, Accept: 'application/json', 'Content-Type': 'application/json' }
  const base = 'https://api.genudo.ai/api/user'

  const sent = await fetch(`${base}/test-conversations/${conversationId}/send-message`, {
    method: 'POST', headers, body: JSON.stringify({ message: text }),
  }).then((r) => r.json())

  // Poll every 3 seconds for up to a minute. Each poll counts toward the rate limit.
  for (let i = 0; i < 20; i++) {
    await new Promise((resolve) => setTimeout(resolve, 3000))
    const page = await fetch(`${base}/${conversationId}/messages?per_page=5`, { headers }).then((r) => r.json())
    const reply = page.data.data.find((m) => m.role === 'assistant' && m.created_at > sent.data.created_at)
    if (reply) return reply
  }

  throw new Error('No reply yet')
}

Response ​

The saved contact message, with role = user and is_test = true. The fields match those in List messages.

Side effects ​

  • The message is sent to the AI agent, which replies into the same conversation. The reply is not sent to the channel.
  • AI replies to test messages use credits, like live replies.
  • conversations.last_message_at and conversations.last_message_content are updated.
  • A new_message event is fired on the conversation.{id} socket channel.

Errors ​

CodeWhen
402Your workspace has no credits left
403Token missing conversations:test scope, or the conversation belongs to a different workspace
404Conversation not found
422The conversation isn't a test conversation (Only test conversations accept test messages)
422The conversation isn't linked to an active channel
422Neither message nor files provided, more than 10 files, or a file over 25 MB