Send e-Receipts
Following each purchase, either in-store or online, your customers can easily opt-in to receive their receipt in digital format over WhatsApp.
By implementing this use case, end users can easily store their receipts for a refund claim. And at the same time, their receipt is sent and stored in a digital form reducing the carbon footprint.
Have in mind that before you start communicating with your customers over WhatsApp, you must receive and store their opt-ins.
This use case will show you how to send a WhatsApp media message template containing a document file over Infobip API.
Process Workflow
IMPLEMENTATION STEPS
Before you can start sending message templates, your template needs to be approved by WhatsApp. Once you create the e-receipt template and it has been approved by WhatsApp, you can reuse it and personalize it for other customers.
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 to WhatsApp 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_receipt |
Media - Document |
Your receipt is attached. Thank you for shopping at Go2Shop! |
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. Copy 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 out 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
, documentUrl
, documentFilename
, placeholders
, and language
fields with registered ones (refer to the table above).
The header
fields contain the document URL and document file name, while the placeholders in the template body are contained in placeholders
field
{
"scenarioKey":"CC9F01A5DC7BEE2C2B829D203482A654",
"destinations":[
{
"to":{
"phoneNumber":"41793026727"
}
}
],
"whatsApp":{
"templateName":"e_receipt",
"mediaTemplateData": {
"header": {
"documentUrl": "https://documenthost.com/purchase_no10859302.pdf",
"documentFilename": "Purchase Number 10859302"
},
"body": {
"placeholders": []
}
},
"language":"en"
}
}
If the media type in the registered template is an image instead of document, the mediaTemplateData
should contain information on image URL and real data for the placeholders.
PRO TIP
Why stop at e-receipts? Create an entire customer journey in digital form and send monthly invoices to your customers over WhatsApp. Check out the Send Invoices use case.