Send a message
curl --request POST \
--url https://app.artil.dev/api/agents/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"replyTo": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": [
"<string>"
],
"subject": "<string>"
}
'import requests
url = "https://app.artil.dev/api/agents/{id}/messages"
payload = {
"text": "<string>",
"replyTo": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": ["<string>"],
"subject": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: '<string>',
replyTo: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
to: ['<string>'],
subject: '<string>'
})
};
fetch('https://app.artil.dev/api/agents/{id}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.artil.dev/api/agents/{id}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'replyTo' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'to' => [
'<string>'
],
'subject' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.artil.dev/api/agents/{id}/messages"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"replyTo\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.artil.dev/api/agents/{id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"replyTo\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.artil.dev/api/agents/{id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"replyTo\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"addressId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel": "email",
"direction": "inbound",
"counterpart": "<string>",
"subject": "<string>",
"text": "<string>",
"attachments": [
{
"name": "<string>",
"type": "<string>",
"size": 123
}
],
"status": "received",
"refusal": "self",
"error": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "invalid_input",
"message": "<string>"
}
}Messages
Send a message
Answer a message by giving its id as replyTo, or start a new one with a channel and recipients in to.
POST
/
agents
/
{id}
/
messages
Send a message
curl --request POST \
--url https://app.artil.dev/api/agents/{id}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"replyTo": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": [
"<string>"
],
"subject": "<string>"
}
'import requests
url = "https://app.artil.dev/api/agents/{id}/messages"
payload = {
"text": "<string>",
"replyTo": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"to": ["<string>"],
"subject": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: '<string>',
replyTo: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
to: ['<string>'],
subject: '<string>'
})
};
fetch('https://app.artil.dev/api/agents/{id}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.artil.dev/api/agents/{id}/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'text' => '<string>',
'replyTo' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'to' => [
'<string>'
],
'subject' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.artil.dev/api/agents/{id}/messages"
payload := strings.NewReader("{\n \"text\": \"<string>\",\n \"replyTo\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.artil.dev/api/agents/{id}/messages")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"replyTo\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.artil.dev/api/agents/{id}/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"text\": \"<string>\",\n \"replyTo\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"to\": [\n \"<string>\"\n ],\n \"subject\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"addressId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"channel": "email",
"direction": "inbound",
"counterpart": "<string>",
"subject": "<string>",
"text": "<string>",
"attachments": [
{
"name": "<string>",
"type": "<string>",
"size": 123
}
],
"status": "received",
"refusal": "self",
"error": "<string>",
"createdAt": "2023-11-07T05:31:56Z"
}{
"error": {
"code": "invalid_input",
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The agent's id
Body
application/json
Required string length:
1 - 32000Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Available options:
email, sms Required array length:
1 - 10 elementsRequired string length:
1 - 320Maximum string length:
240Response
The sent message
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$The agent's address the message came to or went from
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Available options:
email, sms Available options:
inbound, outbound Who sent an inbound message, or the recipients of an outbound one
Show child attributes
Show child attributes
Available options:
received, refused, sending, sent, failed Why a refused message did not wake the agent
Available options:
self, spam, plan_limit, rate_limit, sender, unverified Why a failed message was not sent