curl --request POST \
--url https://tudominio.com/webhooks/on-optout \
--header 'Content-Type: application/json' \
--data '
{
"country_code": "+57",
"cellphone": "3176477608",
"session_id": "85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8",
"conversation_id": 54263,
"question": {
"type": "closed",
"text": "Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. ",
"answers": [
{
"text": "Sure"
},
{
"text": "No, thanks"
},
{
"text": "DEFAULT"
}
]
},
"sent_at": "2021-10-22 00:15:39.044704",
"sent_text": "Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \n1) Sure\n2) No, thanks\n3) DEFAULT",
"user_session_keys": [],
"classified_answer": {
"text": "No, thanks"
},
"reason": "OPTOUT"
}
'import requests
url = "https://tudominio.com/webhooks/on-optout"
payload = {
"country_code": "+57",
"cellphone": "3176477608",
"session_id": "85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8",
"conversation_id": 54263,
"question": {
"type": "closed",
"text": "Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. ",
"answers": [{ "text": "Sure" }, { "text": "No, thanks" }, { "text": "DEFAULT" }]
},
"sent_at": "2021-10-22 00:15:39.044704",
"sent_text": "Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that.
1) Sure
2) No, thanks
3) DEFAULT",
"user_session_keys": [],
"classified_answer": { "text": "No, thanks" },
"reason": "OPTOUT"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
country_code: '+57',
cellphone: '3176477608',
session_id: '85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8',
conversation_id: 54263,
question: {
type: 'closed',
text: 'Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. ',
answers: [{text: 'Sure'}, {text: 'No, thanks'}, {text: 'DEFAULT'}]
},
sent_at: '2021-10-22 00:15:39.044704',
sent_text: 'Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \n1) Sure\n2) No, thanks\n3) DEFAULT',
user_session_keys: [],
classified_answer: {text: 'No, thanks'},
reason: 'OPTOUT'
})
};
fetch('https://tudominio.com/webhooks/on-optout', 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://tudominio.com/webhooks/on-optout",
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([
'country_code' => '+57',
'cellphone' => '3176477608',
'session_id' => '85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8',
'conversation_id' => 54263,
'question' => [
'type' => 'closed',
'text' => 'Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. ',
'answers' => [
[
'text' => 'Sure'
],
[
'text' => 'No, thanks'
],
[
'text' => 'DEFAULT'
]
]
],
'sent_at' => '2021-10-22 00:15:39.044704',
'sent_text' => 'Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that.
1) Sure
2) No, thanks
3) DEFAULT',
'user_session_keys' => [
],
'classified_answer' => [
'text' => 'No, thanks'
],
'reason' => 'OPTOUT'
]),
CURLOPT_HTTPHEADER => [
"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://tudominio.com/webhooks/on-optout"
payload := strings.NewReader("{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8\",\n \"conversation_id\": 54263,\n \"question\": {\n \"type\": \"closed\",\n \"text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \",\n \"answers\": [\n {\n \"text\": \"Sure\"\n },\n {\n \"text\": \"No, thanks\"\n },\n {\n \"text\": \"DEFAULT\"\n }\n ]\n },\n \"sent_at\": \"2021-10-22 00:15:39.044704\",\n \"sent_text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \\n1) Sure\\n2) No, thanks\\n3) DEFAULT\",\n \"user_session_keys\": [],\n \"classified_answer\": {\n \"text\": \"No, thanks\"\n },\n \"reason\": \"OPTOUT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://tudominio.com/webhooks/on-optout")
.header("Content-Type", "application/json")
.body("{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8\",\n \"conversation_id\": 54263,\n \"question\": {\n \"type\": \"closed\",\n \"text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \",\n \"answers\": [\n {\n \"text\": \"Sure\"\n },\n {\n \"text\": \"No, thanks\"\n },\n {\n \"text\": \"DEFAULT\"\n }\n ]\n },\n \"sent_at\": \"2021-10-22 00:15:39.044704\",\n \"sent_text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \\n1) Sure\\n2) No, thanks\\n3) DEFAULT\",\n \"user_session_keys\": [],\n \"classified_answer\": {\n \"text\": \"No, thanks\"\n },\n \"reason\": \"OPTOUT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tudominio.com/webhooks/on-optout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8\",\n \"conversation_id\": 54263,\n \"question\": {\n \"type\": \"closed\",\n \"text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \",\n \"answers\": [\n {\n \"text\": \"Sure\"\n },\n {\n \"text\": \"No, thanks\"\n },\n {\n \"text\": \"DEFAULT\"\n }\n ]\n },\n \"sent_at\": \"2021-10-22 00:15:39.044704\",\n \"sent_text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \\n1) Sure\\n2) No, thanks\\n3) DEFAULT\",\n \"user_session_keys\": [],\n \"classified_answer\": {\n \"text\": \"No, thanks\"\n },\n \"reason\": \"OPTOUT\"\n}"
response = http.request(request)
puts response.read_body{}Cuerpo de la solicitud Webhook de opt-out
Este endpoint debe ser implementado en TU servidor (por ejemplo: https://tudominio.com/webhooks/on-optout). Treble llamará a este webhook cuando un usuario decida darse de baja o salir de la conversación. Debes configurar la URL de este webhook en el panel de administración de Treble.
curl --request POST \
--url https://tudominio.com/webhooks/on-optout \
--header 'Content-Type: application/json' \
--data '
{
"country_code": "+57",
"cellphone": "3176477608",
"session_id": "85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8",
"conversation_id": 54263,
"question": {
"type": "closed",
"text": "Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. ",
"answers": [
{
"text": "Sure"
},
{
"text": "No, thanks"
},
{
"text": "DEFAULT"
}
]
},
"sent_at": "2021-10-22 00:15:39.044704",
"sent_text": "Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \n1) Sure\n2) No, thanks\n3) DEFAULT",
"user_session_keys": [],
"classified_answer": {
"text": "No, thanks"
},
"reason": "OPTOUT"
}
'import requests
url = "https://tudominio.com/webhooks/on-optout"
payload = {
"country_code": "+57",
"cellphone": "3176477608",
"session_id": "85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8",
"conversation_id": 54263,
"question": {
"type": "closed",
"text": "Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. ",
"answers": [{ "text": "Sure" }, { "text": "No, thanks" }, { "text": "DEFAULT" }]
},
"sent_at": "2021-10-22 00:15:39.044704",
"sent_text": "Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that.
1) Sure
2) No, thanks
3) DEFAULT",
"user_session_keys": [],
"classified_answer": { "text": "No, thanks" },
"reason": "OPTOUT"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
country_code: '+57',
cellphone: '3176477608',
session_id: '85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8',
conversation_id: 54263,
question: {
type: 'closed',
text: 'Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. ',
answers: [{text: 'Sure'}, {text: 'No, thanks'}, {text: 'DEFAULT'}]
},
sent_at: '2021-10-22 00:15:39.044704',
sent_text: 'Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \n1) Sure\n2) No, thanks\n3) DEFAULT',
user_session_keys: [],
classified_answer: {text: 'No, thanks'},
reason: 'OPTOUT'
})
};
fetch('https://tudominio.com/webhooks/on-optout', 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://tudominio.com/webhooks/on-optout",
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([
'country_code' => '+57',
'cellphone' => '3176477608',
'session_id' => '85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8',
'conversation_id' => 54263,
'question' => [
'type' => 'closed',
'text' => 'Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. ',
'answers' => [
[
'text' => 'Sure'
],
[
'text' => 'No, thanks'
],
[
'text' => 'DEFAULT'
]
]
],
'sent_at' => '2021-10-22 00:15:39.044704',
'sent_text' => 'Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that.
1) Sure
2) No, thanks
3) DEFAULT',
'user_session_keys' => [
],
'classified_answer' => [
'text' => 'No, thanks'
],
'reason' => 'OPTOUT'
]),
CURLOPT_HTTPHEADER => [
"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://tudominio.com/webhooks/on-optout"
payload := strings.NewReader("{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8\",\n \"conversation_id\": 54263,\n \"question\": {\n \"type\": \"closed\",\n \"text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \",\n \"answers\": [\n {\n \"text\": \"Sure\"\n },\n {\n \"text\": \"No, thanks\"\n },\n {\n \"text\": \"DEFAULT\"\n }\n ]\n },\n \"sent_at\": \"2021-10-22 00:15:39.044704\",\n \"sent_text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \\n1) Sure\\n2) No, thanks\\n3) DEFAULT\",\n \"user_session_keys\": [],\n \"classified_answer\": {\n \"text\": \"No, thanks\"\n },\n \"reason\": \"OPTOUT\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://tudominio.com/webhooks/on-optout")
.header("Content-Type", "application/json")
.body("{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8\",\n \"conversation_id\": 54263,\n \"question\": {\n \"type\": \"closed\",\n \"text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \",\n \"answers\": [\n {\n \"text\": \"Sure\"\n },\n {\n \"text\": \"No, thanks\"\n },\n {\n \"text\": \"DEFAULT\"\n }\n ]\n },\n \"sent_at\": \"2021-10-22 00:15:39.044704\",\n \"sent_text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \\n1) Sure\\n2) No, thanks\\n3) DEFAULT\",\n \"user_session_keys\": [],\n \"classified_answer\": {\n \"text\": \"No, thanks\"\n },\n \"reason\": \"OPTOUT\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://tudominio.com/webhooks/on-optout")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"85b398ef5bcb20c355f3710c4509349784c907673c9118fb7a89c7a8\",\n \"conversation_id\": 54263,\n \"question\": {\n \"type\": \"closed\",\n \"text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \",\n \"answers\": [\n {\n \"text\": \"Sure\"\n },\n {\n \"text\": \"No, thanks\"\n },\n {\n \"text\": \"DEFAULT\"\n }\n ]\n },\n \"sent_at\": \"2021-10-22 00:15:39.044704\",\n \"sent_text\": \"Hi! Thanks for attending our webinar today. We would like to have a feedback about our session and we would be very grateful if you could help us with that. \\n1) Sure\\n2) No, thanks\\n3) DEFAULT\",\n \"user_session_keys\": [],\n \"classified_answer\": {\n \"text\": \"No, thanks\"\n },\n \"reason\": \"OPTOUT\"\n}"
response = http.request(request)
puts response.read_body{}Cuerpo
Información del evento de opt-out
Evento que se dispara cuando un usuario decide darse de baja o salir de la conversación
Código de país del usuario
Número de teléfono del usuario sin el código de país
ID de la sesión del usuario
ID de la conversación
Show child attributes
Show child attributes
Fecha y hora en que se envió la pregunta
Texto enviado al usuario
Respuesta clasificada basada en la respuesta del usuario
Show child attributes
Show child attributes
Razón de la salida del usuario, en este caso 'OPTOUT' para indicar que el usuario decidió darse de baja
OPTOUT Claves de sesión del usuario recopiladas durante la conversación o proporcionadas durante el despliegue
Show child attributes
Show child attributes
Respuesta
Respuesta para actualizar o agregar información a la sesión
Objeto JSON con la nueva información que será reemplazada o agregada a la sesión para uso futuro. El servicio debe responder en menos de 10 segundos.
¿Esta página le ayudó?