Introduction
This article explains how to set up Dalet Flex to publish content to Facebook. There are a number of stages to configuring and enabling the Dalet Flex-Facebook integration.
- Create a Facebook API app
- Generate an access token for your Facebook page
- Extend the access token lifetime
- Create a Publish to Facebook action
- Create an Unpublish to Facebook action
- Renew the Facebook token periodically
Creating a Facebook API App
For the first stage of the integration, you must create a facebook API App using the Facebook developers console.
1. Go to https://developers.facebook.com/apps/ and click Create App.
2. Set the App type as None.
3. In the details page, set your App name and add the email address of the logged in user. Click Create App.
4. Upon completing the app creation, you will be re-directed to the newly created APP’s settings page. If you have multiple apps already created under this account, select the newly created app as highlighted below ( 1 ). Then add the product Facebook Login to your newly created app by clicking the Set up button ( 2 ).
5. In the Dashboard screen, in the Facebook Login section, click Settings.
6. In the field Valid OAuth Redirect URIs enter the account URL for your environment together with the OAuth controller endpoint, as shown in the example below ( 1 ). Click Save Changes to continue ( 2 ).
https://demo.flex.daletdemos.com/facebookOAuthController
7. In the Settings section, select Basic. Copy your App ID and click the Show button to copy the App secret. Save these two values, you will need them when you configure the Flex integration at a later stage. To conform with Facebook requirements, you may need to provide a Contact email, Privacy Policy URL, Terms of Service URL and an App icon.
8. Click Save changes if you edit the Basic page.
Generate Access Token
To publish content to a Facebook page, Dalet Flex requires an access token as described in this section. The access token can be for a Page or for a User. This guide explains how to generate the access token for a Page.
1. From the Tools menu, select Graph API Explorer.
2. Select your Meta App and then select Get Token and Get Page Access Token.
Note: You can also select Get User Access token if you are posting to a Facebook User page.
3. You will be prompted to confirm the account logged in (1) and the page you want to integrate with (2).
4. Approve Read content and Show a list permissions.
5. Facebook links the apps and the page and sets public_profile permissions.
6. Upon completion, the Facebook page you linked to the newly create app is displayed in the User or Page dropdown list.
7. Select the Page from the list and add the required permissions one by one from the Add a Permission drop down list.
8. The following permissions are required:
- user_photos
- user_videos
- publish_video
- pages_manage_cta
- pages_show_list
- pages_read_engagement
- pages_manage_metadata
- pages_read_user_content
- pages_manage_ads
- pages_manage_posts
Once all permissions have been added one by one, the list of permissions is displayed in green.
9. Select your Meta App and your Facebook page in the User or Page section and click Generate Access Token.
10. Save the Access Token safely by clicking the copy button. You will need this in the next step when you extend the access token lifetime.
Extend the Access Token Lifetime
Now you must increase the Access Token validity period, since the initially generated token is only valid for an hour. Facebook allows extending the access token to 90 days (and no more). Follow the steps in the Renew the Facebook Token and Update the Publish to Facebook Action Periodically section once the Access Token expiry has passed.
1. From the Tools menu, select Access token debugger.
2. Paste the Access Token you saved earlier in the field and click Debug.
3. The summary page opens and shows information about your Facebook App. Save the Page ID, you need this information for the Dalet Flex configuration later.
4. Click the Extend Access token button. Facebook returns the Access Token with an updated validation period. Save this Access Token, you need it for the Dalet Flex configuration. Note down the expiry date to plan the renewal of the Access Token in advance.
Create a Publish to Facebook Action
To send an asset directly to Facebook from Dalet Flex you must create a Publish to Facebook action using the Publish plugin and add the information about your Facebook App. The Publish to Facebook action can be used to trigger a single job or it can be added to a workflow.
Prerequisites
You will need the information saved whilst creating your Facebook App.
- App ID
- App Secret
- Access Token ( extended validity )
- Page ID
1. In Flex Core, in the New drop down list, select Action.
2. In the Create new Action screen, give the action a name. In the Plugin Type select Publish and in the Plugin field, select Facebook Publish.
3. Click Save.
4. In the Configuration tab, click Edit.
5. In the:
- Client Id field, insert the App ID.
- Client Secret field, insert the App Secret.
- Access Token field, insert the extended validity Access Token.
- Object id field, insert the Page ID.
6. In the Publish Status field, select:
- Draft to publish assets in a draft state to Facebook. They must be made public from Facebook.
- Published to publish assets publicly to Facebook
7. Click Save to finish.
Create a Facebook Unpublish Action
You must also create a Facebook Unpublish action using the Unpublish plugin type, so that you can trigger jobs to remove assets that have previously been published to Facebook by Dalet Flex.
1. In Flex Core, in the New drop down list, select Action.
2. In the Create new Action screen, give the action a name. In the Plugin Type select Unpublish and in the Plugin field, select Facebook Unpublish.
3. Click Save to finish. No additional configuration is required.
4. Go to the Facebook Publish action you created and in the Details tab, click Edit and in the Undo Action field, select the Unpublish to Facebook action to connect it to the Publish action.
5. Click Save to finish.
Renew the Facebook Token and Update the Publish to Facebook Action Periodically
The extended validity Facebook Access Token supplied by Facebook is only valid for 3 months at a time. After this, you MUST renew it.
To renew the token go to : https://developers.facebook.com/apps/ and regenerate and extend the validity of the token in the same way as you created it originally as explained in the Generate Access Token and Extend the Access Token Lifetime sections above.
1. Once you have renewed the Facebook token, you must update your Publish to Facebook action in Dalet Flex.
2. In Flex Core, select your Publish to Facebook action.
3. In the Configuration tab, click Edit and paste the new Access Token in the Access Token field.
Comments
0 comments
Please sign in to leave a comment.