curl --request POST \
--url https://yourdomain.com/webhooks/on-delivered \
--header 'Content-Type: application/json' \
--data '
{
"country_code": "+57",
"cellphone": "3176477608",
"session_id": "d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a",
"conversation_id": 34820,
"question": {
"type": "open",
"text": "Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?"
},
"sent_at": "2021-06-22 15:19:06.473256",
"sent_text": "Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?",
"user_session_keys": [],
"delivered_at": "2021-06-22 15:19:08"
}
'import requests
url = "https://yourdomain.com/webhooks/on-delivered"
payload = {
"country_code": "+57",
"cellphone": "3176477608",
"session_id": "d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a",
"conversation_id": 34820,
"question": {
"type": "open",
"text": "Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?"
},
"sent_at": "2021-06-22 15:19:06.473256",
"sent_text": "Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?",
"user_session_keys": [],
"delivered_at": "2021-06-22 15:19:08"
}
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: 'd2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a',
conversation_id: 34820,
question: {
type: 'open',
text: 'Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?'
},
sent_at: '2021-06-22 15:19:06.473256',
sent_text: 'Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?',
user_session_keys: [],
delivered_at: '2021-06-22 15:19:08'
})
};
fetch('https://yourdomain.com/webhooks/on-delivered', 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://yourdomain.com/webhooks/on-delivered",
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' => 'd2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a',
'conversation_id' => 34820,
'question' => [
'type' => 'open',
'text' => 'Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?'
],
'sent_at' => '2021-06-22 15:19:06.473256',
'sent_text' => 'Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?',
'user_session_keys' => [
],
'delivered_at' => '2021-06-22 15:19:08'
]),
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://yourdomain.com/webhooks/on-delivered"
payload := strings.NewReader("{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a\",\n \"conversation_id\": 34820,\n \"question\": {\n \"type\": \"open\",\n \"text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\"\n },\n \"sent_at\": \"2021-06-22 15:19:06.473256\",\n \"sent_text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\",\n \"user_session_keys\": [],\n \"delivered_at\": \"2021-06-22 15:19:08\"\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://yourdomain.com/webhooks/on-delivered")
.header("Content-Type", "application/json")
.body("{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a\",\n \"conversation_id\": 34820,\n \"question\": {\n \"type\": \"open\",\n \"text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\"\n },\n \"sent_at\": \"2021-06-22 15:19:06.473256\",\n \"sent_text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\",\n \"user_session_keys\": [],\n \"delivered_at\": \"2021-06-22 15:19:08\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://yourdomain.com/webhooks/on-delivered")
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\": \"d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a\",\n \"conversation_id\": 34820,\n \"question\": {\n \"type\": \"open\",\n \"text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\"\n },\n \"sent_at\": \"2021-06-22 15:19:06.473256\",\n \"sent_text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\",\n \"user_session_keys\": [],\n \"delivered_at\": \"2021-06-22 15:19:08\"\n}"
response = http.request(request)
puts response.read_body{}Message Delivery Webhook Request Body
This endpoint must be implemented on YOUR server (e.g., https://yourdomain.com/webhooks/on-delivered). Treble will call this webhook when a message is delivered to the user. You must configure the URL of this webhook in the Treble admin panel.
curl --request POST \
--url https://yourdomain.com/webhooks/on-delivered \
--header 'Content-Type: application/json' \
--data '
{
"country_code": "+57",
"cellphone": "3176477608",
"session_id": "d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a",
"conversation_id": 34820,
"question": {
"type": "open",
"text": "Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?"
},
"sent_at": "2021-06-22 15:19:06.473256",
"sent_text": "Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?",
"user_session_keys": [],
"delivered_at": "2021-06-22 15:19:08"
}
'import requests
url = "https://yourdomain.com/webhooks/on-delivered"
payload = {
"country_code": "+57",
"cellphone": "3176477608",
"session_id": "d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a",
"conversation_id": 34820,
"question": {
"type": "open",
"text": "Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?"
},
"sent_at": "2021-06-22 15:19:06.473256",
"sent_text": "Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?",
"user_session_keys": [],
"delivered_at": "2021-06-22 15:19:08"
}
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: 'd2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a',
conversation_id: 34820,
question: {
type: 'open',
text: 'Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?'
},
sent_at: '2021-06-22 15:19:06.473256',
sent_text: 'Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?',
user_session_keys: [],
delivered_at: '2021-06-22 15:19:08'
})
};
fetch('https://yourdomain.com/webhooks/on-delivered', 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://yourdomain.com/webhooks/on-delivered",
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' => 'd2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a',
'conversation_id' => 34820,
'question' => [
'type' => 'open',
'text' => 'Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?'
],
'sent_at' => '2021-06-22 15:19:06.473256',
'sent_text' => 'Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?',
'user_session_keys' => [
],
'delivered_at' => '2021-06-22 15:19:08'
]),
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://yourdomain.com/webhooks/on-delivered"
payload := strings.NewReader("{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a\",\n \"conversation_id\": 34820,\n \"question\": {\n \"type\": \"open\",\n \"text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\"\n },\n \"sent_at\": \"2021-06-22 15:19:06.473256\",\n \"sent_text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\",\n \"user_session_keys\": [],\n \"delivered_at\": \"2021-06-22 15:19:08\"\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://yourdomain.com/webhooks/on-delivered")
.header("Content-Type", "application/json")
.body("{\n \"country_code\": \"+57\",\n \"cellphone\": \"3176477608\",\n \"session_id\": \"d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a\",\n \"conversation_id\": 34820,\n \"question\": {\n \"type\": \"open\",\n \"text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\"\n },\n \"sent_at\": \"2021-06-22 15:19:06.473256\",\n \"sent_text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\",\n \"user_session_keys\": [],\n \"delivered_at\": \"2021-06-22 15:19:08\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://yourdomain.com/webhooks/on-delivered")
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\": \"d2fa98d29a2670dfa119335df1b0371720d674f1677302aba228876a\",\n \"conversation_id\": 34820,\n \"question\": {\n \"type\": \"open\",\n \"text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\"\n },\n \"sent_at\": \"2021-06-22 15:19:06.473256\",\n \"sent_text\": \"Hello! Good morning. I hope everything is well. Would you like to continue our conversation to resolve all your problems and concerns?\",\n \"user_session_keys\": [],\n \"delivered_at\": \"2021-06-22 15:19:08\"\n}"
response = http.request(request)
puts response.read_body{}Body
Information of the delivery event
Event that is triggered when a message is delivered to the user
Country code of the user
User's phone number without the country code
ID of the user's session
ID of the conversation
Show child attributes
Show child attributes
Date and time when the message was sent
Text of the sent message
Date and time when the message was delivered to the user
User session keys collected during the conversation or provided during the deployment
Show child attributes
Show child attributes
Response
Response to update or add information to the session
JSON object with the new information that will be replaced or added to the session for future use. The service must respond in less than 10 seconds.
Was this page helpful?