WhatsApp Endpoint: Message Types and Payload Examples – Cognigy.AI Help Center

WhatsApp Endpoint: Message Types and Payload Examples

On Cognigy.AI you are able to send messages to WhatsApp from the AI (default) channel, as well as from a WhatsApp channel for specific output that is highly customizable.

The WhatsApp channel supports “Text” and “Custom JSON” fields.

The “Custom JSON” field allows you to copy-paste JSON payloads.

Payload Examples

Text

{
    "type": "text",
    "text": {
        "body": "Simple text message"
    }
}

Rich Link

{
    "type": "text",
    "text": {
        "body": "https://yourURL",
        "preview_url": "true"
    }
}

Quick Replies

Note that:

{
    "type": "interactive",
    "interactive": {
        "type": "button",
        "body": {
            "text": "This is my Text"
        },
        "action": {
            "buttons": [
                {
                    "type": "reply",
                    "reply": {
                        "id": "123",
                        "title": "Button1"
                    }
                },
                {
                    "type": "reply",
                    "reply": {
                        "id": "1234",
                        "title": "Button2"
                    }
                }
            ]
        }
    }
}

Image

{
    "type": "image",
    "image": {
        "link": "https://imageURL",
        "caption": "Image caption"
    }
}

Gallery Card

{
    "type":"interactive",
    "interactive":{
        "type":"button",
        "header":{
            "type":"image",
            "image":{
                "link":"https://imagesURL"
            }
        },
        "footer":{
            "text":"*subtext*"
        },
        "body":{
            "text":"*this is text*"
        },
        "action":{
            "buttons":[
                {
                    "type":"reply",
                    "reply":{
                        "id":"1",
                        "title":"quickReply.title1"
                    }
                },
                {
                    "type":"reply",
                    "reply":{
                        "id":2,
                        "title":"quickReply.title2"
                    }
                },
                {
                    "type":"reply",
                    "reply":{
                        "id":3,
                        "title":"quickReply.title3"
                    }
                }
            ]
        }
    }
}

Video

{
    "type": "video",
    "video": {
        "link": "https://videoURL",
        "caption": "Video caption"
    }
}

Audio

{
    "type": "audio",
    "audio": {
        "link": "https://audioURL"
    }
}

Document

Note that the linked document gets downloaded when clicked.

{
    "type": "document",
    "document": {
        "link": "http://documentURL",
        "filename": "Name of the file"
    }
}

Location

{
    "type": "location",
    "location": {
        "latitude": 51.214005624409445,
        "longitude": 6.748941454406442,
        "name": "Cognigy GmbH",
        "address": "Speditionstraße 1, Düsseldorf, North Rhine-Westphalia 40221"
    }
}

Contact

{
    "type": "contacts",
    "contacts": [
        {
            "addresses": [
                {
                    "street": "Speditionstraße 1",
                    "city": "Düsseldorf",
                    "state": "North Rhine-Westphalia",
                    "zip": "40221",
                    "country": "Germany",
                    "country_code": "de",
                    "type": "HOME"
                },
                {
                    "street": " Speditionstraße 1",
                    "city": "Düsseldorf",
                    "state": "North Rhine-Westphalia",
                    "zip": "40221",
                    "country": "Germany",
                    "country_code": "de",
                    "type": "WORK"
                }
            ],
            "birthday": "2017-12-10",
            "emails": [
                {
                    "email": "test@cognigy.com",
                    "type": "WORK"
                },
                {
                    "email": "test@whatsapp.com",
                    "type": "HOME"
                }
            ],
            "name": {
                "formatted_name": "John Doe",
                "first_name": "John",
                "last_name": "Dow",
                "middle_name": "D.",
                "suffix": "Jr",
                "prefix": "Dr"
            },
            "org": {
                "company": "Cognigy",
                "department": "Conversational AI",
                "title": "Manager"
            },
            "phones": [
                {
                    "phone": "+49 (940) 555-1234",
                    "type": "HOME"
                },
                {
                    "phone": "+49 (650) 555-1234",
                    "type": "WORK",
                    "wa_id": "16505551234"
                }
            ],
            "urls": [
                {
                    "url": "https://www.cognigy.com",
                    "type": "WORK"
                },
                {
                    "url": "https://www.whatsapp.com",
                    "type": "HOME"
                }
            ]
        }
    ]
}

List

{
    "type": "interactive",
    "interactive": {
        "type": "list",
        "header": {
            "type": "text",
            "text": "This is the name of the list"
        },
        "footer": {
            "text": "Subtext of the list"
        },
        "body": {
            "text": "This is text*"
        },
        "action": {
            "button": "Send",
            "sections": [
                {
                    "title": "<List Category Item>",
                    "rows": [
                        {
                            "id": "<Item ID>1",
                            "title": "<Item Title>",
                            "description": "<Item Description>"
                        },
                        {
                            "id": "<Item ID>2",
                            "title": "<Item Title>",
                            "description": "<Item Description>"
                        },
                        {
                            "id": "<Item ID>3",
                            "title": "<Item Title>",
                            "description": "<Item Description>"
                        }
                    ]
                }
            ]
        }
    }
}