How to use the Messages API Custom Object with WhatsApp


  • How do I send a WhatsApp Media Message Template using Nexmo? 
  • Do any of the Whatsapp parameters change when using the custom object?


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 custom object. The custom object takes a partial section of the original WhatsApp API request and sends it directly through to WhatsApp. In our docs, we provide examples of how you can do this. Some things to be aware of though is that Whatsapp has slightly different parameter validation than our native API. Therefore your parameter variables may have to be different. This can cause message failures. In order 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 hyphen links the language and country. Therefore, in your request "en-GB" would instead be "en_GB".  

"whatsapp": { "policy": "deterministic", "locale": "en-GB" }

So the above would become the following when using the custom object.... 

"language": { "policy": "deterministic", "code": "en_GB" }


Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request