Create broadcast button
curl --request POST \
--url https://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"link": "<string>",
"offer_id": 123,
"actions": [
{}
],
"settings": {}
}
'import requests
url = "https://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons"
payload = {
"name": "<string>",
"link": "<string>",
"offer_id": 123,
"actions": [{}],
"settings": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', link: '<string>', offer_id: 123, actions: [{}], settings: {}})
};
fetch('https://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons', 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://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons",
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([
'name' => '<string>',
'link' => '<string>',
'offer_id' => 123,
'actions' => [
[
]
],
'settings' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"link\": \"<string>\",\n \"offer_id\": 123,\n \"actions\": [\n {}\n ],\n \"settings\": {}\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://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"link\": \"<string>\",\n \"offer_id\": 123,\n \"actions\": [\n {}\n ],\n \"settings\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons")
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 \"name\": \"<string>\",\n \"link\": \"<string>\",\n \"offer_id\": 123,\n \"actions\": [\n {}\n ],\n \"settings\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"name": "<string>",
"text": "<string>",
"status": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z",
"link_preview": true,
"settings": {
"attach_file": true,
"has_spoiler": true,
"attach_style": "<string>",
"autodelete": 123,
"protect_content": true
},
"filters": {},
"recipients_count": 123,
"sent_by_user_id": 123,
"subscribers_count": 123,
"clicks_count": 123,
"attachments": [
{
"id": 123,
"type": "<string>",
"name": "<string>"
}
],
"buttons": [
{
"id": 123,
"type": "<string>",
"name": "<string>",
"link": "<string>",
"offer_id": 123,
"actions": [
{}
],
"settings": {},
"sort": 123
}
],
"created_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}Кнопки
Створити кнопку розсилки
Додає кнопку до розсилки.
POST
/
api
/
v1
/
bot
/
{bot}
/
broadcasts
/
{broadcast}
/
buttons
Create broadcast button
curl --request POST \
--url https://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"link": "<string>",
"offer_id": 123,
"actions": [
{}
],
"settings": {}
}
'import requests
url = "https://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons"
payload = {
"name": "<string>",
"link": "<string>",
"offer_id": 123,
"actions": [{}],
"settings": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', link: '<string>', offer_id: 123, actions: [{}], settings: {}})
};
fetch('https://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons', 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://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons",
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([
'name' => '<string>',
'link' => '<string>',
'offer_id' => 123,
'actions' => [
[
]
],
'settings' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"link\": \"<string>\",\n \"offer_id\": 123,\n \"actions\": [\n {}\n ],\n \"settings\": {}\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://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"link\": \"<string>\",\n \"offer_id\": 123,\n \"actions\": [\n {}\n ],\n \"settings\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.zenedu.io/api/v1/bot/{bot}/broadcasts/{broadcast}/buttons")
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 \"name\": \"<string>\",\n \"link\": \"<string>\",\n \"offer_id\": 123,\n \"actions\": [\n {}\n ],\n \"settings\": {}\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": 123,
"name": "<string>",
"text": "<string>",
"status": "<string>",
"scheduled_at": "2023-11-07T05:31:56Z",
"link_preview": true,
"settings": {
"attach_file": true,
"has_spoiler": true,
"attach_style": "<string>",
"autodelete": 123,
"protect_content": true
},
"filters": {},
"recipients_count": 123,
"sent_by_user_id": 123,
"subscribers_count": 123,
"clicks_count": 123,
"attachments": [
{
"id": 123,
"type": "<string>",
"name": "<string>"
}
],
"buttons": [
{
"id": 123,
"type": "<string>",
"name": "<string>",
"link": "<string>",
"offer_id": 123,
"actions": [
{}
],
"settings": {},
"sort": 123
}
],
"created_at": "2023-11-07T05:31:56Z"
}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>",
"errors": {}
}Авторизації
API token from the Zenedu dashboard
Тіло
application/json
Відповідь
Button created
Show child attributes
Show child attributes