Objective
Sending messages using advanced templates with the Messages API custom object.
Applies To
- Messages API
- Custom Object
Procedure
To send using more advanced WhatsApp Templates, like WhatsApp Media Message Templates or templates using a link style button, you will need to use the Messages API custom object. The custom object takes a partial section of the original WhatsApp API request and sends it directly through to WhatsApp. In our developer documentation, we provide examples of how you can do this. Something to be aware of is that WhatsApp has slightly different parameter validation than the native Vonage API. Therefore, your parameter variables may have to be different. This can cause message failures. To prevent this, we're keeping a list of the differences which may be missed below.
When stating the language code for a template in a request body in our native API you would use a hyphen to link the language and country ("en-GB" for example). However, when using the custom object, an underscore should be used instead of a hyphen to link the language and country. Therefore, in your request "en-GB" would instead be "en_GB".
"whatsapp": { "policy": "deterministic", "locale": "en-GB" }
So the above example would become the following when using the custom object.
"language": { "policy": "deterministic", "code": "en_GB" }
Also, URL is changed to link.
"image": { "url": "'$IMAGE_URL'", "caption": "'$IMAGE_CAPTION'" }
So the above example would become the following when using the custom object.
"image": { "link": "'$HEADER_IMAGE_URL'" }
Additional Information
For more information, see our developer documentation on sending a WhatsApp Media Message Template.
Articles in this section
- Why is my WhatsApp Messaging Limit still at 250 and Display Name not visible after Business Verification?
- WhatsApp Display Name – Approval, Review & Appeal Process
- Understanding WhatsApp Usernames and Business-Scoped User IDs (BSUIDs) – Required Actions and Changes
- Understanding the "Business Verification Needed.." Message in WhatsApp Manager for Restricted WABA Accounts
- WhatsApp Business Account Locked - Error 1330
- WhatsApp Vonage Managed Manual Onboarding Form No Longer Available for partners
- What to do if you see "The new display name has been approved. Register your number to start using it"?
- What is the 24-Hour Customer Care Window
- How to generate JWT token using Vonage Online JWT generator tool?
- Getting started with Vonage's WhatsApp Business Account : Hosted Embedded Sign-Up for Partners' End Customers