Webhook del bot de Telegram para callbacks OTC Desk (lo llama 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"
}Webhook del bot de Telegram para callbacks OTC Desk (lo llama Telegram)
Recibe updates de Telegram Bot API para el grupo OTC DESK de la organización (callbacks de botones inline sobre ofertas de inventario BOB). Lo llama Telegram, no los integradores: se autentica con el header X-Telegram-Bot-Api-Secret-Token (403 fail-closed), los botones llevan firma HMAC y los reintentos convergen por callback id. Los resultados de negocio siempre responden 200 (Telegram no debe reintentar); 503 significa store no disponible y es seguro reintentar.
POST
/
v1
/
public
/
telegram
/
otc-desk
/
{orgID}
/
webhook
Webhook del bot de Telegram para callbacks OTC Desk (lo llama 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"
}Encabezados
Secreto del webhook configurado para la organización.
Parámetros de ruta
Organización dueña del bot y grupo OTC Desk.
Cuerpo
application/json
The body is of type object.
Respuesta
Update recibido (accepted, passed, duplicate o ignored).