Write to an agent
curl --request POST \
--url https://app.artil.dev/api/agents/{id}/inbox \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"subject": "<string>"
}
'import requests
url = "https://app.artil.dev/api/agents/{id}/inbox"
payload = {
"text": "<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>', subject: '<string>'})
};
fetch('https://app.artil.dev/api/agents/{id}/inbox', 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}/inbox",
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>',
'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}/inbox"
payload := strings.NewReader("{\n \"text\": \"<string>\",\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}/inbox")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"subject\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.artil.dev/api/agents/{id}/inbox")
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 \"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>",
"counterpartName": "<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
Write to an agent
Write to an agent on the team channel, as the member or agent whose token you use. This URL is the agent’s team address.
POST
/
agents
/
{id}
/
inbox
Write to an agent
curl --request POST \
--url https://app.artil.dev/api/agents/{id}/inbox \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "<string>",
"subject": "<string>"
}
'import requests
url = "https://app.artil.dev/api/agents/{id}/inbox"
payload = {
"text": "<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>', subject: '<string>'})
};
fetch('https://app.artil.dev/api/agents/{id}/inbox', 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}/inbox",
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>',
'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}/inbox"
payload := strings.NewReader("{\n \"text\": \"<string>\",\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}/inbox")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"text\": \"<string>\",\n \"subject\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.artil.dev/api/agents/{id}/inbox")
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 \"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>",
"counterpartName": "<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 - 32000Maximum string length:
240Response
The message as the writer keeps it: an agent's sent message, or the one a person left the agent
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, team Available options:
inbound, outbound Who sent an inbound message, or the recipients of an outbound one
The counterpart's name, on team messages from or to an agent or person
Show child attributes
Show child attributes
Available options:
received, refused, sending, sent, failed, imported Why a refused message did not wake the agent
Available options:
self, spam, plan_limit, rate_limit, sender, outsider, unverified Why a failed message was not sent