Help Center bat/messagelist မှတစ်ဆင့် WhatsApp

bat/messagelist မှတစ်ဆင့် WhatsApp

WhatsApp Business မက်ဆေ့ချ်များကို SMS နှင့် Viber ကဲ့သို့ တူညီသော တောင်းဆိုမှုဖြင့် ပို့သည်- "type": "whatsapp" ပါသော POST /bat/messagelist။ မက်ဆေ့ချ်အကြောင်းအရာကို whatsAppMessage အရာဝတ္ထုထဲတွင် ထည့်သည်။

ဤစာမျက်နှာရှိ ဥပမာတိုင်းအတွက် အဆင်သင့် တောင်းဆိုမှုများသည် Postman collection တွင် ရှိသည်၊ အောက်ပါ “Postman collection” ကဏ္ဍကို ကြည့်ပါ။

မက်ဆေ့ချ်အမျိုးအစား နှစ်မျိုး

အမျိုးအစားwhatsAppMessage.typeပို့နိုင်သည့်အချိန်
စက်ရှင်မက်ဆေ့ချ်များ- စာသား၊ မီဒီယာ၊ တည်နေရာ၊ အဆက်အသွယ်၊ အပြန်အလှန်တုံ့ပြန်နိုင်သောtext, media, location, contact, interactiveဖောက်သည်၏ နောက်ဆုံးဝင်လာသော မက်ဆေ့ချ်ပြီးနောက် ၂၄ နာရီ စက်ရှင်ကာလ အတွင်းသာ။
ပုံစံ (Template)templateအချိန်မရွေး။ ပုံစံကို သင့် WhatsApp Business Account (WABA) တွင် အတည်ပြုထားရမည်။

စက်ရှင်ကာလ မရှိလျှင် အတည်ပြုပြီးသော ပုံစံကို ပို့ပါ။ WhatsApp သည် fallback ချိန်ခွင်၏ အဆင့်တစ်ခု ဖြစ်သည့်အခါတွင်လည်း ဤစည်းမျဉ်း အသက်ဝင်သည်။

ဘုံအကွက်များ

{
  "callbackUrl": "https://example.com/smsbat/status",
  "messages": [
    {
      "from": "WABA_PHONE",
      "to": "RECIPIENT_PHONE",
      "type": "whatsapp",
      "ttl": 60,
      "whatsAppMessage": { "type": "text", "text": "Your order is ready." }
    }
  ]
}
အကွက်ဖော်ပြချက်
callbackUrlပို့ဆောင်မှု callback များ အတွက် လိပ်စာ။ မဖြစ်မနေ မလိုပါ။
fromမက်ဆေ့ချ် ပို့သည့် WhatsApp Business နံပါတ်။
toလက်ခံသူ နံပါတ်။
typewhatsapp.
ttlမက်ဆေ့ချ်၏ တည်မြဲချိန် (စက္ကန့်)။ ဥပမာများတွင် 60 ကို သုံးထားသည်၊ သင့်အခြေအနေနှင့် ကိုက်ညီအောင် သတ်မှတ်ပါ။
whatsAppMessageမက်ဆေ့ချ်အကြောင်းအရာ၊ အောက်ပါကဏ္ဍများကို ကြည့်ပါ။

အထောက်အထားစိစစ်ခြင်း- SMSBAT API တောင်းဆိုမှုအားလုံးကဲ့သို့ပင် အဖွဲ့အစည်းကီးပါသော X-Authorization-Key ခေါင်းစီး။

စက်ရှင်မက်ဆေ့ချ်များ

ဤကဏ္ဍရှိ ဥပမာတိုင်းသည် ၂၄ နာရီ စက်ရှင်ကာလ လိုအပ်သည်။

စာသား

"whatsAppMessage": {
  "type": "text",
  "text": "Your order is ready."
}

ဖော်ပြချက်ပါသော ပုံ

"whatsAppMessage": {
  "type": "media",
  "media": {
    "type": "image",
    "url": "https://example.com/image.png",
    "caption": "Your order is ready."
  }
}

media.url သည် ပုံ၏ အများသုံး HTTPS လိပ်စာ ဖြစ်သည်။ caption မဖြစ်မနေ မလိုပါ။

ဖော်ပြချက်ပါသော ဗီဒီယို

"whatsAppMessage": {
  "type": "media",
  "media": {
    "type": "video",
    "url": "https://example.com/video.mp4",
    "caption": "Your order is ready."
  }
}

အသံ

"whatsAppMessage": {
  "type": "media",
  "media": {
    "type": "audio",
    "url": "https://example.com/audio.mp3"
  }
}

စာရွက်စာတမ်း

"whatsAppMessage": {
  "type": "media",
  "media": {
    "type": "document",
    "url": "https://example.com/invoice.pdf",
    "filename": "invoice.pdf",
    "caption": "Your invoice"
  }
}

filename က လက်ခံသူ မြင်ရမည့် ဖိုင်အမည်ကို သတ်မှတ်သည်။ caption မဖြစ်မနေ မလိုပါ။

media အကွက်များ-

အကွက်ဖော်ပြချက်
typeimage, video, audio သို့မဟုတ် document။
urlဖိုင်၏ အများသုံး HTTPS လိပ်စာ။
captionဖော်ပြချက်။ မဖြစ်မနေ မလိုပါ၊ ဥပမာများတွင် ပုံ၊ ဗီဒီယိုနှင့် စာရွက်စာတမ်းအတွက် သုံးထားသည်။
filenameစာရွက်စာတမ်း၏ ဖိုင်အမည်။

တည်နေရာ

"whatsAppMessage": {
  "type": "location",
  "location": {
    "latitude": 48.1486,
    "longitude": 17.1077,
    "name": "Pickup point",
    "address": "Bratislava"
  }
}

လိုအပ်လျှင် နေရာအမည်နှင့် လိပ်စာကို ထည့်ပါ။

အဆက်အသွယ်

"whatsAppMessage": {
  "type": "contact",
  "contact": {
    "name": {
      "formatted_name": "Support Team",
      "first_name": "Support"
    },
    "phones": [
      { "phone": "+421900000000", "type": "WORK" }
    ]
  }
}

ပြသမည့် အမည်အပြည့်အစုံ (formatted_name) အပြင် အမည်အကွက် အနည်းဆုံး တစ်ခုထပ်ဖြည့်ပါ၊ ဥပမာ first_name။

ပြန်ကြားခလုတ်များ

"whatsAppMessage": {
  "type": "interactive",
  "interactive": {
    "type": "button",
    "body": { "text": "Confirm your order" },
    "action": {
      "buttons": [
        { "type": "reply", "reply": { "id": "confirm", "title": "Confirm" } },
        { "type": "reply", "reply": { "id": "cancel", "title": "Cancel" } }
      ]
    }
  }
}

လက်ခံသူ မည်သည့်ခလုတ်ကို နှိပ်ကြောင်း သိရန် reply.id ကို သုံးပါ။ reply.title သည် ခလုတ်၏ အညွှန်းစာသား ဖြစ်သည်။

စာရင်း

"whatsAppMessage": {
  "type": "interactive",
  "interactive": {
    "type": "list",
    "body": { "text": "Choose a pickup point" },
    "action": {
      "button": "View options",
      "sections": [
        {
          "title": "Pickup points",
          "rows": [
            { "id": "center", "title": "City centre" },
            { "id": "station", "title": "Main station" }
          ]
        }
      ]
    }
  }
}

action.button သည် စာရင်းကို ဖွင့်ပေးသော ခလုတ်၏ အညွှန်းစာသား ဖြစ်သည်။ sections[].rows[] သည် ရွေးချယ်စရာများ ဖြစ်ပြီး တစ်ခုစီတွင် id နှင့် title ပါသည်။

ပုံစံများ (Templates)

ပုံစံများကို စက်ရှင်ကာလ မလိုဘဲ အချိန်မရွေး ပို့နိုင်သည်။ ပို့မည့် WABA တွင် ပုံစံကို အတည်ပြုထားရမည်။

ပုံစံကို ဖြည့်နည်း

အကွက်ဖော်ပြချက်
template.idအတည်ပြုပြီးသော ပုံစံ၏ အမည်အတိအကျ။
template.languageထိုပုံစံ၏ ဘာသာစကားကုဒ်၊ ဥပမာ uk သို့မဟုတ် en_US။
template.body.parametersစာသားကိန်းရှင်များ၏ တန်ဖိုးများကို ပုံစံ၏ အစီအစဉ်အတိုင်း- [{ "text": "..." }]။ ကိန်းရှင်များ မရှိလျှင် body ကို ချန်ထားပါ။
template.headerပြောင်းလဲနိုင်သော ခေါင်းစီးပါသော ပုံစံအတွက်သာ။ ပုံသေခေါင်းစီးအတွက် မလိုပါ။
template.buttonsပြောင်းလဲနိုင်သော URL ခလုတ်နှင့် အမြန်ပြန်ကြားခလုတ်များအတွက်သာ။

ပုံသေခလုတ် URL နှင့် ခေါ်ဆိုမှုခလုတ်၏ ဖုန်းနံပါတ်ကို ပုံစံထဲတွင်ပင် သတ်မှတ်ထားပြီး ပို့သည့်အခါ ထည့်သွင်းရန် မလိုပါ။ ပါရာမီတာများနှင့် ခလုတ်များ၏ အရေအတွက်သည် သင့်အတည်ပြုပြီးသော ပုံစံနှင့် ကိုက်ညီရမည်။

စာသားပုံစံ

"whatsAppMessage": {
  "type": "template",
  "template": {
    "id": "YOUR_TEMPLATE_NAME",
    "language": "uk",
    "body": {
      "parameters": [ { "text": "Alex" } ]
    }
  }
}

ပြောင်းလဲနိုင်သော URL ခလုတ်

"whatsAppMessage": {
  "type": "template",
  "template": {
    "id": "YOUR_TEMPLATE_NAME",
    "language": "uk",
    "body": {
      "parameters": [
        { "text": "Oleh" },
        { "text": "1 January 2024" },
        { "text": "+1 555-745-2867" }
      ]
    },
    "buttons": [
      { "type": "url", "index": 0, "url_parameter": "ORDER-123" }
    ]
  }
}

index သည် ပုံစံထဲရှိ ခလုတ်၏ တည်နေရာ ဖြစ်ပြီး 0 မှ စသည်။ url_parameter တွင် လိပ်စာ၏ ပြောင်းလဲသောအပိုင်းကိုသာ ထည့်ပါ။ ဥပမာ ခလုတ် URL https://example.com/orders/{{1}} အတွက် တန်ဖိုး ORDER-123 က https://example.com/orders/ORDER-123 ကို ဖြစ်စေသည်။ ခလုတ် URL သည် ပုံသေ ဖြစ်လျှင် buttons ကို မထည့်ပါနှင့်။

အမြန်ပြန်ကြားခလုတ်များ

"buttons": [
  { "type": "quick_reply", "index": 0, "quick_reply_payload": "CONFIRM" },
  { "type": "quick_reply", "index": 1, "quick_reply_payload": "CANCEL" }
]

quick_reply_payload က လက်ခံသူ မည်သည့်ခလုတ်ကို နှိပ်ကြောင်း ခွဲခြားသိရှိရန် ကူညီသည်။ ခလုတ် index များသည် ပုံစံနှင့် ကိုက်ညီရမည်။

ခေါင်းစီး- စာသား

"header": { "type": "text", "text": "Order 123" }

ခေါင်းစီးကိန်းရှင်၏ တန်ဖိုးကို header.text တွင် ထည့်ပါ။

ခေါင်းစီး- ပုံ၊ ဗီဒီယို၊ စာရွက်စာတမ်း

"header": { "type": "image", "image": { "url": "https://example.com/image.png" } }
"header": { "type": "video", "video": { "url": "https://example.com/video.mp4" } }
"header": {
  "type": "document",
  "document": { "url": "https://example.com/file.pdf", "filename": "sample.pdf" }
}

URL သည် အများသုံး HTTPS လိပ်စာ ဖြစ်ရမည်။ စာရွက်စာတမ်းအတွက် filename က ပူးတွဲဖိုင်အမည်ကို သတ်မှတ်သည်။

ပို့ဆောင်မှု အခြေအနေများ

WhatsApp မက်ဆေ့ချ်အခြေအနေများသည် ပို့ဆောင်မှု callback ပုံစံဖြင့် callbackUrl သို့ ရောက်ရှိလာသည်- delivered, undeliverable သို့မဟုတ် permanenterror။

Postman collection

“OmniSMSBat · BAT /messagelist” collection ကို ဒေါင်းလုဒ်လုပ်ပါ- WhatsApp (စက်ရှင်မက်ဆေ့ချ်များနှင့် ပုံစံ ၇ မျိုး)၊ Viber Business၊ SMS နှင့် fallback များအတွက် အဆင်သင့် တောင်းဆိုမှုများ။

  1. ဖိုင်ကို Postman သို့ import လုပ်ပါ။
  2. collection ကိန်းရှင်များကို ဖြည့်ပါ- orgKey (အဖွဲ့အစည်းကီး)၊ toPhone (လက်ခံသူနံပါတ်)၊ wabaPhone (WhatsApp ပို့သူနံပါတ်)၊ alphaName (Viber Business နှင့် SMS အတွက် alpha name) နှင့် လိုအပ်လျှင် callbackUrl။
  3. ပုံစံတောင်းဆိုမှုများတွင် template.id ထဲရှိ PLACEHOLDER_... ကို သင့်အတည်ပြုပြီးသော ပုံစံအမည်ဖြင့် အစားထိုးပြီး template.language ကို စစ်ဆေးပါ။

တောင်းဆိုမှုများသည် production ဆာဗာ https://restapi.smsbat.com သို့ သွားပြီး ကျသင့်ငွေ ရှိနိုင်သည်။ သီးခြား စမ်းသပ်ပတ်ဝန်းကျင် မရှိပါ။

ဆက်စပ်အကြောင်းအရာ