WhatsApp Business API Automation

লেসন ২০ / ২৫

WhatsApp Business API সেটআপ

  1. Meta Business Suite → WhatsApp → Getting Started
  2. Phone Number যোগ করুন ও verify করুন
  3. Message Templates তৈরি ও approve করান
  4. Permanent Access Token নিন
  5. n8n → Credentials → HTTP → Bearer Token

Template Message পাঠানো

Node: HTTP Request
Method: POST
URL: https://graph.facebook.com/v18.0/{{ $credentials.phoneId }}/messages
Authorization: Bearer {{ $credentials.token }}

Body:
{
  "messaging_product": "whatsapp",
  "to": "880{{ $json.phone }}",
  "type": "template",
  "template": {
    "name": "order_confirmation",
    "language": { "code": "bn" },
    "components": [{
      "type": "body",
      "parameters": [
        { "type": "text", "text": "{{ $json.name }}" },
        { "type": "text", "text": "{{ $json.orderId }}" },
        { "type": "text", "text": "{{ $json.total }}" }
      ]
    }]
  }
}

Free-form Message (24-hour window)

Body:
{
  "messaging_product": "whatsapp",
  "to": "880{{ $json.phone }}",
  "type": "text",
  "text": {
    "body": "হ্যালো {{ $json.name }}! আপনার অর্ডার dispatch হয়েছে।\nট্র্যাকিং: {{ $json.trackingUrl }}"
  }
}

Lead → WhatsApp Instant Follow-up

[Facebook Lead Trigger]
         ↓
[HTTP Request — WhatsApp Template পাঠানো]
  Template: "lead_welcome" (approve করা)
  Variables: name, service
         ↓
[Wait — 5 minutes]
         ↓
[IF — Reply এসেছে কি? (Webhook check)]
  False ↓
[WhatsApp — Follow-up message]
  "আপনি কি এখন কথা বলতে পারবেন? 📞"