cURL
curl -X POST \
https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks \
-H 'Authorization: Bearer {{TOKEN}}' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://requestbin.io",
"eventTypes": ["message-received"]
}'var request = require("request");
var options = { method: 'POST',
url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks',
headers:
{ Authorization: 'Bearer {{TOKEN}}',
'Content-Type': 'application/json' },
body: { url: 'https://requestbin.io', eventTypes: [ 'message-received' ] },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$request = new HttpRequest();
$request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Authorization' => 'Bearer {{TOKEN}}',
'Content-Type' => 'application/json'
));
$request->setBody('{
"url": "https://requestbin.io",
"eventTypes": ["message-received"]
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://api.sakari.io/v1/accounts/{accountId}/webhooks"
payload = {
"url": "https://myserver.com/send/callback/here",
"eventTypes": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sakari.io/v1/accounts/{accountId}/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://myserver.com/send/callback/here\",\n \"eventTypes\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.sakari.io/v1/accounts/{accountId}/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://myserver.com/send/callback/here\",\n \"eventTypes\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sakari.io/v1/accounts/{accountId}/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://myserver.com/send/callback/here\",\n \"eventTypes\": []\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"eventTypes": [],
"destination": "<string>",
"id": "<string>",
"type": "<string>"
}
}webhooks
Subscribe to message events
When messages are acknowledge by carriers, a notification is sent to the specified URL
POST
/
v1
/
accounts
/
{accountId}
/
webhooks
cURL
curl -X POST \
https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks \
-H 'Authorization: Bearer {{TOKEN}}' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://requestbin.io",
"eventTypes": ["message-received"]
}'var request = require("request");
var options = { method: 'POST',
url: 'https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks',
headers:
{ Authorization: 'Bearer {{TOKEN}}',
'Content-Type': 'application/json' },
body: { url: 'https://requestbin.io', eventTypes: [ 'message-received' ] },
json: true };
request(options, function (error, response, body) {
if (error) throw new Error(error);
console.log(body);
});
<?php
$request = new HttpRequest();
$request->setUrl('https://api.sakari.io/v1/accounts/{{ACCOUNT_ID}}/webhooks');
$request->setMethod(HTTP_METH_POST);
$request->setHeaders(array(
'Authorization' => 'Bearer {{TOKEN}}',
'Content-Type' => 'application/json'
));
$request->setBody('{
"url": "https://requestbin.io",
"eventTypes": ["message-received"]
}');
try {
$response = $request->send();
echo $response->getBody();
} catch (HttpException $ex) {
echo $ex;
}
import requests
url = "https://api.sakari.io/v1/accounts/{accountId}/webhooks"
payload = {
"url": "https://myserver.com/send/callback/here",
"eventTypes": []
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.sakari.io/v1/accounts/{accountId}/webhooks"
payload := strings.NewReader("{\n \"url\": \"https://myserver.com/send/callback/here\",\n \"eventTypes\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.sakari.io/v1/accounts/{accountId}/webhooks")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://myserver.com/send/callback/here\",\n \"eventTypes\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sakari.io/v1/accounts/{accountId}/webhooks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://myserver.com/send/callback/here\",\n \"eventTypes\": []\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"eventTypes": [],
"destination": "<string>",
"id": "<string>",
"type": "<string>"
}
}Authorizations
The access token received from the authorization server in the OAuth 2.0 flow.
Path Parameters
Account to apply operations to
Body
application/json
⌘I