WhatsApp Messaging

  1. Overview
  2. Integrations
  3. WhatsApp Messaging

WhatsApp Messaging

Another way of reaching out to your customers is through WhatsApp integration. By creating messaging templates in Meta's (Facebook) business account, you will be able to use this integration just like SMS and email notifications.

WhatsApp integration for Trafft is a  custom feature  and it counts to the number of your  Custom Features & Integrations. 

Activate WhatsApp integration

Configure the Business Account

Link variables in templates

How to activate and set up the WhatsApp integration

To find the WhatsApp activation button, click on the Settings icon in the header, then choose "Features and Integrations" and switch to the Integrations tab. You will see WhatsApp.

Click on the " Activate" button and after that, you'll be able to click on the "Configure" option. Click on this option to open WhatsApp Settings. In here, you will need to paste your Phone Number ID, the Permanent Access Token, and your WhatsApp Business Account ID.

Configure Your Business Account

Visit this link to log in, or create your Facebook Developer Account. You can use your personal account, or your company’s Facebook account, you just need to log into it.

If you don't have an account on Facebook yet, you'll need to sign up first. Once your account is created, or once you log in, you'll be redirected to the homepage of Facebook for Developers. If there are no Apps previously created, you'll need to click on the Get Started option in the upper right corner. If you do have an app created, you can click on My Apps in the same position.

Registering an Account

If you're registering an account, you'll need to agree to Facebook's Terms and Developer Policies. The next step is account verification, which can be done either by adding a valid phone number (you will receive a verification code via SMS, so it needs to be a real number you can access) or by adding a credit card to your account.

The next step is to verify that the email linked to your Facebook account is valid. If you need to change it, click on "Update Email" in the lower right corner, and if it’s the correct email address, click on "Confirm Email" to continue to the last step.

The last step is used for helping Facebook improve your experience with the Facebook for Developers account. You can select "Developer" as we did in the screenshot below, but you can, of course, select another role. When you select it, click on Complete Registration, and that's it.

App Creation

Within the Facebook developer account, you’ll either see a list of your apps (if you already used it) or you’ll see a blank screen as shown in the screenshot below. All you need to do is click on "Create App" either in the top right, next to the search box, or in the App list section.

Select App type – Since you need to use WhatsApp with your business (regardless if you’re a "One-man show" or an enterprise), you need to select the "Business" type app option and click the "Next" button in the lower right corner.

Provide basic information – In here, you only need to choose the display name of your app (you can change this later). The email you’re logged in with is already populated, and the Business Account is not a mandatory option for using WhatsApp within Trafft, so even if your account is linked to a Business Account, you don’t need to select it.

Facebook doesn’t allow certain terms like "whatsapp". For example, you may not use Meta’s trademarks or brand elements (including FB, Face, Book, Insta, Gram, and Rift) or any confusingly similar terms in your app name if such term is, or could be perceived as, a reference to Facebook or its brands

Once you click the " Create app" button, Facebook will ask for your Facebook password. Enter the password and click "Submit" to continue.

This completes the creation of the app, and now we need to add a product to the app (WhatsApp). To do that, scroll down to the end of the page and click on "Set up" in the lower right corner of the "WhatsApp" card:

The next step informs you what’s included in the Business Platform API and by continuing, you agree to the Facebook Terms for WhatsApp Business and the Meta Hosting Terms for Cloud API. All you need to do is click on "Continue".

Depending on whether you already have a Business account, or if you just created a new account, and this is your first App, the next screen is either the Quickstart or the Getting Started section. If you land on Quickstart, you need to click on the Start using the API button:

This will take you to the Getting Started section which consists of data needed to test the app – a Temporary Access TokenPhone Number IDWhatsApp Business Account ID, and Curl of sending messages.

Please note: The Phone Number ID and the WhatsApp Business Account ID are required for populating the WhatsApp Settings in Trafft, as shown in the beginning of this article, so remember to come back to this page after you add your phone number later in this article.

In the " From" section, you will see a test number assigned to your account.

In the " To" section, you will see a drop-down menu that will be empty when you expand it. You can click on "Manage phone number list" and add up to 5 phone numbers to receive free test messages.

Please note: WhatsApp will send a confirmation code to the phone number, so you can’t actually add this number until you enter the 5-digit verification code you receive in the WhatsApp account linked to the phone number you provided.

Once you add your personal number for testing, you can click on the blue "Send message" button in the lower right corner under Step 2 and you should receive a WhatsApp message similar to this:

After you receive the text message, you can scroll down in the Facebook for Developers page; skip steps 3 and 4, and click on "Add phone number" in the bottom right:

This will bring up a modal where you add your business name (this is the name your customers will see on WhatsApp when they receive a message from you), business email (needs to be a valid email, since you’ll need to confirm it), your country, and your business’ website.

When you’re done populating this, click on " Next" in the bottom right corner:

The next pop-up will ask for the timezone, business category, and business description. Fill in the details carefully and click the " Next" button in the bottom right corner.

Enter your business’ official phone number that will be used for Trafft.

Bear in mind that this can’t be the number that’s already using WhatsApp, so it has to be a number that’s new to WhatsApp.

If you enter a number that’s already being used by WhatsApp (regardless if it’s a personal or a business account), once you link it here – you won’t be able to use it on a mobile device anymore, so we strongly recommend obtaining a new number for this integration.

You can enter your Business’ landline number also, you just need to select the " Phone Call" radio button below in order to activate it.

If you’re using a mobile number, you can also select the " Text message" option, and you will receive the verification code.

Once you click on " Next" in the bottom right corner of the pop-up, you will receive the verification code.

After you click on "Next", you will receive an OTP message from WhatsApp to your WhatsApp business number. Enter the verification code (OTP number) and click the "Finish" button. Your number will be verified at this stage and it will be linked to your WhatsApp business account.

At this point, you’ve configured the phone number you’ll use for WhatsApp messaging.

Before we get to that, let's copy what we currently have into Trafft's settings. Remember, we told you earlier that you will need to get back to the Phone Number ID and WhatsApp Business Account ID after you add your number. So, in the Facebook For Developers, under WhatsApp/Getting Started, select the newly added phone number from the drop-down list of the "From" section, and below it, copy the Phone Number ID, in Trafft's Settings/Features & Integrations/WhatsApp Integration -> Configure section, paste this into the Phone Number ID field. Then go back to Facebook for Developers, copy the WhatsApp Business Account ID and paste it into Trafft's WhatsApp Settings.

In order to integrate this number with Trafft, you will need a permanent access token

In the "Getting Started" section, at the top, you will notice a "Temporary access token", and a message that says "This token will expire in 23 hours". This can’t be used in Trafft since if, for example, you want to send the message after 23 hours from  NOW pass, the current access token will not work and you will need to log into the Facebook for Developers page again and click on the "Refresh" button in order to create a new token.

Instead of doing that, we need to create a token that never expires.

While logged into your Facebook for Developers account, access the Business Settings Page.

Under the " Users" section in the left sidebar, click on "System users". You will see a blank page where you need to click on "Add" to add a user:

You will, periodically, be prompted to accept  Facebook’s Non-discrimination policy. Just scroll through this modal and review the policy, and click on "I accept" in the bottom right corner of the pop-up.

 

On the next screen, you’ll see a "Thank you" message from Facebook, and you only need to click on " Done" in the bottom right to continue creating a new user.

Enter the username and select the role " Admin". Once you’re done, click on "Create system user":

In the right section of the next screen, click on the " Add Assets" button:

In the pop-up that appears, click on  Apps, then select the App previously created for WhatsApp integration, enable the Full Control ("Manage App") slider, and click on "Save Changes".

 

The next pop-up will inform you that a new asset has been added, and all you need to do is click on " Done".

After that, in the left sidebar, under " Accounts", click on "WhatsApp accounts". Select the previously created business app (in our example, it’s named "Test WhatsApp Business Account"), and then click on one of the "Add People" buttons:

In the pop-up that appears, select the system user previously created, and then enable the " Full Control" option again and then click "Assign" in the bottom right corner:

You’ll see a prompt that confirms that 1 Person has been added to the WhatsApp account, so just click “ Done”.

After that, go back to the " System Users" section in the left sidebar (agree to Facebook’s Non-discrimination policy if prompted again), and click on the "Generate new token" button:

Select the App from the drop-down menu, and scroll down. You will see a few notices, and below them, you’ll see the list of available permissions.

Scroll down and enable these two permissions:

  • whatsapp_business_messaging
  • whatsapp_business_management

After you select them, click on the " Generate token" button in the lower right corner of this pop-up.

Finally, you’ll see the token that will not expire and that will be active forever, unless you click the "Revoke Token" button.

You can also verify the token scope from the Facebook token debugger tool and check the scope of the token added successfully or not.

Please note: Facebook will not remember this token, so copy it and save it someplace safe.

This is the last thing you need to add to Trafft's WhatsApp Settings page, so paste this token in there:

When you save these settings, you can click on the WA Templates in Trafft's menu on the left.

The only difference is that WhatsApp templates can’t be configured in Trafft, instead, you need to configure them in WhatsApp, so when you expand the Notification Template drop-down, you will see some sample templates already provided by WhatsApp:

To create templates, you need to access your Business Settings Page, and in the left sidebar, click on the three lines and then click on "WhatsApp Manager":

In the " Overview" section that appears next, click on the three dots on the right of the WhatsApp account you previously created, and then click on "Manage message templates":

 

On the next page, you will be able to create new templates that will be used in Trafft. Simply click on " Create Template" in the top right to start.

When creating a template, the category needs to be " Transactional". Then, you define the name of the template (you can use the same names seen in Trafft, like "customer_appointment_approved", "employee_appointment_pending", and so on) and select the language that you use in Trafft. After you configure this, click on "Continue" in the top right corner.

Please note:

  • The name of the template needs to be lowercase without spaces. You can try adding them, and Facebook will automatically modify uppercase to lowercase, and replace spaces with an underscore.
  • The language you select in the template need to be included in Trafft also. The default language is set in Trafft's General Settings.

 

Templates in WhatsApp are similar but, again, different from creating templates for Email and SMS notifications.

The main difference is that you need to configure variables (placeholders) in the template, and they can only be numerical. As you can see in the screenshot below, these placeholders are in the same format as Trafft's and enclosed in double curly brackets, so they are shown as {{1}}, {{2}}, and so on.

An important thing here is to know which variable will be assigned to which placeholder in Trafft. For example, {{1}} in WhatsApp will be {{service_name}} in Trafft.

The Header and the Footer are optional, and the Header can include variables, while the Footer cannot. If you’re adding a Header, select "Text" from the drop-down and type your header as shown in the example below. Please note that the Header works only with "Text", so you can either use that, or you can skip adding the header altogether.

Once you create the template, click the "Submit" button in the upper right corner.

Each template you create will be reviewed by WhatsApp, and it usually takes an hour for it to be approved. An approved template will have a green status, set to Active - Quality pending, and a pending template will be gray with the status In review, as indicated in the screenshot below:

Please note:
  • Once a template is approved, it can no longer be edited. Only rejected templates can be edited. If you need to modify the template once it’s approved, you will need to delete the old one and create a new template.
  • WhatsApp doesn’t accept line breaks, TAB, and 4 spaces put together, so avoid using them in the template. Line breaks will be replaced with a semi-colon ( ; ).

Linking variables with Trafft Placeholders

Back in Trafft's Settings/Features & Integrations/WA Notifications/WA Templates (once you refresh the page), when you click on the " Notification template" drop-down, you will see the list of all templates created in the app (both approved and pending ones):

Select the template you want to associate with the Trafft template you clicked on (or created) and then you can continue linking the variables to placeholders.

Placeholders for Headers and placeholders for the message body are separate, so {{1}} in the header is not the same as {{1}} in the message body. All variables you added to the message template in WhatsApp will be selectable in drop-downs so all you need to do is link them properly.

First, the {{1}} variable needs to be linked to Category/Service/Name (in this example) in the header. Then, below that, you can see the message template pulled from WhatsApp, and below the template, you will be able to link the variables with placeholders in Trafft:

Don't forget to click on Save Changes when you're done linking the placeholders.

Please note:
  • It is strongly advised to create a dedicated WhatsApp account with your business phone number.
  • You can use the Test Account that WhatsApp creates, but you will not be able to modify the name that appears in your customers’ WhatsApp, so they will see a non-reachable phone number as shown in the screenshot above, without the ability to respond (as you won’t be able to receive this message on an actual account without adding a real phone number

Was this article helpful?