Create New Conversation
Creating a conversation in CriaChat requires a source id.
Learn more about source_id: Como Enviar Mensagem para Novos Contatos na Plataforma CriaChat - Tutorial Rápido
curl --request POST \
--url https://app.cria.chat/api/v1/accounts/{account_id}/conversations \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"source_id": "1234567890",
"inbox_id": 1,
"contact_id": 1,
"additional_attributes": {
"browser": "Chrome",
"browser_version": "89.0.4389.82",
"os": "Windows",
"os_version": "10"
},
"custom_attributes": {
"attribute_key": "attribute_value",
"priority_conversation_number": 3
},
"status": "open",
"assignee_id": 1,
"team_id": 1,
"snoozed_until": "2030-07-21T17:32:28Z"
}
'import requests
url = "https://app.cria.chat/api/v1/accounts/{account_id}/conversations"
payload = {
"source_id": "1234567890",
"inbox_id": 1,
"contact_id": 1,
"additional_attributes": {
"browser": "Chrome",
"browser_version": "89.0.4389.82",
"os": "Windows",
"os_version": "10"
},
"custom_attributes": {
"attribute_key": "attribute_value",
"priority_conversation_number": 3
},
"status": "open",
"assignee_id": 1,
"team_id": 1,
"snoozed_until": "2030-07-21T17:32:28Z"
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_id: '1234567890',
inbox_id: 1,
contact_id: 1,
additional_attributes: {
browser: 'Chrome',
browser_version: '89.0.4389.82',
os: 'Windows',
os_version: '10'
},
custom_attributes: {attribute_key: 'attribute_value', priority_conversation_number: 3},
status: 'open',
assignee_id: 1,
team_id: 1,
snoozed_until: '2030-07-21T17:32:28Z'
})
};
fetch('https://app.cria.chat/api/v1/accounts/{account_id}/conversations', 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.cria.chat/api/v1/accounts/{account_id}/conversations",
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([
'source_id' => '1234567890',
'inbox_id' => 1,
'contact_id' => 1,
'additional_attributes' => [
'browser' => 'Chrome',
'browser_version' => '89.0.4389.82',
'os' => 'Windows',
'os_version' => '10'
],
'custom_attributes' => [
'attribute_key' => 'attribute_value',
'priority_conversation_number' => 3
],
'status' => 'open',
'assignee_id' => 1,
'team_id' => 1,
'snoozed_until' => '2030-07-21T17:32:28Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_access_token: <api-key>"
],
]);
$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.cria.chat/api/v1/accounts/{account_id}/conversations"
payload := strings.NewReader("{\n \"source_id\": \"1234567890\",\n \"inbox_id\": 1,\n \"contact_id\": 1,\n \"additional_attributes\": {\n \"browser\": \"Chrome\",\n \"browser_version\": \"89.0.4389.82\",\n \"os\": \"Windows\",\n \"os_version\": \"10\"\n },\n \"custom_attributes\": {\n \"attribute_key\": \"attribute_value\",\n \"priority_conversation_number\": 3\n },\n \"status\": \"open\",\n \"assignee_id\": 1,\n \"team_id\": 1,\n \"snoozed_until\": \"2030-07-21T17:32:28Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_access_token", "<api-key>")
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.cria.chat/api/v1/accounts/{account_id}/conversations")
.header("api_access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source_id\": \"1234567890\",\n \"inbox_id\": 1,\n \"contact_id\": 1,\n \"additional_attributes\": {\n \"browser\": \"Chrome\",\n \"browser_version\": \"89.0.4389.82\",\n \"os\": \"Windows\",\n \"os_version\": \"10\"\n },\n \"custom_attributes\": {\n \"attribute_key\": \"attribute_value\",\n \"priority_conversation_number\": 3\n },\n \"status\": \"open\",\n \"assignee_id\": 1,\n \"team_id\": 1,\n \"snoozed_until\": \"2030-07-21T17:32:28Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cria.chat/api/v1/accounts/{account_id}/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_id\": \"1234567890\",\n \"inbox_id\": 1,\n \"contact_id\": 1,\n \"additional_attributes\": {\n \"browser\": \"Chrome\",\n \"browser_version\": \"89.0.4389.82\",\n \"os\": \"Windows\",\n \"os_version\": \"10\"\n },\n \"custom_attributes\": {\n \"attribute_key\": \"attribute_value\",\n \"priority_conversation_number\": 3\n },\n \"status\": \"open\",\n \"assignee_id\": 1,\n \"team_id\": 1,\n \"snoozed_until\": \"2030-07-21T17:32:28Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"account_id": 123,
"inbox_id": 123
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Authorizations
This token can be obtained by visiting the profile page or via rails console. Provides access to endpoints based on the user permissions levels. This token can be saved by an external system when user is created via API, to perform activities on behalf of the user.
Path Parameters
The numeric ID of the account
Body
Conversation source id
"1234567890"
Id of inbox in which the conversation is created
Allowed Inbox Types: Website, Phone, Api, Email
1
Contact Id for which conversation is created
1
Lets you specify attributes like browser information
{
"browser": "Chrome",
"browser_version": "89.0.4389.82",
"os": "Windows",
"os_version": "10"
}
The object to save custom attributes for conversation, accepts custom attributes key and value
{
"attribute_key": "attribute_value",
"priority_conversation_number": 3
}
Specify the conversation whether it's pending, open, closed
open, resolved, pending "open"
Agent Id for assigning a conversation to an agent
1
Team Id for assigning a conversation to a team\
1
Snoozed until date time
"2030-07-21T17:32:28Z"
The initial message to be sent to the conversation
Show child attributes
Show child attributes
curl --request POST \
--url https://app.cria.chat/api/v1/accounts/{account_id}/conversations \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"source_id": "1234567890",
"inbox_id": 1,
"contact_id": 1,
"additional_attributes": {
"browser": "Chrome",
"browser_version": "89.0.4389.82",
"os": "Windows",
"os_version": "10"
},
"custom_attributes": {
"attribute_key": "attribute_value",
"priority_conversation_number": 3
},
"status": "open",
"assignee_id": 1,
"team_id": 1,
"snoozed_until": "2030-07-21T17:32:28Z"
}
'import requests
url = "https://app.cria.chat/api/v1/accounts/{account_id}/conversations"
payload = {
"source_id": "1234567890",
"inbox_id": 1,
"contact_id": 1,
"additional_attributes": {
"browser": "Chrome",
"browser_version": "89.0.4389.82",
"os": "Windows",
"os_version": "10"
},
"custom_attributes": {
"attribute_key": "attribute_value",
"priority_conversation_number": 3
},
"status": "open",
"assignee_id": 1,
"team_id": 1,
"snoozed_until": "2030-07-21T17:32:28Z"
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
source_id: '1234567890',
inbox_id: 1,
contact_id: 1,
additional_attributes: {
browser: 'Chrome',
browser_version: '89.0.4389.82',
os: 'Windows',
os_version: '10'
},
custom_attributes: {attribute_key: 'attribute_value', priority_conversation_number: 3},
status: 'open',
assignee_id: 1,
team_id: 1,
snoozed_until: '2030-07-21T17:32:28Z'
})
};
fetch('https://app.cria.chat/api/v1/accounts/{account_id}/conversations', 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.cria.chat/api/v1/accounts/{account_id}/conversations",
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([
'source_id' => '1234567890',
'inbox_id' => 1,
'contact_id' => 1,
'additional_attributes' => [
'browser' => 'Chrome',
'browser_version' => '89.0.4389.82',
'os' => 'Windows',
'os_version' => '10'
],
'custom_attributes' => [
'attribute_key' => 'attribute_value',
'priority_conversation_number' => 3
],
'status' => 'open',
'assignee_id' => 1,
'team_id' => 1,
'snoozed_until' => '2030-07-21T17:32:28Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api_access_token: <api-key>"
],
]);
$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.cria.chat/api/v1/accounts/{account_id}/conversations"
payload := strings.NewReader("{\n \"source_id\": \"1234567890\",\n \"inbox_id\": 1,\n \"contact_id\": 1,\n \"additional_attributes\": {\n \"browser\": \"Chrome\",\n \"browser_version\": \"89.0.4389.82\",\n \"os\": \"Windows\",\n \"os_version\": \"10\"\n },\n \"custom_attributes\": {\n \"attribute_key\": \"attribute_value\",\n \"priority_conversation_number\": 3\n },\n \"status\": \"open\",\n \"assignee_id\": 1,\n \"team_id\": 1,\n \"snoozed_until\": \"2030-07-21T17:32:28Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api_access_token", "<api-key>")
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.cria.chat/api/v1/accounts/{account_id}/conversations")
.header("api_access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source_id\": \"1234567890\",\n \"inbox_id\": 1,\n \"contact_id\": 1,\n \"additional_attributes\": {\n \"browser\": \"Chrome\",\n \"browser_version\": \"89.0.4389.82\",\n \"os\": \"Windows\",\n \"os_version\": \"10\"\n },\n \"custom_attributes\": {\n \"attribute_key\": \"attribute_value\",\n \"priority_conversation_number\": 3\n },\n \"status\": \"open\",\n \"assignee_id\": 1,\n \"team_id\": 1,\n \"snoozed_until\": \"2030-07-21T17:32:28Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cria.chat/api/v1/accounts/{account_id}/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"source_id\": \"1234567890\",\n \"inbox_id\": 1,\n \"contact_id\": 1,\n \"additional_attributes\": {\n \"browser\": \"Chrome\",\n \"browser_version\": \"89.0.4389.82\",\n \"os\": \"Windows\",\n \"os_version\": \"10\"\n },\n \"custom_attributes\": {\n \"attribute_key\": \"attribute_value\",\n \"priority_conversation_number\": 3\n },\n \"status\": \"open\",\n \"assignee_id\": 1,\n \"team_id\": 1,\n \"snoozed_until\": \"2030-07-21T17:32:28Z\"\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"account_id": 123,
"inbox_id": 123
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}