Conversations API
Create a conversation
Create a conversation
POST
/
public
/
api
/
v1
/
inboxes
/
{inbox_identifier}
/
contacts
/
{contact_identifier}
/
conversations
Create a conversation
curl --request POST \
--url https://app.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations \
--header 'Content-Type: application/json' \
--data '
{
"custom_attributes": {}
}
'import requests
url = "https://app.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations"
payload = { "custom_attributes": {} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({custom_attributes: {}})
};
fetch('https://app.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/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/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/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([
'custom_attributes' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations"
payload := strings.NewReader("{\n \"custom_attributes\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations")
.header("Content-Type", "application/json")
.body("{\n \"custom_attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"custom_attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"inbox_id": "<string>",
"messages": [
{
"id": 123,
"content": "<string>",
"account_id": 123,
"inbox_id": 123,
"conversation_id": 123,
"created_at": 123,
"updated_at": 123,
"private": true,
"source_id": "<string>",
"content_attributes": {},
"sender_id": 123,
"external_source_ids": {},
"additional_attributes": {},
"processed_message_content": "<string>",
"sentiment": {},
"conversation": {},
"attachment": {},
"sender": {}
}
],
"contact": {}
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Path Parameters
The identifier obtained from API inbox channel
The source id of contact obtained on contact create
Body
application/json
Custom attributes of the conversation
Example:
{}⌘I
Create a conversation
curl --request POST \
--url https://app.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations \
--header 'Content-Type: application/json' \
--data '
{
"custom_attributes": {}
}
'import requests
url = "https://app.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations"
payload = { "custom_attributes": {} }
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({custom_attributes: {}})
};
fetch('https://app.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/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/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/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([
'custom_attributes' => [
]
]),
CURLOPT_HTTPHEADER => [
"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.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations"
payload := strings.NewReader("{\n \"custom_attributes\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
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/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations")
.header("Content-Type", "application/json")
.body("{\n \"custom_attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.cria.chat/public/api/v1/inboxes/{inbox_identifier}/contacts/{contact_identifier}/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"custom_attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"inbox_id": "<string>",
"messages": [
{
"id": 123,
"content": "<string>",
"account_id": 123,
"inbox_id": 123,
"conversation_id": 123,
"created_at": 123,
"updated_at": 123,
"private": true,
"source_id": "<string>",
"content_attributes": {},
"sender_id": 123,
"external_source_ids": {},
"additional_attributes": {},
"processed_message_content": "<string>",
"sentiment": {},
"conversation": {},
"attachment": {},
"sender": {}
}
],
"contact": {}
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}