curl --request POST \
--url https://example.com/callback \
--header 'Content-Type: application/json' \
--data '
{
"from": "255701000001",
"to": "255701000000",
"channel": "whatsapp",
"user_name": "James",
"transaction_id": "12345",
"message_type": "text",
"text": "Yes, I would like more info"
}
'import requests
url = "https://example.com/callback"
payload = {
"from": "255701000001",
"to": "255701000000",
"channel": "whatsapp",
"user_name": "James",
"transaction_id": "12345",
"message_type": "text",
"text": "Yes, I would like more info"
}
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({
from: '255701000001',
to: '255701000000',
channel: 'whatsapp',
user_name: 'James',
transaction_id: '12345',
message_type: 'text',
text: 'Yes, I would like more info'
})
};
fetch('https://example.com/callback', 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://example.com/callback",
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([
'from' => '255701000001',
'to' => '255701000000',
'channel' => 'whatsapp',
'user_name' => 'James',
'transaction_id' => '12345',
'message_type' => 'text',
'text' => 'Yes, I would like more info'
]),
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://example.com/callback"
payload := strings.NewReader("{\n \"from\": \"255701000001\",\n \"to\": \"255701000000\",\n \"channel\": \"whatsapp\",\n \"user_name\": \"James\",\n \"transaction_id\": \"12345\",\n \"message_type\": \"text\",\n \"text\": \"Yes, I would like more info\"\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://example.com/callback")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"255701000001\",\n \"to\": \"255701000000\",\n \"channel\": \"whatsapp\",\n \"user_name\": \"James\",\n \"transaction_id\": \"12345\",\n \"message_type\": \"text\",\n \"text\": \"Yes, I would like more info\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://example.com/callback")
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 \"from\": \"255701000001\",\n \"to\": \"255701000000\",\n \"channel\": \"whatsapp\",\n \"user_name\": \"James\",\n \"transaction_id\": \"12345\",\n \"message_type\": \"text\",\n \"text\": \"Yes, I would like more info\"\n}"
response = http.request(request)
puts response.read_bodyReceive a message
Webhook your application must implement. Beem POSTs inbound user messages to the callback_url supplied in the send session message request. Replace the server URL with your own HTTPS endpoint.
curl --request POST \
--url https://example.com/callback \
--header 'Content-Type: application/json' \
--data '
{
"from": "255701000001",
"to": "255701000000",
"channel": "whatsapp",
"user_name": "James",
"transaction_id": "12345",
"message_type": "text",
"text": "Yes, I would like more info"
}
'import requests
url = "https://example.com/callback"
payload = {
"from": "255701000001",
"to": "255701000000",
"channel": "whatsapp",
"user_name": "James",
"transaction_id": "12345",
"message_type": "text",
"text": "Yes, I would like more info"
}
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({
from: '255701000001',
to: '255701000000',
channel: 'whatsapp',
user_name: 'James',
transaction_id: '12345',
message_type: 'text',
text: 'Yes, I would like more info'
})
};
fetch('https://example.com/callback', 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://example.com/callback",
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([
'from' => '255701000001',
'to' => '255701000000',
'channel' => 'whatsapp',
'user_name' => 'James',
'transaction_id' => '12345',
'message_type' => 'text',
'text' => 'Yes, I would like more info'
]),
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://example.com/callback"
payload := strings.NewReader("{\n \"from\": \"255701000001\",\n \"to\": \"255701000000\",\n \"channel\": \"whatsapp\",\n \"user_name\": \"James\",\n \"transaction_id\": \"12345\",\n \"message_type\": \"text\",\n \"text\": \"Yes, I would like more info\"\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://example.com/callback")
.header("Content-Type", "application/json")
.body("{\n \"from\": \"255701000001\",\n \"to\": \"255701000000\",\n \"channel\": \"whatsapp\",\n \"user_name\": \"James\",\n \"transaction_id\": \"12345\",\n \"message_type\": \"text\",\n \"text\": \"Yes, I would like more info\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://example.com/callback")
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 \"from\": \"255701000001\",\n \"to\": \"255701000000\",\n \"channel\": \"whatsapp\",\n \"user_name\": \"James\",\n \"transaction_id\": \"12345\",\n \"message_type\": \"text\",\n \"text\": \"Yes, I would like more info\"\n}"
response = http.request(request)
puts response.read_bodyBody
Sender address (the user who replied).
Your MOJA channel number that received the message.
Channel type: whatsapp, facebook, sms, or instagram.
Client reference ID if provided when sending the original message.
Type of inbound message received.
text, image, location, document, video, audio, contact, quick_reply, list Display name of the user who sent the message.
Text body when message_type is text.
Image payload when message_type is image.
Video payload when message_type is video.
Document payload when message_type is document.
Location coordinates when message_type is location.
Audio payload when message_type is audio.
Shared contact cards when message_type is contact.
Response
Successful response
