Získání analytiky konverzací
curl --request POST \
--url https://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"waba_id": "1234567890",
"granularity": "DAILY",
"conversation_categories": [
"MARKETING"
]
}
'import requests
url = "https://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations"
payload = {
"waba_id": "1234567890",
"granularity": "DAILY",
"conversation_categories": ["MARKETING"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
waba_id: '1234567890',
granularity: 'DAILY',
conversation_categories: ['MARKETING']
})
};
fetch('https://rest-api.smsmngr.com/v1/whatsapp/analytics/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://rest-api.smsmngr.com/v1/whatsapp/analytics/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([
'waba_id' => '1234567890',
'granularity' => 'DAILY',
'conversation_categories' => [
'MARKETING'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations"
payload := strings.NewReader("{\n \"waba_id\": \"1234567890\",\n \"granularity\": \"DAILY\",\n \"conversation_categories\": [\n \"MARKETING\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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.post("https://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"waba_id\": \"1234567890\",\n \"granularity\": \"DAILY\",\n \"conversation_categories\": [\n \"MARKETING\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"waba_id\": \"1234567890\",\n \"granularity\": \"DAILY\",\n \"conversation_categories\": [\n \"MARKETING\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data_points": [
{
"start": 1719792000,
"end": 1719878400,
"conversation": 42,
"cost": 12.5,
"conversation_category": "MARKETING",
"conversation_type": "REGULAR",
"conversation_direction": "BUSINESS_INITIATED"
}
]
}{
"message": "Missing 'waba_id' in request data"
}Analytika
Získání analytiky konverzací
Vrací analytiku konverzací (počty a náklady) dané WABA. Časové značky jsou v sekundách Unix epochy; výchozí rozsah je posledních 30 dní.
POST
/
whatsapp
/
analytics
/
conversations
Získání analytiky konverzací
curl --request POST \
--url https://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"waba_id": "1234567890",
"granularity": "DAILY",
"conversation_categories": [
"MARKETING"
]
}
'import requests
url = "https://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations"
payload = {
"waba_id": "1234567890",
"granularity": "DAILY",
"conversation_categories": ["MARKETING"]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
waba_id: '1234567890',
granularity: 'DAILY',
conversation_categories: ['MARKETING']
})
};
fetch('https://rest-api.smsmngr.com/v1/whatsapp/analytics/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://rest-api.smsmngr.com/v1/whatsapp/analytics/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([
'waba_id' => '1234567890',
'granularity' => 'DAILY',
'conversation_categories' => [
'MARKETING'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <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://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations"
payload := strings.NewReader("{\n \"waba_id\": \"1234567890\",\n \"granularity\": \"DAILY\",\n \"conversation_categories\": [\n \"MARKETING\"\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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.post("https://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"waba_id\": \"1234567890\",\n \"granularity\": \"DAILY\",\n \"conversation_categories\": [\n \"MARKETING\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rest-api.smsmngr.com/v1/whatsapp/analytics/conversations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"waba_id\": \"1234567890\",\n \"granularity\": \"DAILY\",\n \"conversation_categories\": [\n \"MARKETING\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data_points": [
{
"start": 1719792000,
"end": 1719878400,
"conversation": 42,
"cost": 12.5,
"conversation_category": "MARKETING",
"conversation_type": "REGULAR",
"conversation_direction": "BUSINESS_INITIATED"
}
]
}{
"message": "Missing 'waba_id' in request data"
}Authorizations
Body
application/json
Registrační token (alternativní autentizace).
Začátek rozsahu (Unix sekundy). Výchozí je před 30 dny.
Konec rozsahu (Unix sekundy). Výchozí je nyní.
Available options:
HALF_HOUR, DAILY, MONTHLY Metriky, které se mají vrátit.
Filtrování podle kategorie: MARKETING, UTILITY, AUTHENTICATION, SERVICE.
Filtrování podle typu: FREE_ENTRY, FREE_TIER, REGULAR.
Filtrování podle směru: BUSINESS_INITIATED, USER_INITIATED.
Was this page helpful?
⌘I