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
- 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