netflie / whatsapp-cloud-api

The first PHP API to send and receive messages using a cloud-hosted version of the WhatsApp Business Platform
https://netflie.es/portfolio/whatsapp-business-cloud-api-php-sdk/
MIT License
428 stars 151 forks source link

adding flow message support #197

Open pravnyadv opened 2 weeks ago

pravnyadv commented 2 weeks ago

Added support for flow message

image

tested on payload below

{
    "object": "whatsapp_business_account",
    "entry": [{
        "id": "WHATSAPP_BUSINESS_ACCOUNT_ID",
        "changes": [{
            "value": {
                "messaging_product": "whatsapp",
                "metadata": {
                    "display_phone_number": "PHONE_NUMBER",
                    "phone_number_id": "PHONE_NUMBER_ID"
                },
                "contacts": [{
                    "profile": {
                        "name": "NAME"
                    },
                    "wa_id": "WHATSAPP_ID"
                }],
                "messages": [{
                    "context": {
                        "from": "PHONE_NUMBER",
                        "id": "wamid.ID"
                    },
                    "from": "16315551234",
                    "id": "wamid.ID",
                    "timestamp": 1669233778,
                    "type": "interactive",
                    "interactive": {
                        "type": "nfm_reply",
                        "nfm_reply": {
                            "response_json": "{\"screen_0_name_0\":\"EMAIL\",\"screen_0_orderNumber_1\":\"ORDER_NUMBER\",\"screen_0_topicRadio_2\":\"TOPIC\",\"screen_0_DatePicker_3\":\"DATE_PICKER_TIMESTAMP\",\"flow_token\":\"unused\"}",
                            "body": "BODY",
                            "name": "flow"
                        }
                    }
                }]
            },
            "field": "messages"
        }]
    }]
}