Reputation: 837
The access token provided by Whatsapp cloud API expires in 24 hours. Is there a way to get a permanent access token?
There is an official link for getting a permanent token on the whatsapp website : Learn how to create a permanent token but it is another rabbit hole which does not state how to get permanent access token.
If someone has done this successfully, please help me and other frustrated developers :)
Upvotes: 21
Views: 24081
Reputation: 21371
You need to set up a system user as the admin of your app. You can then generate never expiring access tokens for this system user.
Step by step guide to set it up:
admin
role.whatsapp_business_management
and whatsapp_business_messaging
and confirmUpvotes: 62
Reputation: 11
You can get user access token from Facebook oauth using this link: https://www.facebook.com/v8.0/dialog/oauth?client_id=<app_id>&response_type=code%20token&redirect_uri=<redirect_url>&scope=whatsapp_business_management
client_id: App ID of your app on developer.facebook.com redirect_url: your url where access token will be appended (note: you have to add to "valid oauth redirect urls" of your app "Facebook Login => Settings") scope: whatsapp_business_management
Once the process is completed the access tokens will be appended to your redirect url.
Upvotes: 0