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.").
- Messages API
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.
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.