Error 422 Unprocessable Entity with Invalid message type error on Messages API request Error 422 Unprocessable Entity with Invalid message type error on Messages API request

Error 422 Unprocessable Entity with Invalid message type error on Messages API request

Support Team

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

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.

  1. In version v1 "to" and "from" are single value nodes instead of objects.
  2. The "channel" object needs to be specified only once in v1.
  3. 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

WhatsApp v0.1 to v1 Migration Guide

Messages API Overview

Messages API Reference