Media and Interactive Message Template Examples

These examples illustrate the process of setting up media message templates beginning with the template creation in your Business Manager and sending the message templates with API calls to the messages endpoint.

Media Message Templates

Movie ticket example

This example show the creation of a media message template with a QR code image.

1. Create the media message template in your Business Manager.

Business Manager Message Template Creation

2. The messages API call adds in the parameter information.

POST /v1/messages
{
    "to": "your-test-recipient-wa-id",
    "recipient_type": "individual",
    "type": "template",
    "template": {
        "namespace": "88b39973_f0d5_54e1_29cf_e80f1e3da4f2",
        "name": "movie_ticket_update",
        "language": {
            "code": "en",
            "policy": "deterministic"
        },
        "components": [
            {
                "type": "header",
                "parameters": [
                    {
                        "type": "image",
                        "image": {
                          "id": "your-image-id"
                        }
                    }
                ]
            },
            {
                "type": "body",
                "parameters": [
                	{
                		"type": "text",
                		"text": "Star Rangers"
                	},
                    {
                    	"type": "date_time",
                        "date_time" : {
                            "fallback_value": "May 1st, 2019 8:45pm",
                            "day_of_month": 20,
                            "year": 2019,
                            "month": 9,
                            "hour": 20,
                            "minute": 45
                        }
                    },
                    {
                        "type": "text",
                        "text": "Carnival, Sangam"
                    },
                    {
                        "type": "text",
                        "text": "Silver"
                    },
                    {
                        "type": "text",
                        "text": "F6, F7, F8"
                    }
                ]
            }
        ]
    }
}

3. Your customer receives their movie ticket message.

Movie Ticket Message

Flight ticket example

This example show the creation of a media message template with a PDF document.

1. Create the media message template in your Business Manager.

Business Manager Message Template Creation

2. The messages API call adds in the parameter information.

POST /v1/messages
{
    "to": "your-test-recipient-wa-id",
    "recipient_type": "individual",
    "type": "template",
    "template": {
	        "namespace": "88b39973_f0d5_54e1_29cf_e80f1e3da4f2",
        "name": "flight_confirmation",
        "language": {
            "code": "en",
            "policy": "deterministic"
        },
        "components": [
            {
                "type": "header",
                "parameters": [
                    {
                        "type": "document",
                        "document": {
                        	"filename": "MRRATH-CGK-KUL.pdf",
                        	"link": "link-to-your-document"
                        }
                    }
                ]
            },
            {
                "type": "body",
                "parameters": [
                	{
                		"type": "text",
                		"text": "CGK (Jakarta)"
                	},
                	{
                		"type": "text",
                		"text": "KUL (Kuala Lumpur)"
                	},
                    {
                    	"type": "date_time",
                        "date_time" : {
                            "fallback_value": "20th April 2019, 12:20pm",
                            "day_of_month": 20,
                            "year": 2019,
                            "month": 9,
                            "hour": 12,
                            "minute": 10
                        }
                    }
                ]
            }
        ]
    }
}

3. Your customer receives their boarding pass in a PDF document.

Flight Ticket Message

Interactive Media Message Templates

Trip reminder example

This example show the creation of an interactive media message template with quick reply buttons.

1. Create the interactive media message template in your Business Manager.

Business Manager Message Template Creation

2. The messages API call adds in the parameter information.

POST /v1/messages
{
    "to": "your-test-recipient-wa-id",
    "recipient_type": "individual",
    "type": "template",
    "template": {
        "namespace": "88b39973_f0d5_54e1_29cf_e80f1e3da4f2",
        "name": "upcoming_trip_reminder",
        "language": {
            "code": "en",
            "policy": "deterministic"
        },
        "components": [
        	{
        		"type": "header",
        		"parameters": [{
        			"type": "text",
        			"text": "12/26"
        		}
                ]
        	},
        	{
                "type": "body",
                "parameters": [
                	{
                		"type": "text",
                		"text": "*Ski Trip*"
                	},
                	{
                		"type": "date_time",
                        "date_time" : {
                            "fallback_value": "29th July 2019, 8:00am",
                            "day_of_month": "29",
                            "year": "2019",
                            "month": "7",
                            "hour": "8",
                            "minute": "00"
                        }
                	},
                	{
                		"type": "text",
                		"text": "*Squaw Valley Ski Resort, Tahoe*"
                	}
                ]
            },
            {
            	"type": "button",
            	"sub_type": "quick_reply",
            	"index": 0,
            	"parameters": [{
            		"type": "payload",
            		"payload": "Yes-Button-Payload"
            	}
            	]
            },
            {
            	"type": "button",
            	"sub_type": "quick_reply",
            	"index": 1,
            	"parameters": [{
            		"type": "payload",
            		"payload": "No-Button-Payload"
            	}
            	]
            }
        ]
    }
}

3. Your customer receives their trip reminder message with quick reply buttons.

Trip Reminder Message with Quick Reply Buttons

Product shipment example

This example show the creation of an interactive media message template with URL and phone number buttons.

1. Create the interactive media message template in your Business Manager.

Business Manager Message Template Creation

2. The messages API call adds in the parameter information.

POST /v1/messages
{
    "to": "your-test-recipient-wa-id",
    "recipient_type": "individual",
    "type": "template",
    "template": {
        "namespace": "88b39973_f0d5_54e1_29cf_e80f1e3da4f2",
        "name": "oculus_shipment_update",
        "language": {
            "code": "en",
            "policy": "deterministic"
        },
        "components": [
        	{
                "type": "header",
                "parameters": [
                    {
                        "type": "image",
                        "image": {
                        	"link": "link-to-your-image"
                        }
                    }
                ]
            },
            {
            	"type": "body",
            	"parameters": [
            		{
            			"type": "text",
            			"text": "Anand"
            		},
            		{
            			"type": "text",
            			"text": "Quest"
            		},
            		{
            			"type": "text",
            			"text": "113-0921387"
            		},
            		{
                		"type": "date_time",
                        "date_time" : {
                            "fallback_value": "23rd Nov 2019",
                            "day_of_month": "20",
                            "year": "2019",
                            "month": "9"
                        }
            		}
            		] 
            },
        	{
                "type": "button",
                "index": "0",
                "sub_type": "url",
                "parameters": [
                	{
                		"type": "text",
                		"text": "1Z999AA10123456784"
                	}
                ]
            }
        ]
    }
}

3. Your customer receives their product shipment message with URL and phone call buttons.

Product Shipment Message with URL and Phone Call Buttons