WhatsApp Implementation Guide 1.0 PDF
WhatsApp Implementation Guide 1.0 PDF
WhatsApp Implementation Guide 1.0 PDF
Implementation
Guide
CM.com
April 2019
V1.0
April 2019
Content:
1 General ....................................................................................................................................................... 2
1.1 Who should read this guide? ......................................................................................................................... 2
1.2 Prerequisites.................................................................................................................................................. 2
Page | 1
April 2019
1 General
This implementation guide can be used for the step-by-step implementation of WhatsApp messaging using
the CM.com Business Messaging API. The Business Messaging API provides your organisation with a single
API to send messages via multiple channels like SMS, WhatsApp, RCS, Viber, etc.
Information about CM’s WhatsApp solution and pricing can be found online.
Should you have any questions or need clarification, please contact CM.com on +31 (0)76 752 7000 or via
[email protected].
In case you haven’t gone through the onboarding procedures yet, find the WhatsApp registration form here.
1.2 Prerequisites
Before being able to send WhatsApp Messages, you need to make sure you are ready to start. CM.com will
help you configure your account. Some of these steps -like the verification of your Business Details with
WhatsApp- can take 2 weeks or more and should be taken well in advance of starting your implementation.
Page | 2
April 2019
The division between the two building blocks are shown in the table below.
Message components Plain text with parameters. Text, Location, Contacts, Media
(image, audio, document)
2.1 Notifications
The WhatsApp Business Solution enables companies to send notifications towards their customers,
employees, fans or any other type of end-user. Notifications are characterized by being sent outside of the
Customer Care Window and you can only use pre-defined Templated messages.
In order to send notifications, the end-users have to first give permission to these notifications by an active
‘opt-in’. This is no different from any other form of communication like SMS or Email. Failure to correctly
obtain opt-in might result in termination of your WhatsApp Business Account by WhatsApp/Facebook.
• The opt-in has to be active, meaning it must be triggered by a user action, such as entering a phone
number or checking a box to indicate consent.
• Provide clear opt-in messaging, so the end-users know what type(s) of messaging they are signing up
for.
• Show the intended use of WhatsApp by showing the logo and name.
• Opt-in confirmation via WhatsApp after completing the opt-in process
The opt-in can be delivered to the end-users by any third-party channel (such as email, SMS, RCS, QR-Codes,
Websites). The company sending out the message is responsible for ensuring the opt-in was provided and
should register the opt-in in their system.
NOTE: Please remember that local government regulations might also apply to your ability to contact
customers.
Page | 3
April 2019
The user must be asked to opt-in via a visual element (checkbox or similar) shown next to the WhatsApp name
and logo on your chosen third-party channel.
In addition, language must be shown adjacent to the UI elements to explain clearly what information will be
received and make specific reference to this information being sent as messages on WhatsApp, like “receive
[noun], [logo and name], on [number]"; where noun is the type of information related to the flow.
Once you have an opt-in, the validity of this opt-in is not limited to a certain time frame. You can ask for opt-in
multiple times and you should do so for situations where the purpose of the message is different from the
purpose for which an opt-in was granted.
For sending messages outside of the Customer Care Window, the flow should therefore look like this:
Page | 4
April 2019
In order to activate the Customer Care Window, an end-user needs to initiate the conversation. This can be
done by any third-party channel (e.g. a button on the website with “Send Hi to +31(0)612345678 to open the
conversation” or a QR-code). The activation of the Customer Care Window by the end-users does not count as
opt-in. Therefore, it is not possible to send notifications after the Customer Care Window ended, without
obtaining a specific opt-in.
The Customer Care Window ends 24 hours after the last message is sent by the end-user. In this case, the
company loses the ability to send messages to that specific end-user and only Templated Messages for which
an opt-in has been granted can be sent.
When the company needs more than 24 hours to solve an end-user’s problem, the company has the possibility
to send a Templated Message with a resolution issue tag (outside the Customer Care Window) to trigger the
end-user to re-open the Customer Care Window. For example: “We have updates regarding your ticket {{ticket
ID}}. Please respond back if you'd like to continue support”. If the end-user responds to this notification, a new
Customer Care Window opens, enabling companies to send both Templated and Session Messages for
another 24 hours.
Page | 5
April 2019
In practice, both building blocks (Customer Care Window and notifications) can be used within one end-user
communication flow. In the flowchart below, first a notification is sent (because the customer has approved
the opt-in), followed by the customer who activates a conversation (and therefore opens a Customer Care
Window). Because this end-user has approved the opt-in, the company has the possibility to send notifications
both inside and outside the Customer Care Window.
Page | 6
April 2019
Your WhatsApp Verified Name, as you have chosen during enrollment, is shown at the top of the chat. Users
can open your profile information by clicking the profile logo and/or name. This will open the business details
you specified during enrollment to the end-user.
From the same business details screen, end-users can -at any time- choose to either Block your
communication or Report your profile to WhatsApp. These are powerful actions. Once a user has blocked your
company profile, you will be unable to contact that user any longer and you have no control or appeal over
this.
Page | 7
April 2019
When a user Reports your profile, in addition to blocking, he is filing a complaint with WhatsApp. If WhatsApp
receives significant negative feedback about your customer communications, your entire WhatsApp Business
Account can eventually be revoked.
https://wa.me/15551234567
You can even provide a chat suggestion value for initiating the conversation. This suggested value will prefill
the standard “Type a message” field, ready to be sent by the user with the click of a button. Be sure to use URL
query encoding when providing the text=value.
https://wa.me/15551234567?text=I'm%20interested%20in%20your%20car%20for%20sale
You can easily incorporate such links in website buttons, Facebook campaigns or inside a QR code to target
offline distribution.
Page | 8
April 2019
2.5 Messages
Within WhatsApp there are multiple message types available:
Within the CM.com Business Messaging API, these types are used in ‘Conversation items’ which in turn are
used inside of a ‘Conversation’. Please find the details in our API documentation.
Page | 9
April 2019
WhatsApp even allows for limited formatting in messages. To format all or part of a message, use these
formatting symbols:
A web link is not a message type in its own right, but a piece of textual content. Links are automatically
detected, and the first link can be turned into a link preview. Links are possible in text messages and in
templated messages.
To determine the content that WhatsApp will present for a web link preview, your webpages have to
implement the Open Graph Protocol. This protocol is used by WhatsApp, Facebook, Twitter and many other
websites in the world to dynamically create previews of links.
Page | 10
April 2019
When a media message is sent, the media is stored encrypted on the WhatsApp servers for 7 days. If a user
makes a request to download the media after 7 days, the WhatsApp servers will request the same media file
from the WhatsApp Business API client. If the media has been removed, the user will be notified that the
media is unavailable. It is not safe to assume the media was downloaded simply based on the delivered and
read receipts. Outgoing media is generally safe to be removed past 30 days, but you should employ a strategy
that best suits your business.
Page | 11
April 2019
A contacts message will deliver a bubble with a name card. Within this name card you can provide all the
details of a person like with other vCard systems. You can either immediately contact this person via
WhatsApp or open the card and add the details to an entry in the address book of your iOS or Android device.
Please do consider any GDPR or similar privacy-related regulation.
Page | 12
April 2019
Once a template is approved, you will receive the namespace and the ID of the template from CM.com. The
namespace and ID are references to your WhatsApp Business account and your templates within this account.
You need to refer to these identifiers when sending your templated message.
A message template may consist of text, emoji or WhatsApp-specific formatting. A templated message can
consist of a maximum of 4096 characters. To personalize the message, you can use the numbered
placeholders {{x}}. Each of those placeholders can be filled with letters, digits, special characters, and spaces.
URLs can be sent, but you cannot use Media or Location items in your templates.
Hello {{1}}, thanks for your order! We will let you know when your order is ready to be shipped. You
can track your order with number {{2}} here {{3}}. Enjoy your day!
{{1}} = Sophie
{{2}} = 771663
{{3}} = https://yourparceldelivery.com/track/
As WhatsApp Business is intended as a customer service channel, sending advertising, marketing, and
promotional messages are prohibited, resulting in disapproval of message templates with such character. For
further information on the commerce policy, please click here.
Page | 13
April 2019
To register your own Message Templates, you need to provide a template name, template tag and template
message with parameters and submit them to [email protected].
• Template name: You need a unique name to identify the template’s use case for your business.
All in lower case and without spaces. Underscore is allowed. Example: order_confirmation.
• Template tag: Select the type of message from a predefined set. Available are: Account Update,
Alert Update, Appointment Update, Issue resolution, Payment Update, Personal Finance
Update, Shipping Update, Ticket Update, Transportation Update.
• Template message with parameters: This is the actual transactional notification, which should
contain at least one parameter as placeholder, noted as {{1}}.
Page | 14
April 2019
3. Service description
In order to send and receive WhatsApp messages you will need to integrate with the CM.com Business
Messaging API. The Business Messaging API allows you to send various message types over multiple channel
types, like SMS, WhatsApp, RCS or Viber. Detailed documentation about the API can be found in our online
API documentation.
The second part of your implementation is receiving incoming messages from customers. You have two
options for receiving messages.
• Make use of CM.com’s Customer Contact web app. Your package includes three free user
subscriptions for this service.
• If you wish to handle all incoming messages yourself, you have to implement a webhook which listens
for these incoming messages. Detailed documentation can be found in the Webhook documentation.
Your CM customer success manager will configure your webhook in the CM.com platform.
3.1 Authentication
All requests require your product token which, as a registered user, you can find on our platform in
the Gateway app. It was also e-mailed to you after registration and has a format like: 00000000-0000-0000-
0000-000000000000.
NOTE: Your product token is private information and should never be incorporated into webpages and/or
mobile applications where it can be exposed to 3rd parties.
Our API supports sending messages via HTTP. You can send a POST request containing a JSON body as
specified in the documentation.
Our global gateway is accessible via one endpoint which we are load balancing over 2 platform locations in
The Netherlands. To reduce latency, and/or be compliant to local legislation we also have platforms in London,
South Africa, and Shanghai. More information can be found in our Help Center.
In order to send WhatsApp messages, be sure to specify the “allowedChannels”: [“WhatsApp”] parameter in
your JSON message.
Page | 15
April 2019
"messages": {
"authentication": {
"producttoken": "00000000-0000-0000-0000-000000000000"
},
"msg”: []
}
You specify your authentication token for each request and within the request you can send multiple
messages. Each individual message is a JSON object to be added inside the msg array.
For each Message Object you specify the To, From, Body/Content and, very important, the Channel via which
the message should be delivered.
{
"allowedChannels": [ "WhatsApp" ] ,
"from":
The contents of a msg"CM.com",
can however exist as multiple parts to be delivered.
"to": [{
"number": "00447911123456"
}],
"body": {
"content": "This is a simple message"
}
Error handling
}
A single Message Object inside the msg Array can actually be sent to multiple recipients but the content for
each of these recipients will be the same. If you want to send different content you need multiple message
objects or multiple requests.
This example is the most basic implementation and works for each type of Channel from WhatsApp to SMS.
Page | 16
April 2019
{
"allowedChannels": [ "WhatsApp" ],
"from": "CM.com",
"to": [{
"number": "00447911123456"
}],
"body": {
"content": "This is a fallback value"
},
"RichContent": {
"conversation": []
}
}
A conversation item object contains either a “text”, a “media”, a “template” or a “location” item. This example
shows 3 conversation items, to be delivered at once to the recipient.
[
{
"text": "Hi this is a rich content message!"
},
{
"media": {
"mediaName": "conversational-commerce",
"mediaUri": "https://www.cm.com/cdn/web/nl-
nl/blog/conversational-commerce.jpg",
"mimeType": "image/jpg"
}
},
{
"location": {
"latitude": "51.603802",
"longitude": "4.770821",
"label": "CM HQ",
"searchQuery": "Konijnenberg 30"
}
}
]
Note: There are other types of conversation items that can be used for different Channel types.
Page | 17
April 2019
A templated message is also a type of conversation item. Templated messages require you to register a
Template and get it pre-approved by WhatsApp. Please note Chapter 2.5.4 Templated messages, on how to
register your WhatsApp templates. Sending a templated message (msg) looks like this:
{
"allowedChannels": [ "WhatsApp" ],
"from": "CM.com",
"to": [{
"number": "00447911123456"
}],
"body": {
"content": "This is a fallback value"
},
"RichContent": {
"conversation": [{
"template": {
"whatsapp": {}
}
}]
}
}
Here we specify an array of a single conversation item. The item is a template type item. The template uses a
“whatsapp” template. The value assigned to the whatsapp attribute is the actual template call.
"conversation": [{
"template": {
"whatsapp": {
"namespace": "yournamespace",
"element_name": "yourtemplatename",
"language": {
"policy": "fallback",
"code": "en_US"
},
"localizable_params": [{
"default": "Name"
}, {
"default": "Order"
}, {
"default": "Order2"
}, {
"default": "https://example.com"
}
]
}
}
}]
The format of the object for the whatsapp attribute is exactly the same as the hsm object in WhatsApp’s
Official template usage documentation.
Page | 18
April 2019
This example shows such a situation. The response indicates a partial failure with errorCode 201. The
messages array reflects the results of each of the two messages you attempted to send in a single request. The
first message succeeded and therefore has a messageErrorCode of 0. The second message failed and reports
error code 304.
{
"details": "Created 1 message(s)",
"errorCode": 201,
"messages": [
{
"to": "00447911123456",
"status": "Accepted",
"reference": "your_reference_A",
"parts": 1,
"messageDetails": null,
"messageErrorCode": 0
},
{
"to": "00447911123457",
"status": "Rejected",
"reference": "your_reference_B",
"parts": 0,
"messageDetails": "A body without content was found",
"messageErrorCode": 304
}
]
}
A full list of error codes and their meaning is provided in the online documentation.
You need to provide CM with a web address. CM will POST a JSON message to this address. If your system
replies with HTTP status code 200, you indicate receipt of the incoming message.
Page | 19