Messaging APIs | WhatsApp Business API
Give Feedback

Quickstart

Updated on August 30, 2023

Here you will find a presentation of the routes you will most commonly need and some examples to help you familiarize with the API.

Using these routes will require you to authenticate against the API by using your tokens. If you wish to learn more about how to generate and use these tokens, visit the Configuration section below.

Sending Template Messages with the WhatsApp Business Platform Cloud API

When sending a WhatsApp template, you have the option of sending the template in your Crisp inbox as a note, or as a text message from your business, along with options to start a new conversation in Crisp and auto-resolve the conversation.

The WhatsApp Business Platform Cloud API references are available directly from your Crisp dashboard. To view the routes, simply head over to Plugins > WhatsApp > API Reference

Sending a template as a simple note.

By default, message templates are sent to Crisp as a note type, unless specified otherwise. Sending a template as a note does not require the text parameters in each component, the message will be shown in Crisp as a note with only the template name and language of the sent template. It will look as such:

Simple Note Template

Example:

 curl -X POST  https://plugins.crisp.chat/urn:crisp.im:whatsapp:0/wa/api/website/{website_id}/template/send \
 --header "Authorization: Basic BASE64({identifier}:{key})"  \
 --header "Content-Type: application/json" \
 --data '{
    "message_template": {
      "language": "en_US",
      "name": "sample_issue_resolution",
      "components": [
        {
          "type": "BODY",
          "parameters": [
            {
              "type": "text",
              "text": "John"
            }
          ]
        }
      ]
    },
    "crisp_options": {
      "type": "note",
      "new_session": false
    },
    "to_number": "{to_number}",
    "from_number": "{from_number}"
  }'

Sending a template as a detailed note.

When the text parameters are added to the components, the note in Crisp will show more details about the template, which may provide context when the user responds. In this case, the note will be displayed the following way:

Detailed Note Template

Example:

curl -X POST https://plugins.crisp.chat/urn:crisp.im:whatsapp:0/wa/api/website/{website_id}/template/send \
  --header "Authorization: Basic BASE64({identifier}:{key})" \
  --header "Content-Type: application/json" \
  --data '{
  "message_template": {
    "language": "en_US",
    "name": "sample_issue_resolution",
    "components": [
      {
        "type": "BODY",
        "parameters": [
          {
            "type": "text",
            "text": "John"
          }
        ]
      }
    ]
  },
  "crisp_options": {
    "type": "note",
    "new_session": false
  },
  "to_number": "{to_number}",
  "from_number": "{from_number}"
}'

Sending a template as a text message.

If you would rather send the message as text type, the text parameter will be required in at least one of the components (when sending a template as a text type, we recommend adding the text parameters to all components for a better result). The text message will look like a normal message from the website, as seen below:

Text Message Template

Example:

curl -X POST https://plugins.crisp.chat/urn:crisp.im:whatsapp:0/wa/api/website/{website_id}/template/send \
  --header "Authorization: Basic BASE64({identifier}:{key})" \
  --header "Content-Type: application/json" \
  --data '{
  "message_template": {
    "language": "en_US",
    "name": "sample_issue_resolution",
    "components": [
      {
        "type": "BODY",
        "parameters": [
          {
            "type": "text",
            "text": "John"
          }
        ],
        "text": "Hi {{1}}, were we able to solve the issue that you were facing?"
      },
      {
        "type": "FOOTER",
        "text": "This message is from an unverified business."
      },
      {
        "type": "button",
        "index": 0,
        "sub_type": "QUICK_REPLY",
        "text": "Yes"
      },
      {
        "type": "button",
        "index": 1,
        "sub_type": "QUICK_REPLY",
        "text": "No"
      }
    ]
  },
  "crisp_options": {
    "type": "text",
    "new_session": false
  },
  "to_number": "{to_number}",
  "from_number": "{from_number}"
}'

Best Practices

The Benefits of sending messages as a note type instead of a text message is that if there were previously no messages in the conversation, the conversation will not appear in your inbox until the user replies to the message template, thus keeping your inbox from getting cluttered when sending marketing templates for example.

Information: you will still be able to retrieve the conversation in your inbox, by using the session_id returned in the payload of your Callback URL.

If you would like the message to be visible to your operators immediately, you can send the message as a text type. In order to get the correct text for the message template, you can use the Get Templates route to get all templates, with the option to filter approved templates exclusively.

💡 Tip: It is considered good practice to cache your templates on your server and only fetch them again once a new template is approved or updated. This will prevent you from being rate limited.