Permanent Access Token for 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!
- Go to the Business Settings
- Below Users, Click System users
3. Click on Add button Give a name to the system user, select a role, and click Create System User
Possible error:
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
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
- 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
Congratulations, you have added assets successfully
Now you can able to see the added assets in the Assigned assets
—
Step 2 - Generate Access Token:
- Click on Generate New Token button
2. Select an App, That you want to generate a token for
3. You can able to see the list of Info, Warnings, and a section Available permissions
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
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.
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:
How to Debug WhatsApp Business APIs Access Token?
- Go to the Facebook developer tool debug access token
- 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
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.