Telegram bot webhook for OTC Desk callbacks (called by Telegram)
curl --request POST \
--url https://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook \
--header 'Content-Type: application/json' \
--header 'X-Telegram-Bot-Api-Secret-Token: <x-telegram-bot-api-secret-token>' \
--data '
{
"update_id": 123456789,
"callback_query": {
"id": "3486293628410185798",
"from": {
"id": 123456789,
"username": "traderuno"
},
"data": "v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8"
}
}
'import requests
url = "https://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook"
payload = {
"update_id": 123456789,
"callback_query": {
"id": "3486293628410185798",
"from": {
"id": 123456789,
"username": "traderuno"
},
"data": "v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8"
}
}
headers = {
"X-Telegram-Bot-Api-Secret-Token": "<x-telegram-bot-api-secret-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Telegram-Bot-Api-Secret-Token': '<x-telegram-bot-api-secret-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
update_id: 123456789,
callback_query: {
id: '3486293628410185798',
from: {id: 123456789, username: 'traderuno'},
data: 'v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8'
}
})
};
fetch('https://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook', 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://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook",
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([
'update_id' => 123456789,
'callback_query' => [
'id' => '3486293628410185798',
'from' => [
'id' => 123456789,
'username' => 'traderuno'
],
'data' => 'v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Telegram-Bot-Api-Secret-Token: <x-telegram-bot-api-secret-token>"
],
]);
$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://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook"
payload := strings.NewReader("{\n \"update_id\": 123456789,\n \"callback_query\": {\n \"id\": \"3486293628410185798\",\n \"from\": {\n \"id\": 123456789,\n \"username\": \"traderuno\"\n },\n \"data\": \"v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Telegram-Bot-Api-Secret-Token", "<x-telegram-bot-api-secret-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.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook")
.header("X-Telegram-Bot-Api-Secret-Token", "<x-telegram-bot-api-secret-token>")
.header("Content-Type", "application/json")
.body("{\n \"update_id\": 123456789,\n \"callback_query\": {\n \"id\": \"3486293628410185798\",\n \"from\": {\n \"id\": 123456789,\n \"username\": \"traderuno\"\n },\n \"data\": \"v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Telegram-Bot-Api-Secret-Token"] = '<x-telegram-bot-api-secret-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"update_id\": 123456789,\n \"callback_query\": {\n \"id\": \"3486293628410185798\",\n \"from\": {\n \"id\": 123456789,\n \"username\": \"traderuno\"\n },\n \"data\": \"v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8\"\n }\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"accepted": true,
"offer_id": "8f3k2m9d-1a2b-4c3d-8e4f-5a6b7c8d9e0f"
}{
"error": "invalid_payload",
"message": "malformed update"
}{
"error": "forbidden",
"message": "invalid webhook secret"
}{
"error": "not_found",
"message": "resource not found"
}{
"error": "store_unavailable",
"message": "try again"
}Telegram bot webhook for OTC Desk callbacks (called by Telegram)
Receives Telegram Bot API updates for the organization’s OTC DESK group (inline button callbacks on BOB inventory offers). Called by Telegram, not by integrators: authenticated with the X-Telegram-Bot-Api-Secret-Token header (fail-closed 403), button payloads carry an HMAC signature, and duplicate deliveries converge on the callback id. Business outcomes always answer 200 (Telegram must not retry); 503 means store unavailable and is safe to retry.
POST
/
v1
/
public
/
telegram
/
otc-desk
/
{orgID}
/
webhook
Telegram bot webhook for OTC Desk callbacks (called by Telegram)
curl --request POST \
--url https://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook \
--header 'Content-Type: application/json' \
--header 'X-Telegram-Bot-Api-Secret-Token: <x-telegram-bot-api-secret-token>' \
--data '
{
"update_id": 123456789,
"callback_query": {
"id": "3486293628410185798",
"from": {
"id": 123456789,
"username": "traderuno"
},
"data": "v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8"
}
}
'import requests
url = "https://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook"
payload = {
"update_id": 123456789,
"callback_query": {
"id": "3486293628410185798",
"from": {
"id": 123456789,
"username": "traderuno"
},
"data": "v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8"
}
}
headers = {
"X-Telegram-Bot-Api-Secret-Token": "<x-telegram-bot-api-secret-token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Telegram-Bot-Api-Secret-Token': '<x-telegram-bot-api-secret-token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
update_id: 123456789,
callback_query: {
id: '3486293628410185798',
from: {id: 123456789, username: 'traderuno'},
data: 'v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8'
}
})
};
fetch('https://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook', 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://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook",
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([
'update_id' => 123456789,
'callback_query' => [
'id' => '3486293628410185798',
'from' => [
'id' => 123456789,
'username' => 'traderuno'
],
'data' => 'v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8'
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Telegram-Bot-Api-Secret-Token: <x-telegram-bot-api-secret-token>"
],
]);
$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://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook"
payload := strings.NewReader("{\n \"update_id\": 123456789,\n \"callback_query\": {\n \"id\": \"3486293628410185798\",\n \"from\": {\n \"id\": 123456789,\n \"username\": \"traderuno\"\n },\n \"data\": \"v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Telegram-Bot-Api-Secret-Token", "<x-telegram-bot-api-secret-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.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook")
.header("X-Telegram-Bot-Api-Secret-Token", "<x-telegram-bot-api-secret-token>")
.header("Content-Type", "application/json")
.body("{\n \"update_id\": 123456789,\n \"callback_query\": {\n \"id\": \"3486293628410185798\",\n \"from\": {\n \"id\": 123456789,\n \"username\": \"traderuno\"\n },\n \"data\": \"v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.qbank.cl/platform/v1/public/telegram/otc-desk/{orgID}/webhook")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Telegram-Bot-Api-Secret-Token"] = '<x-telegram-bot-api-secret-token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"update_id\": 123456789,\n \"callback_query\": {\n \"id\": \"3486293628410185798\",\n \"from\": {\n \"id\": 123456789,\n \"username\": \"traderuno\"\n },\n \"data\": \"v1.AbC123XyZ456.a.1758600000.9f2c4a1b7d30e5c8\"\n }\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"accepted": true,
"offer_id": "8f3k2m9d-1a2b-4c3d-8e4f-5a6b7c8d9e0f"
}{
"error": "invalid_payload",
"message": "malformed update"
}{
"error": "forbidden",
"message": "invalid webhook secret"
}{
"error": "not_found",
"message": "resource not found"
}{
"error": "store_unavailable",
"message": "try again"
}Headers
Webhook secret configured for the organization.
Path Parameters
Organization that owns the OTC Desk bot and group.
Body
application/json
The body is of type object.
Response
Update received (accepted, passed, duplicate or ignored).