Message
An email, text, Telegram or Slack message an agent received or sent: list them (by channel, direction or counterpart), read one, or send one, which can answer (replyTo) or pass on (forward) another.
Operations
Every route this entity exposes. Each route links to its own reference on this page.
| Method | Route | SDK operation | Returns |
|---|---|---|---|
POST |
/agents/{id}/messages |
create |
The sent message |
GET |
/agents/{id}/messages |
list |
The messages |
GET |
/agents/{id}/messages/{messageId} |
load |
The message |
Examples
One example per SDK, generated from the API model. The argument names are the parameters and fields of this entity, and the values are placeholders. The examples are not compiled or executed.
Golang
Construct client as shown in the Golang setup, then call the operations:
messages, err := client.Message(nil).List(map[string]any{"agent_id": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(messages)
message, err := client.Message(nil).Load(map[string]any{"agent_id": "example", "id": "example_id"}, nil)
if err != nil {
panic(err)
}
fmt.Println(message)
created, err := client.Message(nil).Create(map[string]any{"agent_id": "example", "text": "example"}, nil)
if err != nil {
panic(err)
}
fmt.Println(created)
Lua
Construct client as shown in the Lua setup, then call the operations:
local messages, err = client:Message():list({ agent_id = "example" })
local message, err = client:Message():load({ agent_id = "example", id = "example_id" })
local created, err = client:Message():create({ agent_id = "example", text = "example" })
PHP
Construct client as shown in the PHP setup, then call the operations:
$messages = $client->Message()->list(["agent_id" => "example"]);
$message = $client->Message()->load(["agent_id" => "example", "id" => "example_id"]);
$created = $client->Message()->create(["agent_id" => "example", "text" => "example"]);
Python
Construct client as shown in the Python setup, then call the operations:
messages = client.Message().list({"agent_id": "example"})
message = client.Message().load({"agent_id": "example", "id": "example_id"})
created = client.Message().create({ "agent_id": "example", "text": "example" })
Ruby
Construct client as shown in the Ruby setup, then call the operations:
messages = client.Message.list({ "agent_id" => "example" })
message = client.Message.load({ "agent_id" => "example", "id" => "example_id" })
created = client.Message.create({ "agent_id" => "example", "text" => "example" })
TypeScript
Construct client as shown in the TypeScript setup, then call the operations:
const messages = await client.Message().list({ agent_id: "example" })
const message = await client.Message().load({ agent_id: "example", id: "example_id" })
const created = await client.Message().create({ agent_id: "example", text: "example" })
Fields
| Field | Type | Required | Description |
|---|---|---|---|
addressId |
string |
Yes | The agent's address the message came to or went from; all zeros on url, where the agent's id is its address |
admission |
any |
Yes | Who the sender of a received message is to the agent: team for a member or agent of the workspace, listed for a sender on the channel's list, and anyone for everyone else, including senders who could not be verified |
attachments |
array |
Yes | Attachments |
author |
one,string,null |
Yes | Who wrote an inbound message in a group, such as a Telegram user id or the email of someone in a Slack channel |
authorName |
one,string,null |
Yes | The name the author goes by, when the channel tells it |
cc |
array |
Yes | Whom the message names as getting a copy |
channel |
string |
Yes | The channel's kind, from listChannels |
client |
string |
No | On url, the client you send from, like Codex, which the agent sees beside your name. |
counterpart |
string |
Yes | Who sent an inbound message, or the group it came in, or the recipients of an outbound one |
counterpartName |
one,string,null |
Yes | The name an inbound message's sender or group goes by, when the channel tells it |
createdAt |
string |
Yes | Created At |
direction |
string |
Yes | Direction |
error |
one,string,null |
Yes | Why a failed message was not sent or did not arrive |
forward |
string |
No | Forward |
id |
string |
Yes | Id |
refusal |
any |
Yes | Why a refused message did not wake the agent |
replyTo |
string |
No | Reply To |
status |
string |
Yes | reported when the recipient marked an email the agent sent as spam |
subject |
one,string,null |
Yes | Subject |
text |
string |
Yes | Text |
thread |
any |
Yes | For received and imported email, its Message-ID and References; for email the agent sent, those of the email it answered |
to |
array |
Yes | Whom the message names as its recipients; an inbound one names the agent unless it got a blind copy |
create
POST /agents/{id}/messages
Operation ID: sendMessage.
Authentication: bearer token (token) or oauth2 (oauth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id |
path |
string |
Yes | The agent's id |
Idempotency-Key |
header |
string |
No | A key of your choice, unique to this message. Sending again with the same key returns the message the first request sent instead of sending it twice, so a retry after a timeout is safe. |
Request body
application/json
| Property | Type | Required | Description |
|---|---|---|---|
attachments |
array of object or object |
No | |
cc |
array of string |
No | |
channel |
string |
No | The channel to start a conversation on, by its kind, from listChannels |
client |
string |
No | On url, the client you send from, like Codex, which the agent sees beside your name. Without it, Artil names the client your token was made for |
forward |
string (uuid) |
No | |
replyTo |
string (uuid) |
No | |
subject |
string |
No | |
text |
string |
Yes | |
thread |
string |
No | The thread of your client you send from, which an answer to the message wakes |
to |
array of string |
No |
multipart/form-data
| Property | Type | Required | Description |
|---|---|---|---|
draft |
string |
Yes | The message as JSON, with the fields of a JSON request |
file |
string (binary) or array of string (binary) |
No | The files to send, one part each |
Responses
201: The sent message
application/json
| Property | Type | Required | Description |
|---|---|---|---|
addressId |
string (uuid) |
Yes | The agent's address the message came to or went from; all zeros on url, where the agent's id is its address |
admission |
enum: team, listed, anyone or null |
Yes | Who the sender of a received message is to the agent: team for a member or agent of the workspace, listed for a sender on the channel's list, and anyone for everyone else, including senders who could not be verified |
attachments |
array of object |
Yes | |
attachments[].id |
string (uuid) or null |
Yes | The file's id, to send it on in attachments; null when Artil kept only the file's description |
attachments[].name |
string |
Yes | |
attachments[].size |
number |
Yes | |
attachments[].type |
string |
Yes | |
attachments[].url |
string,null |
Yes | Where to download the file: a link that needs no sign-in and expires after 15 minutes, so read the message again for a new one; null when Artil kept only the file's description |
author |
string,null |
Yes | Who wrote an inbound message in a group, such as a Telegram user id or the email of someone in a Slack channel |
authorName |
string,null |
Yes | The name the author goes by, when the channel tells it |
cc |
array of string |
Yes | Whom the message names as getting a copy |
channel |
string |
Yes | The channel's kind, from listChannels |
counterpart |
string |
Yes | Who sent an inbound message, or the group it came in, or the recipients of an outbound one |
counterpartName |
string,null |
Yes | The name an inbound message's sender or group goes by, when the channel tells it |
createdAt |
string (date-time) |
Yes | |
direction |
enum: inbound, outbound |
Yes | |
error |
string,null |
Yes | Why a failed message was not sent or did not arrive |
id |
string (uuid) |
Yes | |
refusal |
enum: self, spam, plan_limit, rate_limit, sender, outsider, ... or null |
Yes | Why a refused message did not wake the agent |
status |
enum: received, refused, sending, sent, failed, imported, ... |
Yes | reported when the recipient marked an email the agent sent as spam |
subject |
string,null |
Yes | |
text |
string |
Yes | |
thread |
object or null |
Yes | For received and imported email, its Message-ID and References; for email the agent sent, those of the email it answered |
to |
array of string |
Yes | Whom the message names as its recipients; an inbound one names the agent unless it got a blind copy |
4XX: The request failed; the error says why
application/json
| Property | Type | Required | Description |
|---|---|---|---|
error |
object |
Yes | |
error.code |
enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... |
Yes | |
error.message |
string |
Yes |
5XX: The request failed; the error says why
application/json
| Property | Type | Required | Description |
|---|---|---|---|
error |
object |
Yes | |
error.code |
enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... |
Yes | |
error.message |
string |
Yes |
list
GET /agents/{id}/messages
Operation ID: listMessages.
Authentication: bearer token (token) or oauth2 (oauth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id |
path |
string |
Yes | The agent's id |
channel |
query |
string |
No | The channel's kind, from listChannels |
direction |
query |
enum: inbound, outbound |
No | |
limit |
query |
integer |
No | |
counterpart |
query |
string |
No | Keep the messages from or to this address or number |
before |
query |
string (uuid) |
No | List the messages older than this one, to page back |
search |
query |
string |
No | Find the messages that hold these words, best match first. Only self-hosted Artil Connect servers search for now, and Artil Cloud answers forbidden |
Responses
200: The messages
application/json
| Property | Type | Required | Description |
|---|---|---|---|
[].addressId |
string (uuid) |
Yes | The agent's address the message came to or went from; all zeros on url, where the agent's id is its address |
[].admission |
enum: team, listed, anyone or null |
Yes | Who the sender of a received message is to the agent: team for a member or agent of the workspace, listed for a sender on the channel's list, and anyone for everyone else, including senders who could not be verified |
[].attachments |
array of object |
Yes | |
[].attachments[].id |
string (uuid) or null |
Yes | The file's id, to send it on in attachments; null when Artil kept only the file's description |
[].attachments[].name |
string |
Yes | |
[].attachments[].size |
number |
Yes | |
[].attachments[].type |
string |
Yes | |
[].attachments[].url |
string,null |
Yes | Where to download the file: a link that needs no sign-in and expires after 15 minutes, so read the message again for a new one; null when Artil kept only the file's description |
[].author |
string,null |
Yes | Who wrote an inbound message in a group, such as a Telegram user id or the email of someone in a Slack channel |
[].authorName |
string,null |
Yes | The name the author goes by, when the channel tells it |
[].cc |
array of string |
Yes | Whom the message names as getting a copy |
[].channel |
string |
Yes | The channel's kind, from listChannels |
[].counterpart |
string |
Yes | Who sent an inbound message, or the group it came in, or the recipients of an outbound one |
[].counterpartName |
string,null |
Yes | The name an inbound message's sender or group goes by, when the channel tells it |
[].createdAt |
string (date-time) |
Yes | |
[].direction |
enum: inbound, outbound |
Yes | |
[].error |
string,null |
Yes | Why a failed message was not sent or did not arrive |
[].id |
string (uuid) |
Yes | |
[].refusal |
enum: self, spam, plan_limit, rate_limit, sender, outsider, ... or null |
Yes | Why a refused message did not wake the agent |
[].status |
enum: received, refused, sending, sent, failed, imported, ... |
Yes | reported when the recipient marked an email the agent sent as spam |
[].subject |
string,null |
Yes | |
[].text |
string |
Yes | |
[].thread |
object or null |
Yes | For received and imported email, its Message-ID and References; for email the agent sent, those of the email it answered |
[].to |
array of string |
Yes | Whom the message names as its recipients; an inbound one names the agent unless it got a blind copy |
4XX: The request failed; the error says why
application/json
| Property | Type | Required | Description |
|---|---|---|---|
error |
object |
Yes | |
error.code |
enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... |
Yes | |
error.message |
string |
Yes |
5XX: The request failed; the error says why
application/json
| Property | Type | Required | Description |
|---|---|---|---|
error |
object |
Yes | |
error.code |
enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... |
Yes | |
error.message |
string |
Yes |
load
GET /agents/{id}/messages/{messageId}
Operation ID: readMessage.
Authentication: bearer token (token) or oauth2 (oauth).
Parameters
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id |
path |
string |
Yes | The agent's id |
messageId |
path |
string |
Yes |
Responses
200: The message
application/json
| Property | Type | Required | Description |
|---|---|---|---|
addressId |
string (uuid) |
Yes | The agent's address the message came to or went from; all zeros on url, where the agent's id is its address |
admission |
enum: team, listed, anyone or null |
Yes | Who the sender of a received message is to the agent: team for a member or agent of the workspace, listed for a sender on the channel's list, and anyone for everyone else, including senders who could not be verified |
attachments |
array of object |
Yes | |
attachments[].id |
string (uuid) or null |
Yes | The file's id, to send it on in attachments; null when Artil kept only the file's description |
attachments[].name |
string |
Yes | |
attachments[].size |
number |
Yes | |
attachments[].type |
string |
Yes | |
attachments[].url |
string,null |
Yes | Where to download the file: a link that needs no sign-in and expires after 15 minutes, so read the message again for a new one; null when Artil kept only the file's description |
author |
string,null |
Yes | Who wrote an inbound message in a group, such as a Telegram user id or the email of someone in a Slack channel |
authorName |
string,null |
Yes | The name the author goes by, when the channel tells it |
cc |
array of string |
Yes | Whom the message names as getting a copy |
channel |
string |
Yes | The channel's kind, from listChannels |
counterpart |
string |
Yes | Who sent an inbound message, or the group it came in, or the recipients of an outbound one |
counterpartName |
string,null |
Yes | The name an inbound message's sender or group goes by, when the channel tells it |
createdAt |
string (date-time) |
Yes | |
direction |
enum: inbound, outbound |
Yes | |
error |
string,null |
Yes | Why a failed message was not sent or did not arrive |
id |
string (uuid) |
Yes | |
refusal |
enum: self, spam, plan_limit, rate_limit, sender, outsider, ... or null |
Yes | Why a refused message did not wake the agent |
status |
enum: received, refused, sending, sent, failed, imported, ... |
Yes | reported when the recipient marked an email the agent sent as spam |
subject |
string,null |
Yes | |
text |
string |
Yes | |
thread |
object or null |
Yes | For received and imported email, its Message-ID and References; for email the agent sent, those of the email it answered |
to |
array of string |
Yes | Whom the message names as its recipients; an inbound one names the agent unless it got a blind copy |
4XX: The request failed; the error says why
application/json
| Property | Type | Required | Description |
|---|---|---|---|
error |
object |
Yes | |
error.code |
enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... |
Yes | |
error.message |
string |
Yes |
5XX: The request failed; the error says why
application/json
| Property | Type | Required | Description |
|---|---|---|---|
error |
object |
Yes | |
error.code |
enum: invalid_input, unauthorized, forbidden, plan_limit, not_found, conflict, ... |
Yes | |
error.message |
string |
Yes |