Messaging

This documentation describes how to start sending messages to your users.

Introduction

Message API calls are sent to the /messages endpoint regardless of message type, but the content of the JSON message body differs for each type of message (text, image, etc.). See the following documentation for information regarding the type of messages you want to send:

Message Templates

Please refer to our documentation on Message Templates which includes the steps required to get your Templates approved.

  • Each WhatsApp Business Account can have up to 250 message templates (how many is determined by your plan). That means 250 message template names, each of them can have multiple language translations. For example, a message template called hello_world translated into two languages counts as a single message template in regards to this limit.

  • The message template name field is limited to 512 characters.

  • The message template content field is limited to 1024 characters.

  • There is no limit to the number of parameters allowed in a Message Template.

Make sure you meet the messaging prerequisites and query the /v1/contacts endpoint for each number you want to send a template to. Otherwise, you will experience "Resource not found - unknown contact"errors.

Check out the Best practices on how to approach customers.

Error scenarios:

  • 400: Bad Request Check that you are using the correct data type for Booleans and Strings, and that the JSON-payload is well-formed. Use an online tool (ex. JSON formatter and validator) to validate the payload if you are not sure.

Booleans don't need double quotes!
  • 408: Message failed to send because it was pending for too long There are no further details provided by WhatsApp. The recommendation is to resend the message.

  • 470: Message failed to send because more than 24 hours have passed since the customer last replied to this number Free-form text messages and media messages will result in a failure callback with error 470 when sent outside of the 24h-window. Please find a way to restrict message sending if there was no incoming message for the given user/phone number within 24h.

  • 1000: Failed to generate processed file path This could occur when the file storage is full and files cannot be stored. Please reach out to support@360dialog.com

  • 1000: Image file format (audio/mpeg) is not supported Make sure that the message type matches the MIME-type of the file (ex. audio files should be sent using "audio", not "image"; audio/mpeg is an unsupported combination). Another reason could be that the video file doesn't have an audio track: then the error message contains something like video/mp4/h264/NONE where NONE is an indicator that the audio track is missing.

  • 1009: Invalid latitude The valid range is from -90 to 90.

  • 1014: Request for .... failed You have provided a URL that seems to be double URL-encoded and the file cannot be delivered because of that, or the file behind the URL doesn't exist.

  • 2001: Template name does not exist in the translation The template needs to be set up by customer success management (support@360dialog.com).

  • 500: structure unavailable: Client could not display the highly structured message (hsm) The Template was not understood by the WhatsApp consumer client. Check the format.