Share e-Tickets for Events
When purchasing tickets online, your customers can easily select their preferred channel to receive their e-ticket on. By implementing this case, you can choose WhatsApp as one of the ways you communicate with your customers. Additionally, if they choose to, they can receive their e-ticket straight to their phone without having to go through their email.
This use case will show you how to send a WhatsApp media message template with an e-ticket as an image file over Infobip API. Your customers will receive the e-ticket on their preferred communication channel—WhatsApp.
Process Workflow
IMPLEMENTATION STEPS
Before you can send your e-ticket template, the template needs to be approved by WhatsApp. Once you create the e-ticket template and it has been approved by WhatsApp, you can reuse it and personalize it for different customers, as well as attaching the appropriate e-ticket for each customer.
Use 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 for approval.
You define the media in the header (image or document) and insert text information in the template body.
Template name |
Template header |
Template body |
Language |
Approved |
---|---|---|---|---|
e_ticket |
Media - Image |
Here is your e-ticket for {{1}}. Enjoy the show �� |
en |
✅ |
To send this notification to a specific customer using the WhatsApp API, follow the steps described below.
1. Log in to the Infobip API Developer Hub.
2. Use your base URL (e.g., your personal base URL is https://{{BASE_URL}}.api.infobip.com/)
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.
Steps over API
1. Choose the POST method.
2. Replace endpoint with https://{{BASE_URL}}.api.infobip.com/omni/1/advanced
3. Add the Authorization header.
For example, Basic: Base64 encoded username and password.
Learn more about Security and Authorization methods on the Infobip API Developer Hub.
4. Copy the scenariokey
you previously created.
Learn more about Creating a scenario.
5. Specify the destination phoneNumber
you wish to send the notification to.
6. Replace the templateName
, imageUrl
, placeholders
, and language
fields with registered ones (refer to the table above).
The imageUrl
field contains the image URL, while the placeholders in the template body are contained in placeholders
field.
{
"scenarioKey":"CC9F01A5DC7BEE2C2B829D203482A654",
"destinations":[
{
"to":{
"phoneNumber":"41793026727"
}
}
],
"whatsApp":{
"templateName":"e_ticket",
"mediaTemplateData": {
"header": {
"imageUrl": "https://www.filehostserver.com/eticket_75928402.jpg"
},
"body": {
"placeholders": ["Elton John Concert-06/04/2020"]
}
},
"language":"en"
}
}
If the media type in the registered template is a document instead of an image, the mediaTemplateData
fields should contain information about document URL, document file name and placeholders.
Refer to these related WhatsApp use cases for additional ideas what you can send with media message templates: