Ndoto Docs

Messages

Send and retrieve messages within conversations

Messages

Messages are the individual exchanges within a conversation. You can send outgoing messages, retrieve message history, and delete messages.

Base path: /api/v1/accounts/:account_id/conversations/:conversation_id/messages


List messages

Returns all messages in a conversation.

GET /api/v1/accounts/:account_id/conversations/:conversation_id/messages

Query parameters

ParameterTypeRequiredDescription
beforetimestampNoReturn messages before this Unix timestamp
aftertimestampNoReturn messages after this Unix timestamp

Response

{
  "payload": [
    {
      "id": 101,
      "content": "Hi, I need help with my order.",
      "message_type": "incoming",
      "status": "read",
      "private": false,
      "created_at": 1712001000,
      "sender": {
        "id": 10,
        "name": "Jane Doe",
        "type": "Contact"
      },
      "attachments": []
    }
  ]
}
const response = await fetch(
  'https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages',
  {
    headers: { 'api_access_token': 'YOUR_TOKEN' },
  }
);
const data = await response.json();
console.log(data.payload);
import requests

response = requests.get(
    'https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages',
    headers={'api_access_token': 'YOUR_TOKEN'},
)
print(response.json())
<?php
$ch = curl_init('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ['api_access_token: YOUR_TOKEN'],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
import 'package:http/http.dart' as http;
import 'dart:convert';

final response = await http.get(
  Uri.parse('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages'),
  headers: {'api_access_token': 'YOUR_TOKEN'},
);
print(jsonDecode(response.body));
require 'net/http'
require 'json'

uri = URI('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages')
req = Net::HTTP::Get.new(uri)
req['api_access_token'] = 'YOUR_TOKEN'

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)

Send a message

Sends a message in a conversation. Use message_type: "outgoing" for agent replies and message_type: "incoming" for simulating customer messages (useful with API channel inboxes).

POST /api/v1/accounts/:account_id/conversations/:conversation_id/messages

Body parameters

ParameterTypeRequiredDescription
contentstringYesThe message text
message_typestringYesoutgoing for agent messages, incoming for customer messages
privatebooleanNotrue to send as a private note (only visible to agents). Default: false
content_typestringNotext (default), input_select, input_email
content_attributesobjectNoAdditional structured content (e.g. form options)
// Send a reply to a customer
const response = await fetch(
  'https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages',
  {
    method: 'POST',
    headers: {
      'api_access_token': 'YOUR_TOKEN',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      content: 'Thanks for reaching out! We will look into this right away.',
      message_type: 'outgoing',
      private: false,
    }),
  }
);
const message = await response.json();
console.log(message);
import requests

response = requests.post(
    'https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages',
    headers={'api_access_token': 'YOUR_TOKEN'},
    json={
        'content': 'Thanks for reaching out! We will look into this right away.',
        'message_type': 'outgoing',
        'private': False,
    },
)
print(response.json())
<?php
$payload = json_encode([
    'content'      => 'Thanks for reaching out! We will look into this right away.',
    'message_type' => 'outgoing',
    'private'      => false,
]);

$ch = curl_init('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_POSTFIELDS     => $payload,
    CURLOPT_HTTPHEADER     => [
        'api_access_token: YOUR_TOKEN',
        'Content-Type: application/json',
    ],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
final response = await http.post(
  Uri.parse('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages'),
  headers: {
    'api_access_token': 'YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body: jsonEncode({
    'content': 'Thanks for reaching out! We will look into this right away.',
    'message_type': 'outgoing',
    'private': false,
  }),
);
print(jsonDecode(response.body));
uri = URI('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages')
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
req['api_access_token'] = 'YOUR_TOKEN'
req.body = JSON.dump(
  content: 'Thanks for reaching out! We will look into this right away.',
  message_type: 'outgoing',
  private: false
)

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)

Sending a private note

Private notes are only visible to your team. Set private: true to send one.

const response = await fetch(
  'https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages',
  {
    method: 'POST',
    headers: {
      'api_access_token': 'YOUR_TOKEN',
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      content: 'Internal note: customer is on the premium plan.',
      message_type: 'outgoing',
      private: true,
    }),
  }
);
const note = await response.json();
console.log(note);
response = requests.post(
    'https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages',
    headers={'api_access_token': 'YOUR_TOKEN'},
    json={
        'content': 'Internal note: customer is on the premium plan.',
        'message_type': 'outgoing',
        'private': True,
    },
)
print(response.json())
<?php
$ch = curl_init('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode([
        'content' => 'Internal note: customer is on the premium plan.',
        'message_type' => 'outgoing',
        'private' => true,
    ]),
    CURLOPT_HTTPHEADER => [
        'api_access_token: YOUR_TOKEN',
        'Content-Type: application/json',
    ],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($response);
final response = await http.post(
  Uri.parse('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages'),
  headers: {
    'api_access_token': 'YOUR_TOKEN',
    'Content-Type': 'application/json',
  },
  body: jsonEncode({
    'content': 'Internal note: customer is on the premium plan.',
    'message_type': 'outgoing',
    'private': true,
  }),
);
print(jsonDecode(response.body));
uri = URI('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages')
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
req['api_access_token'] = 'YOUR_TOKEN'
req.body = JSON.dump(
  content: 'Internal note: customer is on the premium plan.',
  message_type: 'outgoing',
  private: true
)

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)

Delete a message

Deletes a message from a conversation.

DELETE /api/v1/accounts/:account_id/conversations/:conversation_id/messages/:message_id
const response = await fetch(
  'https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages/101',
  {
    method: 'DELETE',
    headers: { 'api_access_token': 'YOUR_TOKEN' },
  }
);
console.log(response.status); // 200
response = requests.delete(
    'https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages/101',
    headers={'api_access_token': 'YOUR_TOKEN'},
)
print(response.status_code)  # 200
<?php
$ch = curl_init('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages/101');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST  => 'DELETE',
    CURLOPT_HTTPHEADER     => ['api_access_token: YOUR_TOKEN'],
]);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HTTP_CODE); // 200
curl_close($ch);
final response = await http.delete(
  Uri.parse('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages/101'),
  headers: {'api_access_token': 'YOUR_TOKEN'},
);
print(response.statusCode); // 200
uri = URI('https://app.usendoto.com/api/v1/accounts/1/conversations/42/messages/101')
req = Net::HTTP::Delete.new(uri)
req['api_access_token'] = 'YOUR_TOKEN'

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.code # 200

On this page