Desk360 APIs also support Cross-Origin Resource Sharing (CORS ).
The list of API commands used by Desk360
All API requests must reach the secure endpoint i.e. HTTPS only
This rate limit applies are based on IP address.
Make sure to apply the rate limit-best practices and it stays within the rate limit.
Make sure to make API calls in a safe layer such as your backend, not front-end or your mobile application .
Remind that even invalid requests are included in the rate limit.
Check your current rate limit status by looking at the following HTTP headers returned in response to each API request:
Copy HTTP/1.1 200 OK
Content-Type : application/json
X-RateLimit-Limit : 60
X-RateLimit-Remaining : 58
If your API request is received after the rate limit is reached, Desk360 will return an error in the response. The Retry-After value in the response header will tell you how long to wait before sending another API request.
Copy HTTP/1.1 200 OK
Content-Type : application/json
Retry-After : 26
Who can access my helpdesk? Can anyone see my data?
Before prioritizing a ticket or responding to a customer or using any of the APIs listed above, you must authenticate or log in as you sign in to your helpdesk web portal.
To authenticate the request, you can use your personal. You can obtain your API token with a request with your username and password .
All Desk360 API endpoints (except login) need this token in order to respond to your request.
Obtain your token with a request.
You can directly use v1/login endpoint in order to create/obtain an API token. This API will return an auto-generate a token and returns it.
To make it secure, the maximum wrong login attempt is fixed to 5 per minute .
Correct attempts do not affect the limits.
Login
POST
https://public-api.desk360.com/v1/login
Use a valid email and password pair to obtain a token.
Request Body
200 Your API access token return as "token"
Copy {
"access_token" : "1|iybflVqHloQdz9QH4PIkX0q1Od68T9sDrKCtnuxW6f78ad5b" ,
"token_type" : "Bearer"
}
cURL C# Java JavaScript PHP Python
Copy curl --location --request POST 'https://public-api.desk360.com/v1/login' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "abc@example.com",
"password": "YOUR_PASSWORD"
}'
Copy var client = new RestClient ( "https://public-api.desk360.com/v1/login" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . POST );
request . AddHeader ( "Content-Type" , "application/json" );
request.AddParameter("application/json", "{\n \"email\": \"abc@example.com\",\n \"password\": \"YOUR_PASSWORD\"\n}", ParameterType.RequestBody);
IRestResponse response = client . Execute (request);
Console . WriteLine ( response . Content );
Copy OkHttpClient client = new OkHttpClient() . newBuilder ()
. build ();
MediaType mediaType = MediaType . parse ( "application/json" );
RequestBody body = RequestBody.create(mediaType, "{\n \"email\": \"abc@example.com\",\n \"password\": \"YOUR_PASSWORD\"\n}");
Request request = new Request . Builder ()
. url ( "https://public-api.desk360.com/v1/login" )
. method ( "POST" , body)
. addHeader ( "Content-Type" , "application/json" )
. build ();
Response response = client . newCall (request) . execute ();
Copy var axios = require ( 'axios' );
var data = JSON .stringify ({ "email" : "abc@example.com" , "password" : "YOUR_PASSWORD" });
var config = {
method : 'post' ,
url : 'https://public-api.desk360.com/v1/login' ,
headers : {
'Content-Type' : 'application/json'
} ,
data : data
};
axios (config)
.then ( function (response) {
console .log ( JSON .stringify ( response .data));
})
.catch ( function (error) {
console .log (error);
});
Copy <? php
$client = new http \ Client ;
$request = new http \ Client \ Request ;
$request -> setRequestUrl ( 'https://public-api.desk360.com/v1/login' ) ;
$request -> setRequestMethod ( 'POST' ) ;
$body = new http \ Message \ Body ;
$body -> append ( '{
"email": "abc@example.com",
"password": "YOUR_PASSWORD"
}' ) ;
$request -> setBody ( $body ) ;
$request -> setOptions ( array () ) ;
$request -> setHeaders ( array (
'Content-Type' => 'application/json'
) ) ;
$client -> enqueue ( $request ) -> send () ;
$response = $client -> getResponse () ;
echo $response -> getBody () ;
Copy import requests
url = "https://public-api.desk360.com/v1/login"
payload = "{\n \"email\": \"abc@example.com\",\n \"password\": \"YOUR_PASSWORD\"\n}"
headers = {
'Content-Type' : 'application/json'
}
response = requests . request ( "POST" , url, headers = headers, data = payload)
print (response.text)
The following endpoints are supported with attachments:
Please follow the guidelines listed below:
Only files on a local machine can be added using the API. You can not use links!
Content-Type should always be multi-part/form-data for attached requests.
I received an error. How can I solve it?
API requests that cause errors will return an appropriate HTTP status code to help determine the type of error. You can use the following table to understand what each code means:
Sample error response
In addition to the HTTP status code, most errors also return a response with more information to help you troubleshoot the error. An example error response is shown below. The format of the error response is explained after the example.
Copy "error": {
"code": "failed_validation",
"message": "The to field is required."
"doc_url": "https://docs.desk360.com/api"
}
}
Error Response Fields
Error Codes
API responses that return a list of objects are paginated, for example, View Integration List . Add the parameter page to the query string to navigate through the pages. The page number starts from 1 and each page is fixed to show 20 objects.
Copy https://public-api.desk360.com/api/v1/integrations?page=1
The "Link" header in the response will be showing the next page if it exists:
Copy Headers
"Link" : <https://public-api.desk360.com/v1/integrations?page=2>; rel=next
If you are on the last page the link header will not be filled.
Whenever it is possible, please queue API calls on your side. This allows you to buffer recent calls to avoid reaching the rate limit. Once you reach the rate limit, retry API calls after the retry period.
Whenever it is feasible, cache the data that does not change much on your side. For example, the mapping between agent name and ID is extremely unlikely to change, so it is a useful approach to cache this data to avoid the rate limit.
Avoid making API calls directly from a mobile app, instead, send the request to your servers and make API calls from there. This ensures that if an API endpoint is changed, you can make and deploy the change on your server instead of updating your application and forcing your customers to the latest version.
Integrations
Apart from its competitors, Desk360 enables its customers to manage multiple integrations under one account.
In order to find your Integration ID , visit Integrations .
Integrations
GET
https://public-api.desk360.com/v1/integrations
List of your integrations.
200
Copy [
{
"id" : 11 ,
"display_name" : "YourIntegration1" ,
"phone_number" : "+905554443322"
} ,
{
"id" : 22 ,
"name" : "YourIntegration2" ,
"logo" : "+905555555555"
}
]
Code Samples
cURL C# Java JavaScript PHP Python
Copy curl --location --request GET 'https://public-api.desk360.com/v1/integrations' \
--header 'Authorization: Bearer YOUR_API_TOKEN'
Copy var client = new RestClient ( "https://public-api.desk360.com/v1/integrations" );
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Bearer YOUR_API_TOKEN" );
IRestResponse response = client . Execute (request);
Console . WriteLine ( response . Content );
Copy OkHttpClient client = new OkHttpClient() . newBuilder ()
. build ();
Request request = new Request . Builder ()
. url ( "https://public-api.desk360.com/v1/integrations" )
. method ( "GET" , null )
. addHeader ( "Authorization" , "Bearer YOUR_API_TOKEN" )
. build ();
Response response = client . newCall (request) . execute ();
Copy var axios = require ( 'axios' );
var config = {
method : 'get' ,
url : 'https://public-api.desk360.com/v1/integrations' ,
headers : {
'Authorization' : 'Bearer YOUR_API_TOKEN'
}
};
axios (config)
.then ( function (response) {
console .log ( JSON .stringify ( response .data));
})
.catch ( function (error) {
console .log (error);
});
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://public-api.desk360.com/v1/integrations' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => '' ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 0 ,
CURLOPT_FOLLOWLOCATION => true ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_TOKEN'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy import requests
url = "https://public-api.desk360.com/v1/integrations"
payload = {}
headers = {
'Authorization' : 'Bearer YOUR_API_TOKEN'
}
response = requests . request ( "GET" , url, headers = headers, data = payload)
print (response.text)
WhatsApp Message Templates
WhatsApp message templates are message formats that let you deliver multiple notifications to customers who have agreed to receive them via WhatsApp.
WhatsApp Message Templates
GET
https://public-api.desk360.comv1/integrations/:integrationId/conversations/templates
Get WhatsApp message template and languages list from a product.
Path Parameters
200
Copy [
{
"id" : 75 ,
"name" : "template_02" ,
"category_editable" : false ,
"sendable" : true ,
"category" : {
"value" : 2 ,
"label" : "template-messages.new.custom" ,
"subLabel" : "template-messages.new.custom-subtitle" ,
"status" : 1 ,
"children" : []
} ,
"category_label" : "template-messages.new.custom" ,
"supported_languages" : [
{
"label" : "English" ,
"value" : 1 ,
"filled" : true
} ,
{
"label" : "Türkçe" ,
"value" : 2 ,
"filled" : true
}
] ,
"translations" : [
{
"language_id" : 1 ,
"language" : "English" ,
"header_type" : null ,
"header_variables" : null ,
"header" : null ,
"header_file" : null ,
"body" : "English content test" ,
"body_variables" : null ,
"footer" : null ,
"variables" : [] ,
"buttons" : [] ,
"editable" : true ,
"status" : "template-messages.in-review" ,
"status_value" : 1 ,
"quality" : "template-messages.quality-unavailable" ,
"updated_at" : "2024-05-31T06:33:30.000000Z"
} ,
{
"language_id" : 2 ,
"language" : "Türkçe" ,
"header_type" : {
"value" : 4 ,
"label" : "TEXT"
} ,
"header_variables" : [
{
"id" : "" ,
"key" : "1" ,
"value" : "Header 1"
}
] ,
"header" : "Merhaba {{1}} ," ,
"header_file" : null ,
"body": "Merhaba {{1}}, Sipariş takip numaranız: {{2}} Bu takip numarası ile siparişinizin durumunu sorgulayabilirsiniz.",
"body_variables" : [
{
"id" : "" ,
"key" : "1" ,
"value" : "Ahmet Kara"
} ,
{
"id" : "" ,
"key" : "2" ,
"value" : "SP123456789"
}
] ,
"footer" : null ,
"variables" : [
"header-1" ,
"body-1" ,
"body-2"
] ,
"buttons" : [] ,
"editable" : true ,
"status" : "template-messages.active" ,
"status_value" : 2 ,
"quality" : "template-messages.quality-unavailable" ,
"updated_at" : "2024-05-30T12:16:37.000000Z"
}
] ,
"created_at" : "2024-05-30T12:14:28.000000Z" ,
"updated_at" : "2024-05-31T06:33:30.000000Z"
}
]
Code Samples
cURL C# Java Javascript PHP Python
Copy curl --location --request GET 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/?page=1' \--header 'Authorization: Bearer YOUR_API_TOKEN'
Copy var client = new RestClientRestClient("https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates");
client . Timeout = - 1 ;
var request = new RestRequest ( Method . GET );
request . AddHeader ( "Authorization" , "Bearer YOUR_API_TOKEN" );
IRestResponse response = client . Execute (request);
Console . WriteLine ( response . Content );
Copy OkHttpClient client = new OkHttpClient() . newBuilder ()
. build ();
Request request = new Request . Builder ()
. url ( "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates" )
. method ( "GET" , null )
. addHeader ( "Authorization" , "Bearer YOUR_API_TOKEN" )
. build ();
Response response = client . newCall (request) . execute ();
Copy var axios = require ( 'axios' );
var config = {
method : 'get' ,
url : 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates' ,
headers : {
'Authorization' : 'Bearer YOUR_API_TOKEN' ,
}
};
axios (config)
.then ( function (response) {
console .log ( JSON .stringify ( response .data));
})
.catch ( function (error) {
console .log (error);
});
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => '' ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 0 ,
CURLOPT_FOLLOWLOCATION => true ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => 'GET' ,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_TOKEN' ,
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy import requests
url = "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates"
payload = {}
headers = {
'Authorization' : 'Bearer YOUR_API_TOKEN' ,
}
response = requests . request ( "GET" , url, headers = headers, data = payload)
print (response.text)
Send WhatsApp Message Template
POST
https://public-api.desk360.com/v1/integrations/:integrationsId/conversations/templates/send
Send active WhatsApp message template to a WhatsApp number. If you send with attachments, use form-data. You can also send other body parameters with form-data as well.
Path Parameters
Request Body
200
Copy {
"message_id" : "gBEGkFBXUQRnAglW0luHY8xsrFk"
}
Code Samples
cURL C# Java Javascript PHP Python
Copy curl --location --request POST 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send' \
--header 'Authorization: YOUR_API_TOKEN' \
--form 'template_id="1"' \
--form 'language_id="1"' \
--form 'destinations[0][phone]="+905555555555"' \
--form 'destinations[0][parameters][header-1]="Header 1"' \
--form 'destinations[0][parameters][body-1]="Body 1"' \
--form 'destinations[0][parameters][body-2]="Body 2"' \
--form 'attachment=@"/test_image.jpg"'
Copy var options = new RestClientOptions ( "https://public-api.desk360.com" )
{
MaxTimeout = - 1 ,
};
var client = new RestClient (options);
var request = new RestRequest ( "/v1/integrations/integrationId/conversations/templates/send" , Method . Post );
request . AddHeader ( "Authorization" , "YOUR_API_TOKEN" );
request . AlwaysMultipartFormData = true ;
request . AddParameter ( "template_id" , "1" );
request . AddParameter ( "language_id" , "1" );
request . AddParameter ( "destinations[0][phone]" , "+905555555555" );
request . AddParameter ( "destinations[0][parameters][header-1]" , "Header 1" );
request . AddParameter ( "destinations[0][parameters][body-1]" , "Body 1" );
request . AddParameter ( "destinations[0][parameters][body-2]" , "Body 2" );
request . AddFile ( "attachment" , "/test_image.jpg" );
RestResponse response = await client . ExecuteAsync (request);
Console . WriteLine ( response . Content );
Copy OkHttpClient client = new OkHttpClient() . newBuilder ()
. build ();
MediaType mediaType = MediaType . parse ( "text/plain" );
RequestBody body = new MultipartBody . Builder () . setType ( MultipartBody . FORM )
. addFormDataPart ( "template_id" , "1" )
. addFormDataPart ( "language_id" , "1" )
. addFormDataPart ( "destinations[0][phone]" , "+905555555555" )
. addFormDataPart ( "destinations[0][parameters][header-1]" , "Header 1" )
. addFormDataPart ( "destinations[0][parameters][body-1]" , "Body 1" )
. addFormDataPart ( "destinations[0][parameters][body-2]" , "Body 2" )
. addFormDataPart ( "attachment" , "test_image.jpg" ,
RequestBody . create ( MediaType . parse ( "application/octet-stream" ) ,
new File( "/test_image.jpg" ) ))
. build ();
Request request = new Request . Builder ()
. url ( "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send" )
. method ( "POST" , body)
. addHeader ( "Authorization" , "YOUR_API_TOKEN" )
. build ();
Response response = client . newCall (request) . execute ();
Copy const axios = require ( 'axios' );
const FormData = require ( 'form-data' );
const fs = require ( 'fs' );
let data = new FormData ();
data .append ( 'template_id' , '1' );
data .append ( 'language_id' , '1' );
data .append ( 'destinations[0][phone]' , '+905555555555' );
data .append ( 'destinations[0][parameters][header-1]' , 'Header 1' );
data .append ( 'destinations[0][parameters][body-1]' , 'Body 1' );
data .append ( 'destinations[0][parameters][body-2]' , 'Body 2' );
data .append ( 'attachment' , fs .createReadStream ( '/test_image.jpg' ));
let config = {
method : 'post' ,
maxBodyLength : Infinity ,
url : 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send' ,
headers : {
'Authorization' : 'YOUR_API_TOKEN' ,
... data .getHeaders ()
} ,
data : data
};
axios .request (config)
.then ((response) => {
console .log ( JSON .stringify ( response .data));
})
.catch ((error) => {
console .log (error);
});
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => '' ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 0 ,
CURLOPT_FOLLOWLOCATION => true ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => array('template_id' => '1','language_id' => '1','destinations[0][phone]' => '+905555555555','destinations[0][parameters][header-1]' => 'Header 1','destinations[0][parameters][body-1]' => 'Body 1','destinations[0][parameters][body-2]' => 'Body 2','attachment'=> new CURLFILE('/test_image.jpg')),
CURLOPT_HTTPHEADER => array(
'Authorization: YOUR_API_TOKEN'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy import requests
url = "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send"
payload = { 'template_id' : '1' ,
'language_id' : '1' ,
'destinations[0][phone]' : '+905555555555' ,
'destinations[0][parameters][header-1]' : 'Header 1' ,
'destinations[0][parameters][body-1]' : 'Body 1' ,
'destinations[0][parameters][body-2]' : 'Body 2' }
files = [
( 'attachment' , ( 'test_image.jpg' , open ( '/test_image.jpg' , 'rb' ), 'image/png' ))
]
headers = {
'Authorization' : 'YOUR_API_TOKEN'
}
response = requests . request ( "POST" , url, headers = headers, data = payload, files = files)
print (response.text)
Bulk Send WhatsApp Message Template
POST
https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send/bulk
Send active WhatsApp message template to multiple WhatsApp number. If you send with attachments, use form-data. You can also send other body parameters with form-data as well.
Path Parameters
Request Body
200
Copy {
"phones" : [
"+905555555555"
]
}
Code Samples
cURL C# Java JavaScript PHP Python
Copy curl --location --request POST 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send/bulk' \
--header 'Authorization: YOUR_API_TOKEN' \
--form 'template_id="1"' \
--form 'language_id="1"' \
--form 'destinations[0][phone]="+905555555555"' \
--form 'parameters[header-1]="Header 1"' \
--form 'parameters[body-1]="Body 1"' \
--form 'parameters[body-2]="Body 2"' \
--form 'attachment=@"/test_image.jpg"'
Copy var options = new RestClientOptions ( "https://public-api.desk360.com" )
{
MaxTimeout = - 1 ,
};
var client = new RestClient (options);
var request = new RestRequest ( "/v1/integrations/:integrationId/conversations/templates/send/bulk" , Method . Post );
request . AddHeader ( "Authorization" , "YOUR_API_TOKEN" );
request . AlwaysMultipartFormData = true ;
request . AddParameter ( "template_id" , "1" );
request . AddParameter ( "language_id" , "1" );
request . AddParameter ( "destinations[0][phone]" , "+905555555555" );
request . AddParameter ( "parameters[header-1]" , "Header 1" );
request . AddParameter ( "parameters[body-1]" , "Body 1" );
request . AddParameter ( "parameters[body-2]" , "Body 2" );
request . AddFile ( "attachment" , "/test_image.jpg" );
RestResponse response = await client . ExecuteAsync (request);
Console . WriteLine ( response . Content );
Copy OkHttpClient client = new OkHttpClient() . newBuilder ()
. build ();
MediaType mediaType = MediaType . parse ( "text/plain" );
RequestBody body = new MultipartBody . Builder () . setType ( MultipartBody . FORM )
. addFormDataPart ( "template_id" , "1" )
. addFormDataPart ( "language_id" , "1" )
. addFormDataPart ( "destinations[0][phone]" , "+905555555555" )
. addFormDataPart ( "parameters[header-1]" , "Header 1" )
. addFormDataPart ( "parameters[body-1]" , "Body 1" )
. addFormDataPart ( "parameters[body-2]" , "Body 2" )
. addFormDataPart ( "attachment" , "test_image.jpg" ,
RequestBody . create ( MediaType . parse ( "application/octet-stream" ) ,
new File( "/test_image.jpg" ) ))
. build ();
Request request = new Request . Builder ()
. url ( "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send/bulk" )
. method ( "POST" , body)
. addHeader ( "Authorization" , "YOUR_API_TOKEN" )
. build ();
Response response = client . newCall (request) . execute ();
Copy const axios = require ( 'axios' );
const FormData = require ( 'form-data' );
const fs = require ( 'fs' );
let data = new FormData ();
data .append ( 'template_id' , '1' );
data .append ( 'language_id' , '1' );
data .append ( 'destinations[0][phone]' , '+905555555555' );
data .append ( 'parameters[header-1]' , 'Header 1' );
data .append ( 'parameters[body-1]' , 'Body 1' );
data .append ( 'parameters[body-2]' , 'Body 2' );
data .append ( 'attachment' , fs .createReadStream ( '/test_image.jpg' ));
let config = {
method : 'post' ,
maxBodyLength : Infinity ,
url : 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send/bulk' ,
headers : {
'Authorization' : 'YOUR_API_TOKEN' ,
... data .getHeaders ()
} ,
data : data
};
axios .request (config)
.then ((response) => {
console .log ( JSON .stringify ( response .data));
})
.catch ((error) => {
console .log (error);
});
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send/bulk' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => '' ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 0 ,
CURLOPT_FOLLOWLOCATION => true ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => array('template_id' => '1','language_id' => '1','destinations[0][phone]' => '+905555555555','parameters[header-1]' => 'Header 1','parameters[body-1]' => 'Body 1','parameters[body-2]' => 'Body 2','attachment'=> new CURLFILE('/test_image.jpg')),
CURLOPT_HTTPHEADER => array(
'Authorization: YOUR_API_TOKEN'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy import requests
url = "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/templates/send/bulk"
payload = { 'template_id' : '1' ,
'language_id' : '1' ,
'destinations[0][phone]' : '+905555555555' ,
'parameters[header-1]' : 'Header 1' ,
'parameters[body-1]' : 'Body 1' ,
'parameters[body-2]' : 'Body 2' }
files = [
( 'attachment' , ( 'desk360_facebook.png' , open ( '/test_image.jpg' , 'rb' ), 'image/png' ))
]
headers = {
'Authorization' : 'YOUR_API_TOKEN'
}
response = requests . request ( "POST" , url, headers = headers, data = payload, files = files)
print (response.text)
WhatsApp Messages
Use the messages node to send text, location, contact, media, interactive, location request and read receipt message to your customers.
Send WhatsApp Message
POST
https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages
Send message to an active WhatsApp number.
Path Parameters
Request Body
200
Copy {
"message_id" : "gBEGkFBXUQRnAgnoOJ1ESPKBwME"
}
Code Samples
cURL C# Java JavaScript PHP Python
Copy curl --location --request POST 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--form 'to="+90xxxxxxxxxx"' \
--form 'text="Hello!"'
Copy var options = new RestClientOptions ( "https://public-api.desk360.com" )
{
MaxTimeout = - 1 ,
};
var client = new RestClient (options);
var request = new RestRequest ( "/v1/integrations/:integrationId/conversations/messages" , Method . Post );
request . AddHeader ( "Authorization" , "Bearer YOUR_API_TOKEN" );
request . AlwaysMultipartFormData = true ;
request . AddParameter ( "to" , "+90xxxxxxxxxx" );
request . AddParameter ( "text" , "Hello!" );
RestResponse response = await client . ExecuteAsync (request);
Console . WriteLine ( response . Content );
Copy OkHttpClient client = new OkHttpClient() . newBuilder ()
. build ();
MediaType mediaType = MediaType . parse ( "text/plain" );
RequestBody body = new MultipartBody . Builder () . setType ( MultipartBody . FORM )
. addFormDataPart ( "to" , "+90xxxxxxxxxx" )
. addFormDataPart ( "text" , "Hello!" )
. build ();
Request request = new Request . Builder ()
. url ( "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages" )
. method ( "POST" , body)
. addHeader ( "Authorization" , "Bearer YOUR_API_TOKEN" )
. build ();
Response response = client . newCall (request) . execute ();
Copy const axios = require ( 'axios' );
const FormData = require ( 'form-data' );
let data = new FormData ();
data .append ( 'to' , '+90xxxxxxxxxx' );
data .append ( 'text' , 'hello!' );
let config = {
method : 'post' ,
maxBodyLength : Infinity ,
url : 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages' ,
headers : {
'Authorization' : 'Bearer YOUR_API_TOKEN' ,
... data .getHeaders ()
} ,
data : data
};
axios .request (config)
.then ((response) => {
console .log ( JSON .stringify ( response .data));
})
.catch ((error) => {
console .log (error);
});
Copy <? php
$curl = curl_init () ;
curl_setopt_array ( $curl , array(
CURLOPT_URL => 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages' ,
CURLOPT_RETURNTRANSFER => true ,
CURLOPT_ENCODING => '' ,
CURLOPT_MAXREDIRS => 10 ,
CURLOPT_TIMEOUT => 0 ,
CURLOPT_FOLLOWLOCATION => true ,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1 ,
CURLOPT_CUSTOMREQUEST => 'POST' ,
CURLOPT_POSTFIELDS => array( 'to' => '+90xxxxxxxxxx' , 'text' => 'Hello!' ) ,
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR_API_TOKEN'
) ,
) ) ;
$response = curl_exec ( $curl ) ;
curl_close ( $curl ) ;
echo $response;
Copy import requests
url = "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages"
payload = { 'to' : '+90xxxxxxxxxx' ,
'text' : 'Hello!' }
files = [
]
headers = {
'Authorization' : 'Bearer YOUR_API_TOKEN'
}
response = requests . request ( "POST" , url, headers = headers, data = payload, files = files)
print (response.text)
Send WhatsApp Location Message
POST
https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages
Send location message to an active WhatsApp number.
Path Parameters
Request Body
200
Copy {
"message_id" : "gBEGkFBXUQRnAgn3kXajlucbaso"
}
Code Samples
cURL C# Java JavaScript PHP Python
Copy curl --location --request POST 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages/locations' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--data '{
"to": "+90xxxxxxxxxx",
"location": {
"longitude": -122.425332,
"latitude": 37.758056,
"name": "Facebook HQ",
"address": "1 Hacker Way, Menlo Park, CA 94025"
}
}'
Copy var options = new RestClientOptions("https://public-api.desk360.com")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/v1/integrations/:integrationId/conversations/messages/locations", Method.Post);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer YOUR_API_TOKEN");
var body = @"{" + "\n" +
@" ""to"": ""+90xxxxxxxxxx""," + "\n" +
@" ""location"": {" + "\n" +
@" ""longitude"": -122.425332," + "\n" +
@" ""latitude"": 37.758056," + "\n" +
@" ""name"": ""Facebook HQ""," + "\n" +
@" ""address"": ""1 Hacker Way, Menlo Park, CA 94025""" + "\n" +
@" }" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
Copy OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"to\": \"+90xxxxxxxxxx\",\n \"location\": {\n \"longitude\": -122.425332,\n \"latitude\": 37.758056,\n \"name\": \"Facebook HQ\",\n \"address\": \"1 Hacker Way, Menlo Park, CA 94025\"\n }\n}");
Request request = new Request.Builder()
.url("https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages/locations")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer YOUR_API_TOKEN")
.build();
Response response = client.newCall(request).execute();
Copy const axios = require('axios');
let data = JSON.stringify({
"to": "+90xxxxxxxxxx",
"location": {
"longitude": -122.425332,
"latitude": 37.758056,
"name": "Facebook HQ",
"address": "1 Hacker Way, Menlo Park, CA 94025"
}
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages/locations',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_TOKEN'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
Copy <?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages/locations',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"to": "+90xxxxxxxxxx",
"location": {
"longitude": -122.425332,
"latitude": 37.758056,
"name": "Facebook HQ",
"address": "1 Hacker Way, Menlo Park, CA 94025"
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer YOUR_API_TOKEN'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Copy import requests
import json
url = "https://public-api.desk360.com/v1/integrations/:integrationId/conversations/messages/locations"
payload = json.dumps({
"to": "+90xxxxxxxxxx",
"location": {
"longitude": -122.425332,
"latitude": 37.758056,
"name": "Facebook HQ",
"address": "1 Hacker Way, Menlo Park, CA 94025"