Symptom
When making an API request using Messages API, the request is rejected with an API response "422 Unprocessable Entity" and an error title: Invalid message type ( "detail": "The `message_type` parameter is invalid for the given channel.").
Applies To
- Messages API
Resolution
There are currently two versions of Messages API, version 0 (v0.1) and version 1(v1), please note there are some differences between the two versions as outlined below and if you are using v1 ensure you make the necessary changes in your code for successful API response.
- In version v1 "to" and "from" are single value nodes instead of objects.
- The "channel" object needs to be specified only once in v1.
- The "message" object has been replaced by a "message_type" in v1.
Cause
This error usually occurs if you did not replace your "message" object with "message_type" when using the v1 endpoint. Please see below articles WhatsApp v0.1 to v1 Migration Guide and Messages API Reference for more details on the code changes you need to implement when migrating to v1.
Additional Information
Articles in this section
- Setting Up a WhatsApp Template to Send Through the Messaging and Dispatch APIs
- Using the Messages API Custom Object for Advanced Templates with WhatsApp
- How many templates can I use with my WhatsApp Business account?
- What are the opt-in requirements for WhatsApp?
- Why are some of my WhatsApp Messages not delivered in order?
- Messages Rejected with 1210 Error When WhatsApp Business Number in Restricted Status
- Where do I find my Facebook Business Manager ID?
- How to Confirm Verification of Your Business with Facebook
- How to Accept the Jewel Notification from Vonage
- What is Facebook Business Verification and How to Complete It