Atualizar Contact
Atualizar um contato pertencente à conta usando o ID
curl --request PUT \
--url https://airys.chat/api/v1/accounts/{account_id}/contacts/{id} \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"name": "Alice",
"email": "alice@acme.inc",
"blocked": false,
"phone_number": "+123456789",
"avatar": "<string>",
"avatar_url": "https://example.com/avatar.png",
"identifier": "1234567890",
"additional_attributes": {
"type": "customer",
"age": 30
},
"custom_attributes": {}
}
'import requests
url = "https://airys.chat/api/v1/accounts/{account_id}/contacts/{id}"
payload = {
"name": "Alice",
"email": "alice@acme.inc",
"blocked": False,
"phone_number": "+123456789",
"avatar": "<string>",
"avatar_url": "https://example.com/avatar.png",
"identifier": "1234567890",
"additional_attributes": {
"type": "customer",
"age": 30
},
"custom_attributes": {}
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Alice',
email: 'alice@acme.inc',
blocked: false,
phone_number: '+123456789',
avatar: '<string>',
avatar_url: 'https://example.com/avatar.png',
identifier: '1234567890',
additional_attributes: {type: 'customer', age: 30},
custom_attributes: {}
})
};
fetch('https://airys.chat/api/v1/accounts/{account_id}/contacts/{id}', 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://airys.chat/api/v1/accounts/{account_id}/contacts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Alice',
'email' => 'alice@acme.inc',
'blocked' => false,
'phone_number' => '+123456789',
'avatar' => '<string>',
'avatar_url' => 'https://example.com/avatar.png',
'identifier' => '1234567890',
'additional_attributes' => [
'type' => 'customer',
'age' => 30
],
'custom_attributes' => [
]
]),
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://airys.chat/api/v1/accounts/{account_id}/contacts/{id}"
payload := strings.NewReader("{\n \"name\": \"Alice\",\n \"email\": \"alice@acme.inc\",\n \"blocked\": false,\n \"phone_number\": \"+123456789\",\n \"avatar\": \"<string>\",\n \"avatar_url\": \"https://example.com/avatar.png\",\n \"identifier\": \"1234567890\",\n \"additional_attributes\": {\n \"type\": \"customer\",\n \"age\": 30\n },\n \"custom_attributes\": {}\n}")
req, _ := http.NewRequest("PUT", 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.put("https://airys.chat/api/v1/accounts/{account_id}/contacts/{id}")
.header("api_access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Alice\",\n \"email\": \"alice@acme.inc\",\n \"blocked\": false,\n \"phone_number\": \"+123456789\",\n \"avatar\": \"<string>\",\n \"avatar_url\": \"https://example.com/avatar.png\",\n \"identifier\": \"1234567890\",\n \"additional_attributes\": {\n \"type\": \"customer\",\n \"age\": 30\n },\n \"custom_attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://airys.chat/api/v1/accounts/{account_id}/contacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Alice\",\n \"email\": \"alice@acme.inc\",\n \"blocked\": false,\n \"phone_number\": \"+123456789\",\n \"avatar\": \"<string>\",\n \"avatar_url\": \"https://example.com/avatar.png\",\n \"identifier\": \"1234567890\",\n \"additional_attributes\": {\n \"type\": \"customer\",\n \"age\": 30\n },\n \"custom_attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"payload": [
{
"additional_attributes": {},
"availability_status": "<string>",
"email": "<string>",
"id": 123,
"name": "<string>",
"phone_number": "<string>",
"blocked": true,
"identifier": "<string>",
"thumbnail": "<string>",
"custom_attributes": {
"attribute_key": "attribute_value",
"signed_up_at": "dd/mm/yyyy"
},
"last_activity_at": 123,
"created_at": 123,
"contact_inboxes": [
{
"source_id": "<string>",
"inbox": {
"id": 123,
"avatar_url": "<string>",
"channel_id": 123,
"name": "<string>",
"channel_type": "<string>",
"provider": "<string>"
}
}
]
}
]
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}Autorizações
Este token pode ser obtido visitando a página de perfil ou por meio do console rails. Fornece acesso a endpoints com base nos níveis de permissões do usuário. Este token pode ser salvo por um sistema externo quando o usuário é criado via API, para realizar atividades em nome do usuário.
Parâmetros de caminho
O ID numérico da conta
ID do contato
Corpo
nome do contato
"Alice"
e-mail do contato
"alice@acme.inc"
se o contato está bloqueado ou não
false
número de telefone do contato
"+123456789"
Envie os dados do formulário com o binário da imagem do avatar ou use a avatar_url
O url para um arquivo jpeg, png para o avatar do contato
"https://example.com/avatar.png"
Um identificador exclusivo para o contato no sistema externo
"1234567890"
Um objeto onde você pode armazenar atributos adicionais para o contato. exemplo {"type":"customer", "age":30}
{ "type": "customer", "age": 30 }Um objeto onde você pode armazenar atributos personalizados para o contato. exemplo {"type":"customer", "age":30}, isso deve ter uma definição de atributo personalizado válida.
{}curl --request PUT \
--url https://airys.chat/api/v1/accounts/{account_id}/contacts/{id} \
--header 'Content-Type: application/json' \
--header 'api_access_token: <api-key>' \
--data '
{
"name": "Alice",
"email": "alice@acme.inc",
"blocked": false,
"phone_number": "+123456789",
"avatar": "<string>",
"avatar_url": "https://example.com/avatar.png",
"identifier": "1234567890",
"additional_attributes": {
"type": "customer",
"age": 30
},
"custom_attributes": {}
}
'import requests
url = "https://airys.chat/api/v1/accounts/{account_id}/contacts/{id}"
payload = {
"name": "Alice",
"email": "alice@acme.inc",
"blocked": False,
"phone_number": "+123456789",
"avatar": "<string>",
"avatar_url": "https://example.com/avatar.png",
"identifier": "1234567890",
"additional_attributes": {
"type": "customer",
"age": 30
},
"custom_attributes": {}
}
headers = {
"api_access_token": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {api_access_token: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Alice',
email: 'alice@acme.inc',
blocked: false,
phone_number: '+123456789',
avatar: '<string>',
avatar_url: 'https://example.com/avatar.png',
identifier: '1234567890',
additional_attributes: {type: 'customer', age: 30},
custom_attributes: {}
})
};
fetch('https://airys.chat/api/v1/accounts/{account_id}/contacts/{id}', 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://airys.chat/api/v1/accounts/{account_id}/contacts/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Alice',
'email' => 'alice@acme.inc',
'blocked' => false,
'phone_number' => '+123456789',
'avatar' => '<string>',
'avatar_url' => 'https://example.com/avatar.png',
'identifier' => '1234567890',
'additional_attributes' => [
'type' => 'customer',
'age' => 30
],
'custom_attributes' => [
]
]),
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://airys.chat/api/v1/accounts/{account_id}/contacts/{id}"
payload := strings.NewReader("{\n \"name\": \"Alice\",\n \"email\": \"alice@acme.inc\",\n \"blocked\": false,\n \"phone_number\": \"+123456789\",\n \"avatar\": \"<string>\",\n \"avatar_url\": \"https://example.com/avatar.png\",\n \"identifier\": \"1234567890\",\n \"additional_attributes\": {\n \"type\": \"customer\",\n \"age\": 30\n },\n \"custom_attributes\": {}\n}")
req, _ := http.NewRequest("PUT", 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.put("https://airys.chat/api/v1/accounts/{account_id}/contacts/{id}")
.header("api_access_token", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Alice\",\n \"email\": \"alice@acme.inc\",\n \"blocked\": false,\n \"phone_number\": \"+123456789\",\n \"avatar\": \"<string>\",\n \"avatar_url\": \"https://example.com/avatar.png\",\n \"identifier\": \"1234567890\",\n \"additional_attributes\": {\n \"type\": \"customer\",\n \"age\": 30\n },\n \"custom_attributes\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://airys.chat/api/v1/accounts/{account_id}/contacts/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["api_access_token"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Alice\",\n \"email\": \"alice@acme.inc\",\n \"blocked\": false,\n \"phone_number\": \"+123456789\",\n \"avatar\": \"<string>\",\n \"avatar_url\": \"https://example.com/avatar.png\",\n \"identifier\": \"1234567890\",\n \"additional_attributes\": {\n \"type\": \"customer\",\n \"age\": 30\n },\n \"custom_attributes\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"payload": [
{
"additional_attributes": {},
"availability_status": "<string>",
"email": "<string>",
"id": 123,
"name": "<string>",
"phone_number": "<string>",
"blocked": true,
"identifier": "<string>",
"thumbnail": "<string>",
"custom_attributes": {
"attribute_key": "attribute_value",
"signed_up_at": "dd/mm/yyyy"
},
"last_activity_at": 123,
"created_at": 123,
"contact_inboxes": [
{
"source_id": "<string>",
"inbox": {
"id": 123,
"avatar_url": "<string>",
"channel_id": 123,
"name": "<string>",
"channel_type": "<string>",
"provider": "<string>"
}
}
]
}
]
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}{
"description": "<string>",
"errors": [
{
"field": "<string>",
"message": "<string>",
"code": "<string>"
}
]
}