Získání analytiky šablon
curl --request POST \
--url https://rest-api.smsmngr.com/v1/whatsapp/analytics/templates \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"waba_id": "1234567890",
"template_ids": [
"9876543210"
],
"granularity": "DAILY"
}
'import requests
url = "https://rest-api.smsmngr.com/v1/whatsapp/analytics/templates"
payload = {
"waba_id": "1234567890",
"template_ids": ["9876543210"],
"granularity": "DAILY"
}
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', template_ids: ['9876543210'], granularity: 'DAILY'})
};
fetch('https://rest-api.smsmngr.com/v1/whatsapp/analytics/templates', 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/templates",
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',
'template_ids' => [
'9876543210'
],
'granularity' => 'DAILY'
]),
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/templates"
payload := strings.NewReader("{\n \"waba_id\": \"1234567890\",\n \"template_ids\": [\n \"9876543210\"\n ],\n \"granularity\": \"DAILY\"\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/templates")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"waba_id\": \"1234567890\",\n \"template_ids\": [\n \"9876543210\"\n ],\n \"granularity\": \"DAILY\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rest-api.smsmngr.com/v1/whatsapp/analytics/templates")
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 \"template_ids\": [\n \"9876543210\"\n ],\n \"granularity\": \"DAILY\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"template_id": "9876543210",
"granularity": "DAILY",
"data_points": [
{
"start": 1719792000,
"end": 1719878400,
"sent": 100,
"delivered": 98,
"read": 80,
"clicked": [
{
"type": "quick_reply_button",
"button_content": "Shop now",
"count": 12
}
]
}
]
}
],
"paging": {
"cursors": {
"before": "...",
"after": "..."
}
}
}{
"message": "Missing 'waba_id' in request data"
}Analytika
Získání analytiky šablon
Vrací analytiku jednotlivých šablon (odesláno, doručeno, přečteno, kliknuto). Nejprve je nutné povolit statistiky šablon přes /whatsapp/analytics/templates/enable. Časové značky jsou v sekundách Unix epochy; výchozí rozsah je posledních 30 dní.
POST
/
whatsapp
/
analytics
/
templates
Získání analytiky šablon
curl --request POST \
--url https://rest-api.smsmngr.com/v1/whatsapp/analytics/templates \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"waba_id": "1234567890",
"template_ids": [
"9876543210"
],
"granularity": "DAILY"
}
'import requests
url = "https://rest-api.smsmngr.com/v1/whatsapp/analytics/templates"
payload = {
"waba_id": "1234567890",
"template_ids": ["9876543210"],
"granularity": "DAILY"
}
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', template_ids: ['9876543210'], granularity: 'DAILY'})
};
fetch('https://rest-api.smsmngr.com/v1/whatsapp/analytics/templates', 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/templates",
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',
'template_ids' => [
'9876543210'
],
'granularity' => 'DAILY'
]),
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/templates"
payload := strings.NewReader("{\n \"waba_id\": \"1234567890\",\n \"template_ids\": [\n \"9876543210\"\n ],\n \"granularity\": \"DAILY\"\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/templates")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"waba_id\": \"1234567890\",\n \"template_ids\": [\n \"9876543210\"\n ],\n \"granularity\": \"DAILY\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://rest-api.smsmngr.com/v1/whatsapp/analytics/templates")
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 \"template_ids\": [\n \"9876543210\"\n ],\n \"granularity\": \"DAILY\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": [
{
"template_id": "9876543210",
"granularity": "DAILY",
"data_points": [
{
"start": 1719792000,
"end": 1719878400,
"sent": 100,
"delivered": 98,
"read": 80,
"clicked": [
{
"type": "quick_reply_button",
"button_content": "Shop now",
"count": 12
}
]
}
]
}
],
"paging": {
"cursors": {
"before": "...",
"after": "..."
}
}
}{
"message": "Missing 'waba_id' in request data"
}Authorizations
Body
application/json
Meta id šablon, pro které se má vytvořit report.
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í.
Was this page helpful?
⌘I