Agents
Manage agents in your account via the API
Agents
Agents are the team members who handle conversations in Ndoto.
Base path: /api/v1/accounts/:account_id/agents
List agents
Returns all agents in your account.
GET /api/v1/accounts/:account_id/agentsResponse
[
{
"id": 5,
"name": "Alex Banda",
"email": "[email protected]",
"role": "agent",
"availability": "online",
"confirmed": true,
"avatar_url": "https://..."
}
]const response = await fetch(
'https://app.usendoto.com/api/v1/accounts/1/agents',
{
headers: { 'api_access_token': 'YOUR_TOKEN' },
}
);
const agents = await response.json();
console.log(agents);import requests
response = requests.get(
'https://app.usendoto.com/api/v1/accounts/1/agents',
headers={'api_access_token': 'YOUR_TOKEN'},
)
print(response.json())<?php
$ch = curl_init('https://app.usendoto.com/api/v1/accounts/1/agents');
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/agents'),
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/agents')
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)Create an agent
Invites a new agent to your account.
POST /api/v1/accounts/:account_id/agentsBody parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Agent's full name |
email | string | Yes | Agent's email address — an invite is sent to this address |
role | string | Yes | administrator or agent |
availability | string | No | online, busy, or offline. Default: online |
const response = await fetch(
'https://app.usendoto.com/api/v1/accounts/1/agents',
{
method: 'POST',
headers: {
'api_access_token': 'YOUR_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Alex Banda',
email: '[email protected]',
role: 'agent',
availability: 'online',
}),
}
);
const agent = await response.json();
console.log(agent);response = requests.post(
'https://app.usendoto.com/api/v1/accounts/1/agents',
headers={'api_access_token': 'YOUR_TOKEN'},
json={
'name': 'Alex Banda',
'email': '[email protected]',
'role': 'agent',
'availability': 'online',
},
)
print(response.json())<?php
$ch = curl_init('https://app.usendoto.com/api/v1/accounts/1/agents');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Alex Banda',
'email' => '[email protected]',
'role' => 'agent',
'availability' => 'online',
]),
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/agents'),
headers: {
'api_access_token': 'YOUR_TOKEN',
'Content-Type': 'application/json',
},
body: jsonEncode({
'name': 'Alex Banda',
'email': '[email protected]',
'role': 'agent',
'availability': 'online',
}),
);
print(jsonDecode(response.body));uri = URI('https://app.usendoto.com/api/v1/accounts/1/agents')
req = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')
req['api_access_token'] = 'YOUR_TOKEN'
req.body = JSON.dump(
name: 'Alex Banda',
email: '[email protected]',
role: 'agent',
availability: 'online'
)
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)Update an agent
Updates an existing agent's role or availability.
PATCH /api/v1/accounts/:account_id/agents/:idBody parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Agent's name |
role | string | No | administrator or agent |
availability | string | No | online, busy, or offline |
const response = await fetch(
'https://app.usendoto.com/api/v1/accounts/1/agents/5',
{
method: 'PATCH',
headers: {
'api_access_token': 'YOUR_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({ role: 'administrator' }),
}
);
const updated = await response.json();
console.log(updated);response = requests.patch(
'https://app.usendoto.com/api/v1/accounts/1/agents/5',
headers={'api_access_token': 'YOUR_TOKEN'},
json={'role': 'administrator'},
)
print(response.json())<?php
$ch = curl_init('https://app.usendoto.com/api/v1/accounts/1/agents/5');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_POSTFIELDS => json_encode(['role' => 'administrator']),
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.patch(
Uri.parse('https://app.usendoto.com/api/v1/accounts/1/agents/5'),
headers: {
'api_access_token': 'YOUR_TOKEN',
'Content-Type': 'application/json',
},
body: jsonEncode({'role': 'administrator'}),
);
print(jsonDecode(response.body));uri = URI('https://app.usendoto.com/api/v1/accounts/1/agents/5')
req = Net::HTTP::Patch.new(uri, 'Content-Type' => 'application/json')
req['api_access_token'] = 'YOUR_TOKEN'
req.body = JSON.dump(role: 'administrator')
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts JSON.parse(res.body)Delete an agent
Removes an agent from your account.
DELETE /api/v1/accounts/:account_id/agents/:idconst response = await fetch(
'https://app.usendoto.com/api/v1/accounts/1/agents/5',
{
method: 'DELETE',
headers: { 'api_access_token': 'YOUR_TOKEN' },
}
);
console.log(response.status); // 200response = requests.delete(
'https://app.usendoto.com/api/v1/accounts/1/agents/5',
headers={'api_access_token': 'YOUR_TOKEN'},
)
print(response.status_code)<?php
$ch = curl_init('https://app.usendoto.com/api/v1/accounts/1/agents/5');
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);
curl_close($ch);final response = await http.delete(
Uri.parse('https://app.usendoto.com/api/v1/accounts/1/agents/5'),
headers: {'api_access_token': 'YOUR_TOKEN'},
);
print(response.statusCode);uri = URI('https://app.usendoto.com/api/v1/accounts/1/agents/5')
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