PATCH https://examplebaseURL.com/v1/api/apps/{appID}/inquiry-event-sub
| Parameter | Type | Description |
|---|---|---|
| enabled | Boolean | The value must be true or false. It is "true" when the subscription is successful, while it is "false" when the subscription fails. |
| url | String | The webhook URL. In access to this URL, you can receive an equiry notification in CINNOX. |
| updatedAt | String | The updated date and time of this subscription. The value must be in RFC3339 format, e.g. 2022-11-07T00:00:00.000Z. |
You can receive the an enquiry notification after subscribing to this event.
| Notification Details | Type | Description |
|---|---|---|
| status | String | It indicates the status of the enquiry. The values can be * Opened (A new enquiry is incoming) * Handling (An enquiry is being handled) * Closed (An enquiry is closed) * Missed (An enquiry is missed) |
| serviceId | String | The service ID in CINNOX. |
| displayCaseNumber | String | The Enquiry ID displayed in the CINNOX Dashboard. |
| eid | String | The record ID of the enquiry. |
| type | String | The value must be "inquiry". |
| channel | String | It indicates where the enquiry is received in CINNOX. The value can be * CINNOX (An enquiry received in the CINNOX Dashboard) * FACEBOOK (An enquiry received through a created Messager channel) * LINE (An enquiry received through a created LINE channel) * WECHAT (An enquiry received through a created WECHAT channel) * WHATSAPP (An enquiry received through a created WHATSAPP channel) * THIRDPARTY (An enquiry received through a created third party channel) -CHATBOT (An enquiry received through a chatbot) * EMAIL (An enquiry received through a created email channel) * WOZTELL (An enquiry received through a created WOZTELL channel) * INSTAGRAM (An enquiry received through a created Instagram channel) |
| channelOri | String | It indicates an origin of an enquiry. If the channel's value is CINNOX, the value can be * CINNOX (An enquiry's origin is the CINNOX service) * FACEBOOK (An enquiry's origin is Messager) * LINE (An enquiry's origin is LINE) * WECHAT (An enquiry's origin is WeChat) * WHATSAPP (An enquiry's origin is WhatsApp) * THIRDPARTY (An enquiry's origin is a third party) * CHATBOT (An enquiry's origin is a chatbot) * EMAIL (An enquiry's origin is an email) * WOZTELL (An enquiry's origin is WOZTELL) * INSTAGRAM (An enquiry's origin is Instagram) * VirtualNumber (An enquiry's origin is a call from a virtual number) * Directory (An enquiry's origin is Messager) * Weblink (An enquiry's origin is a web link) * Campaign (An enquiry's origin is an SMS campaign) * Unknown (An enquiry's origin is unknown) If the channel's value is not CINNOX, the value must be Channel. |
| socialId | String | The ID of the social channel through which the enquiry is received in CINNOX. If the enquiry's origin is not Messager, LINE, WhatsApp, WOZTELL or Instagram, an empty value is shown. |
| date | String | The date and time of the enquiry. The value must be in RFC3339 format, e.g. 2022-11-07T00:00:00.000Z. |
| destination | String | The ID of the destination which can be a service group, chatbot or IVR. |
| destinationTypes | String | The destination types. It can be * STAFF (The staff who handled the enquiry) * PHONE (PSTN Phone) * SIP (SIP Trunk) |
🚧
Webhook URL Requirement
The webhook URL needs to be verified. After that, you will get a POST request with an Action and are required to set the response in JSON Response format as shown below:
Note that the JsonResponse result is JSON encoding of the Action Endpoint Response.
Action Endpoint Request {
- Challenge string json:"challenge"
- }
Action Endpoint Response {
- Challenge string json:"challenge"
- }
Json Response {
- Code int json:"code"
- Result json.RawMessage json:"result"
- }
appID string required
App ID
enabled (Required) boolean
To subscribe to the event, the value = true; To unsubscribe to the existing event, the value = false.url (Required) string
The Webhook URL. You will get a POST request with an Action, and need to set the response in Json response format.
Content-Type string
application/jsonAuthorization string
Bearer AppToken
200
Response body
json400
Response body
object
code integer Defaults to 0
message string
LANGUAGE: Shell
curl --request PATCH \
--url https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub \
--header 'Authorization: Bearer AppToken' \
--header 'Content-Type: application/json' \
--header 'accept: application/json'
$ brew install httpie
http PATCH https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub \
Authorization:'Bearer AppToken' \
Content-Type:application/json \
accept:application/json
LANGUAGE: Node
$ npm install axios --save
import axios from 'axios';
const options = {
method: 'PATCH',
url: 'https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub',
headers: {
accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Bearer AppToken'
}
};
axios
.request(options)
.then(res => console.log(res.data))
.catch(err => console.error(err));
const url = 'https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub';
const options = {
method: 'PATCH',
headers: {
accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Bearer AppToken'
}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
const http = require('https');
const options = {
method: 'PATCH',
hostname: 'examplebaseurl.com',
port: null,
path: '/v1/api/apps/appID/inquiry-event-sub',
headers: {
accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Bearer AppToken'
}
};
const req = http.request(options, function (res) {
const chunks = [];
res.on('data', function (chunk) {
chunks.push(chunk);
});
res.on('end', function () {
const body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
$ npx api install "@cinnox2021/v7.3#45i1wk2km9l1e4hf"
import cinnox2021 from '@api/cinnox2021';
cinnox2021.createeditdeleteEnquiryEventSubscription({appID: 'appID', Authorization: 'Bearer AppToken'})
.then(({ data }) => console.log(data))
.catch(err => console.error(err));
LANGUAGE: Ruby
require 'uri'
require 'net/http'
url = URI("https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Bearer AppToken'
response = http.request(request)
puts response.read_body
LANGUAGE: PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer AppToken",
"Content-Type: application/json",
"accept: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
$ composer require guzzlehttp/guzzle
<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('PATCH', 'https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub', [
'headers' => [
'Authorization' => 'Bearer AppToken',
'Content-Type' => 'application/json',
'accept' => 'application/json',
],
]);
echo $response->getBody();
LANGUAGE: Python
$ python -m pip install requests
import requests
url = "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer AppToken"
}
response = requests.patch(url, headers=headers)
print(response.text)
LANGUAGE: C
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer AppToken");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
LANGUAGE: C#
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Patch,
RequestUri = new Uri("https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub"),
Headers =
{
{ "accept", "application/json" },
{ "Authorization", "Bearer AppToken" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
$ dotnet add package RestSharp
using RestSharp;
var options = new RestClientOptions("https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Bearer AppToken");
var response = await client.PatchAsync(request);
Console.WriteLine("{0}", response.Content);
LANGUAGE: C++
CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_easy_setopt(hnd, CURLOPT_WRITEDATA, stdout);
curl_easy_setopt(hnd, CURLOPT_URL, "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "accept: application/json");
headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "Authorization: Bearer AppToken");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
CURLcode ret = curl_easy_perform(hnd);
LANGUAGE: Clojure
(require '[clj-http.client :as client])
(client/patch "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub" {:headers {:Content-Type "application/json"
:Authorization "Bearer AppToken"}
:accept :json})
LANGUAGE: Go
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub"
req, _ := http.NewRequest("PATCH", url, nil)
req.Header.Add("accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer AppToken")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}
LANGUAGE: HTTP
PATCH /v1/api/apps/appID/inquiry-event-sub HTTP/1.1
Accept: application/json
Content-Type: application/json
Authorization: Bearer AppToken
Host: examplebaseurl.com
LANGUAGE: Java
AsyncHttpClient client = new DefaultAsyncHttpClient();
client.prepare("PATCH", "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub")
.setHeader("accept", "application/json")
.setHeader("Content-Type", "application/json")
.setHeader("Authorization", "Bearer AppToken")
.execute()
.toCompletableFuture()
.thenAccept(System.out::println)
.join();
client.close();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub"))
.header("accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer AppToken")
.method("PATCH", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub")
.patch(null)
.addHeader("accept", "application/json")
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer AppToken")
.build();
Response response = client.newCall(request).execute();
HttpResponse<String> response = Unirest.patch("https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub")
.header("accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer AppToken")
.asString();
LANGUAGE: JavaScript
$ npm install axios --save
import axios from 'axios';
const options = {
method: 'PATCH',
url: 'https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub',
headers: {
accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Bearer AppToken'
}
};
axios
.request(options)
.then(res => console.log(res.data))
.catch(err => console.error(err));
const options = {
method: 'PATCH',
headers: {
accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Bearer AppToken'
}
};
fetch('https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
const settings = {
async: true,
crossDomain: true,
url: 'https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub',
method: 'PATCH',
headers: {
accept: 'application/json',
'Content-Type': 'application/json',
Authorization: 'Bearer AppToken'
}
};
$.ajax(settings).done(res => {
console.log(res);
});
const data = null;
const xhr = new XMLHttpRequest();
const data = null;
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener('readystatechange', function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open('PATCH', 'https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub');
xhr.setRequestHeader('accept', 'application/json');
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.setRequestHeader('Authorization', 'Bearer AppToken');
xhr.send(data);
LANGUAGE: JSON
No JSON body
LANGUAGE: Kotlin
val client = OkHttpClient()
val request = Request.Builder()
.url("https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub")
.patch(null)
.addHeader("accept", "application/json")
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer AppToken")
.build()
val response = client.newCall(request).execute()
LANGUAGE: Objectve-C
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"accept": @"application/json",
@"Content-Type": @"application/json",
@"Authorization": @"Bearer AppToken" };
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"PATCH"];
[request setAllHTTPHeaderFields:headers];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
LANGUAGE: OCaml
$ opam install cohttp-lwt-unix cohttp-async
open Cohttp_lwt_unix
open Cohttp
open Lwt
let uri = Uri.of_string "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub" in
let headers = Header.add_list (Header.init ()) [
("accept", "application/json");
("Content-Type", "application/json");
("Authorization", "Bearer AppToken");
] in
Client.call ~headers `PATCH uri
>>= fun (res, body_stream) ->
(* Do stuff with the result *)
LANGUAGE: PowerShell
$headers=@{}
$headers.Add("accept", "application/json")
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Bearer AppToken")
$response = Invoke-RestMethod -Uri 'https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub' -Method PATCH -Headers $headers
$headers=@{}
$headers.Add("accept", "application/json")
$headers.Add("Content-Type", "application/json")
$headers.Add("Authorization", "Bearer AppToken")
$response = Invoke-WebRequest -Uri 'https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub' -Method PATCH -Headers $headers
LANGUAGE: R
library(httr)
url <- "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub"
response <- VERB("PATCH", url, add_headers('Authorization' = 'Bearer AppToken'), content_type("application/octet-stream"), accept("application/json"))
content(response, "text")
LANGUAGE: Swift
import Foundation
let url = URL(string: "https://examplebaseurl.com/v1/api/apps/appID/inquiry-event-sub")!
var request = URLRequest(url: url)
request.httpMethod = "PATCH"
request.timeoutInterval = 10
request.allHTTPHeaderFields = [
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "Bearer AppToken"
]
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self))
RESPONSE: 200-Result
{
"code": number,
"result": {
"enabled": boolean,
"url": "string",
"updatedAt": "string"
}
}
RESPONSE: 400-Result
{
"code": 0,
"message": "The error message from the server. Please refer to the error table."
}