RingQ & Facebook Integration

Introduction


This guide explains how to set up the integration between RingQ and Facebook, enabling your team to manage Facebook messages and inquiries directly within the RingQ platform. By connecting your Facebook Page to RingQ, you can centralize communication, improve response times, and deliver a more seamless customer experience—all from one unified interface.

Creating a Permanent Access Token


If you already have a Facebook app that is classified as Business, you can skip to Steps 1-4. Otherwise, follow the steps below to create one.

Create a Business App

1. Go to the Facebook Developer Apps Dashboard.
2. Click on “Create App” to start the process of creating a new app.
3. When prompted to choose the app type, select Business and then select “Other” if no specific use case fits your needs.
4. Complete the necessary fields like the app name, contact email, and app purpose, then click “Create App”.

Configure the App for Business Use

Once your app is created, make sure you configure it correctly for business use by adding the necessary products and permissions, as explained later in this guide.

Generate the Token

1. From your app’s Settings panel, click on “System Users”. This is where you manage users for your app.
2. Click “Add”, then choose “Create”. You will need to choose whether this user will be an Admin.
3. After you have created the system user, click on the user’s name to open their details.
4. In the system user details page, click Generate Access Token.
5. During token generation, make sure to set the Expiration to “None” to ensure that the token does not expire. This is crucial for creating a permanent access token that does not require frequent renewal.

Verify Permissions

Ensure that your account and the system user have the correct permissions assigned to perform actions on your app or page. If you haven’t set up these permissions:
1. Go to Assign Assets from the system user’s settings.
2. Assign permissions such as Manage Pages, Publish Content, or any other permission relevant to your business needs.
3. After assigning the permissions, click “Save” to apply the configuration.

Once generated, the permanent access token can be used to interact with Facebook’s APIs for managing pages, posting content, retrieving insights, or performing other automated tasks. Since you’ve set it as non-expiring, it will remain valid indefinitely unless it is manually revoked.

Setting Up a Webhook App URL on Facebook


1. Access Facebook Developer Dashboard. Go to the Facebook Developer Apps Dashboard. This is where you can manage and configure your apps.
2. Select Your App. Once on the dashboard, you’ll see a list of your existing apps. Find and click on the app for which you want to set up a webhook. The App ID for each app will be displayed here.
3. Retrieve the App Secret Key

  • Navigate to the “Settings” section on the left sidebar.
  • Under Settings, click on “Basic”. Here, you’ll find the App Secret Key, which you’ll need for authentication purposes.

4. Obtain an Expiring Access Token. To get an expiring access token for API calls or testing, visit the Access Token Tool. Generate the token for the app you’re working on, but keep in mind that tokens expire after a certain period.
5. Create Your Webhook URL. Using a programming language that supports HTTP callbacks (such as Python, PHP, Node.js, etc.), create a Webhook URL. This URL will handle incoming requests from Facebook’s webhook system.
6. Add the Webhook Product

  • Go back to your Facebook app’s dashboard.
  • In the left sidebar, click Add Product, and from the list, locate Webhooks. Click on it to add the Webhook feature to your app.

7. Configure the Webhook

  • After adding the Webhook product, you can now configure it.
  • Attach your callback URL (the one you created in step 5). Facebook will send a verification request to this URL to confirm that it is valid.
  • In the process, you will also need to generate your App Token (see section above) and provide the necessary subscription fields (e.g., user profile updates, page events) that your webhook will listen to.

8. Verify and Activate the Webhook
Once you submit the callback URL and select the necessary subscriptions, Facebook will verify the webhook by sending a challenge request to the callback URL. Ensure your server responds correctly to this verification. Once verified, your webhook will be live and ready to receive event notifications.

Setting Up a Webhook for Messenger


1. In your Facebook Business Settings, ensure that you have accepted all the necessary permissions for managing your Facebook pages and Messenger. This includes permissions for Send Messages, Receive Messages, and other required messaging actions
2. Add Messenger as a Product. If you don’t see Messenger listed as a product in your app:

  • Click Add Product in the left sidebar and locate Messenger.
  • Click Set Up to add Messenger as a product for your app.

3. Set Up Webhook for Messenger
4. After adding Messenger, go to the Messenger settings under your app’s products.
5. In the Webhook section, you can configure or update the Webhook URL that will handle Messenger events like message deliveries, message reads, and customer interactions.

Note: Certain permissions are required for setting up and changing the webhook URL. These permissions may take up to 5 days to be validated by Facebook, so plan accordingly.

Generate and Store the Token

1. Facebook will generate a Webhook Token that you’ll use to validate your webhook setup.
2. Ensure that you store this token securely, as you will need it during the verification process to confirm that Facebook’s webhook requests are legitimate.
3. Verify Permissions

  • If you encounter issues with permissions (e.g., not being able to send or receive messages), you can request additional permissions through the Business Settings page.
  • Double-check that you have enabled permissions for Send Messages and Receive Messages for the pages connected to Messenger.

Pass Necessary Requirements for Messenger


Messenger requires permissions to send and receive messages. Ensure that these permissions are enabled through the Messenger Settings in your app.

Configuring the Facebook Integration


1. Open your browser and go to RingQ Cloud App.
2. Log in using your account credentials.
3. Once logged in, navigate to the Dashboard by clicking the first icon located at the top of the sidebar on the left-hand side of the screen.
4. From the Dashboard, navigate to Settings.
5. Under Settings, click on Global to access the global configuration options.
6. Within Global Settings, navigate to Chat Settings. This is where you will configure the integration for both Facebook and WhatsApp.
7. Copy the Callback URL for Facebook
In the Chat Settings section, you will find a field labeled Facebook Callback URL. Copy the URL from this page.
8. Paste the Callback URL into Facebook Developer Settings

  • Log in to your Facebook Developer account.
  • Navigate to the Webhooks section of your app (you can find this under the app’s products if you’ve added Facebook as a product).
  • Paste the callback URL into the relevant field on the Facebook Webhook settings page.

9. Retrieve the Page ID

  • To connect your Facebook page, you’ll need your Page ID. You can find it by going to your Facebook Business account and navigating to Business Settings.
  • Copy the Page ID and paste it into the Facebook Page ID field in the Chat Settings section of the app.

Verify Facebook Integration

1. Once you’ve set up the callback URL and entered the Page ID, test the integration by initiating a chat through the connected Facebook account.
2. Make sure that messages sent through the Facebook page are being received and handled in your app’s chat system.