You can send list message select to phone number. You need to send the body, footer, title(optional), buttonText and sections(array) of the message. Every section array has two index which is title and rows , for every rows has title, rowid and description(optional).You can see the result of the sections in image below. Id of the message in the key of the data of the response. In the Message of the data of the response , You can see listMessage that contain list message info (title, description, buttonText, listType, sections, etc) , messageTimesamp format and status of the message. <img src='https://content.pstmn.io/cd6efe52-5a20-48e2-ae2d-e9b235b089f6/aW1hZ2UucG5n' alt='' height='484' width='436'>
فارم فیلڈز
| فیلڈ | مثال |
|---|---|
phone | {{phone}} |
body | Body of message |
title | Tilte of message |
footer | Footer of message |
buttonText | Required, text on the button to view the list |
sections[0][title] | Section 1 Text |
sections[0][rows][0][title] | Option 1 |
sections[0][rows][0][rowId] | Option1 |
sections[0][rows][0][description] | This is description |
sections[0][rows][1][title] | Option 2 |
sections[0][rows][1][rowId] | Option2 |
مثالی درخواست
curl -X POST "https://letsbot.net/api/v1/list/message" \
-H "Authorization: Bearer YOUR_LB_API_KEY" \
-H "Accept: application/json" \
-F "phone=9665xxxxxxxx" \
-F "body=Body of message" \
-F "title=Tilte of message" \
-F "footer=Footer of message" \
-F "buttonText=Required, text on the button to view the list" \
-F "sections[0][title]=Section 1 Text" \
-F "sections[0][rows][0][title]=Option 1" \
-F "sections[0][rows][0][rowId]=Option1" \
-F "sections[0][rows][0][description]=This is description" \
-F "sections[0][rows][1][title]=Option 2" \
-F "sections[0][rows][1][rowId]=Option2"
const response = await fetch("https://letsbot.net/api/v1/list/message", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_LB_API_KEY",
"Accept": "application/json",
},
body: new URLSearchParams({
"phone": "9665xxxxxxxx",
"body": "Body of message",
"title": "Tilte of message",
"footer": "Footer of message",
"buttonText": "Required, text on the button to view the list",
"sections[0][title]": "Section 1 Text",
"sections[0][rows][0][title]": "Option 1",
"sections[0][rows][0][rowId]": "Option1",
"sections[0][rows][0][description]": "This is description",
"sections[0][rows][1][title]": "Option 2",
"sections[0][rows][1][rowId]": "Option2",
}),
});
const data = await response.json();
console.log(data);
<?php
$ch = curl_init('https://letsbot.net/api/v1/list/message');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_LB_API_KEY',
'Accept: application/json',
],
CURLOPT_POSTFIELDS => http_build_query([
'phone' => '9665xxxxxxxx',
'body' => 'Body of message',
'title' => 'Tilte of message',
'footer' => 'Footer of message',
'buttonText' => 'Required, text on the button to view the list',
'sections[0][title]' => 'Section 1 Text',
'sections[0][rows][0][title]' => 'Option 1',
'sections[0][rows][0][rowId]' => 'Option1',
'sections[0][rows][0][description]' => 'This is description',
'sections[0][rows][1][title]' => 'Option 2',
'sections[0][rows][1][rowId]' => 'Option2',
]),
]);
$data = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($data);
import requests
response = requests.request(
"POST",
"https://letsbot.net/api/v1/list/message",
headers={
"Authorization": "Bearer YOUR_LB_API_KEY",
"Accept": "application/json",
},
data={
"phone": "9665xxxxxxxx",
"body": "Body of message",
"title": "Tilte of message",
"footer": "Footer of message",
"buttonText": "Required, text on the button to view the list",
"sections[0][title]": "Section 1 Text",
"sections[0][rows][0][title]": "Option 1",
"sections[0][rows][0][rowId]": "Option1",
"sections[0][rows][0][description]": "This is description",
"sections[0][rows][1][title]": "Option 2",
"sections[0][rows][1][rowId]": "Option2",
},
)
print(response.json())
جوابات
Success Response200
(خالی باڈی)
Failed Response202
(خالی باڈی)