Tutorials
Share Media Content with Message Templates over API
Share Media Content with Message Templates over API

Share Media Content with Message Templates over API

Using WhatsApp and API, send different types of media messages using templates. You can send various types of content such as location, documents, images, and video.

This tutorial explains how to send a message template containing location.

WhatsApp use case - Share e-Tickets for Events high-level overview

Process Workflow

WhatsApp use case - Share Package Delivery Location process workflow

IMPLEMENTATION STEPS

Before you implement this use case and start using WhatsApp media message templates, the template needs to be approved by WhatsApp. Once your delivery location media message template is approved, you can reuse it and personalize it for each customer who is awaiting their package.

Use the additional placeholders to personalize your message.

NOTE

To register your template, you must provide a template name, content, and language info. After that, Infobip sends the template over to WhatsApp for approval.

Define the media in the header, in this instance it’s the location, and enter the message content.

Template name

Template header

Template body

Language

Approved

delivery_notification

Media - Location

Order number {{1}} has been delivered to the shipping address seen on the map. Thank you for shopping at Go2Shop ��

en

Steps over API

To send a delivery location notification to a specific customer using API, follow the steps described below.

  1. Log in to the Infobip API Developer Hub (opens in a new tab).

  2. Copy your Base URL. It is visible on top of the page below the API Key.

    NOTE

    The personal BASE URL is a simple way to identify who sent the API request. This means we can identify the request through DNS and then find the optimal route for API requests.

  3. Open Postman (or similar tool) and choose the POST method.

  4. Replace the endpoint with your Base URL and then add the following to that URL: '' .api.infobip.com/omni/1/advanced''

  5. Add the Authorization header.

    For example, Basic: Base64 encoded username and password.

    Learn more about Security and Authorization methods (opens in a new tab) on the Infobip API Developer Hub.

  6. Copy the scenarioKey you previously created.

    Learn more about Creating a scenario.

  7. Specify the destination phoneNumber you wish to send the notification to.

    Replace the templateName, latitude, longitude, placeholders, and language fields with registered ones (refer to the table above).

    json
     
    		"scenarioKey":"CC9F01A5DC7BEE2C2B829D203482A654",
    			"destinations":[
    					{
    						"to":{
    								"phoneNumber":"41793026727"
    						}
    					}
    			],
    			"whatsApp":{
    					"templateName":"delivery_notification",
    							"mediaTemplateData": {	"header": {	  "latitude": 45.793337,	"longitude": 15.946519
    							},	"body": {		"placeholders": ["51298783"]	}},
    					"language":"en"
    			}
    		}
     

    Here's how the message will look like:

    WhatsApp use case - Share Package Delivery Location message example
PRO TIP

Apart from sharing the delivery location for items and packages, you can create entire digital customer journeys by sending out customers' e-receipts right after they make a purchase, share e-tickets, share boarding passes, and send invoices.

Need assistance

Explore Infobip tutorials

Encountering issues

Contact our support

What's new? Check out

Release notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Service Terms & ConditionsPrivacy policyTerms of use