Vonage API for WhatsApp Message Templates
fmMMS v1.29 added support for sending WhatsApp Message Templates using the Vonage API for WhatsApp.
To send a WhatsApp Message Template from fmMMS you will need to create a new Template and ensure the Vonage WhatsApp Template checkbox is ticked as highlighted below:
fmMMS includes the Shipping Update WhatsApp Template that you can use with the Messages API Sandbox as shown above that you can use for testing sending Message Templates with the Vonage Sandbox.
For each WhatsApp Template you will need to copy/paste the Vonage WhatsApp Template Name and Vonage WhatsApp Template Namespace (N.B. these 2 fields will only appear once the Vonage WhatsApp Template checkbox is ticked) values from you WhatsApp Business Account into these fields:
- Vonage WhatsApp Template Name: The namespace ID found in your WhatsApp Business Account. Only templates created in your own namespace will work. Using a template with a namespace outside of your own results in an error code 1022 being returned.
- Vonage WhatsApp Template Namespace: The name of the template created in your WhatsApp Business Account
For the Template Body we have used the $WhatsAppParameter1, $WhatsAppParameter2 etc format for inserting placeholders for the merge fields for the Template. For example the Sandbox Shipping Update WhatsApp Template that we include has the following Template Body:
Your parcel from $WhatsAppParameter1 is due to arrive on $WhatsAppParameter2 between $WhatsAppParameter3 and $WhatsAppParameter4.
You will need to update the script Send MMS - Vonage API for WhatsApp Message Template to handle the substitution of the merge fields for each new Template that you add. The highlighted steps in the following screenshot show how these are handled for the Sandbox Shipping Update WhatsApp Template that we include:
You will need to create an "Else If" branch for every new Template that you add that generates the required $WhatsAppParameter1, $WhatsAppParameter2 etc variables and also update the $json calculation to include references to these. For example if you have generated 4 variables/merge fields you will need to ensure all 4 variables are included in the calculation as highlighted below:
When the WhatsApp Message Template is sent it will appear on the recipient's phone with the merged variables:
You can get more information on working with Vonage WhatsApp Message Templates here: