How to Create Instagram Access Token using API Setup with Instagram Login and Integrate into Desk
Page Contents
Step 1. Set up the Facebook App
1. Create a Facebook Developer Account
- Visit Facebook Developer Console (https://developers.facebook.com).
- Sign up and log in using your Facebook account.
2. Create a New Facebook App
- Click on My Apps at the top right.
- Select Create App.
- Choose For Everything Else and fill in the app details.
- Click Create App ID.
3. Set Up Instagram Graph API
- In your Facebook App Dashboard, find Instagram under “Add a Product” on the left.
- Click Set Up under Instagram Graph API.
- Click the ‘Add Account‘ button to link your Instagram Business Account.
4. Configure Webhooks
- Set the Valid Callback URL and Verify Token
- In the Facebook App Dashboard, navigate to Webhooks under your app settings.
- Enter the Callback URL for your Desk integration (e.g., https://your-desk-domain.com/webhook) in the Callback URL field.
- Enter a Verify Token of your choice. This token will be used to validate the webhook connection.
- Set the Callback URL and Verify Token in Output Desk
- Before saving the Callback URL and Verify Token in the Facebook App Dashboard:
- Open the public folder in your Output Desk installation directory.
- Locate and open the client.js file using a text editor (e.g., Notepad or WordPad).
- Update the Verify Token
In the client.js file, add the line as global.FaceBookVerifyToken and update it with the same token you plan to use in the Facebook App Dashboard. For example:
global.FaceBookVerifyToken = “YOUR_DESIRED_PASSWORD”; - Restart Output Desk Services
- Save the client.js file after making the changes.
- Restart the Output Desk services to apply the updated configurations.
- Finalize Callback URL and Verify Token in Facebook App
- Return to the Webhooks section in your Facebook App Dashboard.
- Enter the Callback URL (e.g., https://your-desk-domain.com/webhook) and the Verify Token you set in the client.js file.
- Click Save to finalize the webhook configuration.
Step 2. Generate Instagram Token
1. Generate Access Token
- Open the Instagram Basic Display settings in your Facebook App Dashboard.
- Click “Generate Token“.
- Follow the prompts to log in to your Instagram account and grant the required permissions.
- After completion, a short-lived access token will be generated.
2. Extend the Token
- To extend the token’s validity
Send a request to the following URLhttps://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=your_instagram_user_access_token
- The response will return a long-lived token valid for 60 days.
Step 3. Integrating the Access Token with Output Desk
1. Installing Instagram Plugin in Output Desk
- After successfully installing Output Desk as a service and verifying that it’s running in the browser, proceed to download the Instagram plugin code from instagram.zip.
- Extract the downloaded zip file.
- Go to the Output Desk package installation folder, create a folder named “plugins“, and navigate to that folder.
- Copy the Instagram folder into the “plugins” directory.
- After that, restart the Output Desk services.
2. Configuring Instagram Plugin in Output Desk
- Log in to Output Desk.
- Navigate to Settings > Channels > Instagram.
- Enter the following details:
- Access Token: Obtained from the Instagram Basic Display settings.
- App ID: Your Facebook App ID.
- App Secret: Your Facebook App Secret.
- Save the configuration.
- Restart Output Desk services to apply the changes.
- Output Desk will now process incoming Instagram messages and send replies to Instagram.