OTC Desk 回调的 Telegram 机器人 webhook(由 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"
}OTC Desk 回调的 Telegram 机器人 webhook(由 Telegram 调用)
接收组织 OTC DESK 群的 Telegram Bot API 更新(BOB 库存报价的内联按钮 回调)。由 Telegram 调用,而非集成方:以 X-Telegram-Bot-Api-Secret-Token 请求头认证(fail-closed 403),按钮载荷带 HMAC 签名,重复投递按 callback id 收敛。业务结果恒返回 200(Telegram 不得重试);503 表示 store 不可用,可安全重试。
POST
/
v1
/
public
/
telegram
/
otc-desk
/
{orgID}
/
webhook
OTC Desk 回调的 Telegram 机器人 webhook(由 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"
}