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

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

زبان

Live Chat · نقطهٔ پایانی API

GET /api/v1/live_chat/contact

Get contact

Get a contact with its labels and assigned team members.

Get a contact with its labels and assigned team members. If the phone number is not a contact yet, it is created.

Required: phone.

Response: data = {id, phone, labels[], moderators[]}, plus whatsapp_bsuid, whatsapp_username and phone_available where WhatsApp usernames are on (see below).

WhatsApp usernames (only for workspaces with WhatsApp username support switched on; absent otherwise). phone keeps its meaning.

  • whatsapp_bsuid — Meta's ID for a customer who hides their number behind a WhatsApp username, e.g. EG.2288384708632117. Not a phone number; null when Meta sent none.
  • whatsapp_username — the customer's WhatsApp @username, without the @. Display only; null when none.
  • phone_available — false when the customer keeps their number private: do not SMS, call or store phone as a number.

Validation errors return HTTP 422 {"message": "error", "data": "<first error>"}.

پارامترهای پرس‌وجو

پارامترالزامینمونهتوضیح
phone بله {{phone}} Contact phone number

نمونه درخواست

curl -G "https://letsbot.net/api/v1/live_chat/contact" \
  -H "Authorization: Bearer YOUR_LB_API_KEY" \
  -H "Accept: application/json" \
  --data-urlencode "phone=9665xxxxxxxx"
const response = await fetch("https://letsbot.net/api/v1/live_chat/contact?phone=%7B%7Bphone%7D%7D", {
  method: "GET",
  headers: {
    "Authorization": "Bearer YOUR_LB_API_KEY",
    "Accept": "application/json",
  },
});

const data = await response.json();
console.log(data);
<?php

$ch = curl_init('https://letsbot.net/api/v1/live_chat/contact?phone=%7B%7Bphone%7D%7D');

curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'GET',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_LB_API_KEY',
        'Accept: application/json',
    ],
]);

$data = json_decode(curl_exec($ch), true);
curl_close($ch);

print_r($data);
import requests

response = requests.request(
    "GET",
    "https://letsbot.net/api/v1/live_chat/contact",
    headers={
        "Authorization": "Bearer YOUR_LB_API_KEY",
        "Accept": "application/json",
    },
    params={
        "phone": "9665xxxxxxxx",
    },
)

print(response.json())

پاسخ‌ها

Contact200
{
  "data": {
    "id": 42,
    "phone": "966500000000",
    "labels": [
      {
        "id": 5,
        "name": "VIP",
        "name_translations": {
          "en": "VIP"
        },
        "color": "#6D28D9",
        "status": null
      }
    ],
    "moderators": [
      {
        "id": 3,
        "name": "Sara Ahmed",
        "email": "sara@example.com",
        "phone": "966511111111",
        "is_ai_agent": false
      }
    ],
    "whatsapp_bsuid": null,
    "whatsapp_username": "ahmed_store",
    "phone_available": true
  }
}

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

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

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