LetsBot منو
شروع کنید فارسی زبان

Meta Business Partner شرکت ثبت‌شده در بریتانیا

زبان

Messages · نقطهٔ پایانی API

POST /api/v1/list/message

Send list message

You can send list message select to phone number.

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}}
bodyBody of message
titleTilte of message
footerFooter of message
buttonTextRequired, 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
(بدنهٔ خالی)

هر وقت آماده بودید، ما آماده‌ایم

این نقطهٔ پایانی را روی شمارهٔ خودتان امتحان کنید

API در دورهٔ آزمایشی رایگان کار می‌کند. حساب بسازید، شمارهٔ واتس‌اپ خود را وصل کنید و کلیدتان را از API ← داده‌های احراز هویت کپی کنید.