Permanent Access Token for WhatsApp Business APIs

Vishal Turi
4 min readJul 15, 2022

--

WhatsApp Business APIs

In simple terms, you have to add the system user to your business account and need to provide access to specific apps and permissions for specific features that you want to access.

Take care Before you begin

You must own a Facebook app that’s associated with your Business Manager to add system users. Learn how to add an app to your Business Manager.

let’s get it done in simple steps:

Step 1 - Add a new system user:

Skip this step 1, if you have already created a system user!

  1. Go to the Business Settings
  2. Below Users, Click System users
System users
Business settings > Users > System users

3. Click on Add button Give a name to the system user, select a role, and click Create System User

Create System User
Business settings > Users > System users > Add

Possible error:

Create System User Error
In order to create a system user, an app must be part of this business. Please add an app and then try again.

If you have not created the Facebook app that’s associated with your Business Manager then you must create it first and after you can come here and execute this step.

Read the above Take care Before you begin the guide if you are facing any errors.

After success, you will be able to see the created user

System users list
Business settings > Users > System users > Selected User

4. Assign assets such as your Pages, ad accounts, Facebook apps, and catalogs

  • Click on the Add Assets button, it will open a model and you can able to see 3 sections 1. Select asset type, 2. Select assets, and 3. App
Add assets
Business settings > Users > System users > Selected User
  • Click on Apps under Select asset type, available in the left corner
  • Click on the Specific App’s checkbox(s) that you want to provide access to the current user under Select assets, available in the middle section
  • Click on the Manage app toggle option and enable it for all access, you can customize it by other options available in this App section
  • Finally, Click on the Save Changes button
Add Assets Model
Business settings > Users > System users > Selected User > Add Assets

Congratulations, you have added assets successfully

Successfully Added Assets
Business settings > Users > System users > Selected User > Add Assets > Successfully Changed

Now you can able to see the added assets in the Assigned assets

Assigned assets
Business settings > Users > System users > Selected User > Assigned assets

Step 2 - Generate Access Token:

  1. Click on Generate New Token button
Generate New Token Button
Business settings > Users > System users > Selected User

2. Select an App, That you want to generate a token for

Generate New Token Model
Business settings > Users > System users > Selected User > Generate Token

3. You can able to see the list of Info, Warnings, and a section Available permissions

Generate Token Model After Section of App
Business settings > Users > System users > Selected User > Generate Token

4. Scroll down to the Available permissions, there is a list of API components, you need to select “whatsapp_business_messaging” and “whatsapp_business_management” for WhatsApp Business APIs access and Click on the Generate Token button

Select Available permissions
Business settings > Users > System users > Selected User > Generate Token

5. It will appear as a model and you can able to see the newly generated Access Token, Just Copy the Access Token and store it in a safe place i.e your project’s environment(env) file

Copy and save this token as it won’t be stored at Facebook.

Generated Access Token
Business settings > Users > System users > Selected User > Generate Token

Remember, you can only share a token once. Each new system user requires a newly generated token.

Original reference from Facebook Business Help.

Bonus Tips:

Bonus Tip

How to Debug WhatsApp Business APIs Access Token?

Access Token Debugger
Access Token Debugger
  • Select the API Version, Enter your Access Token, and Click on the Debug button, It will show all the tracking information with Granular Scops of the entered access token
Access Token Info
Access Token Debugger > Access Token Info

WhatsApp Business API Webhook Integration with Data API:

If you are looking for Webhook Integration refer to this article:

https://www.mongodb.com/developer/products/atlas/whatsapp-business-api-data-api/

Thanks.

--

--

Vishal Turi
Vishal Turi

Written by Vishal Turi

I’m a software developer, I specialize in server-side scripting languages, especially Node.js, PHP, though I am familiar with several languages and frameworks.

No responses yet