Connect your Facebook Pages, send and receive messages from Facebook’s 1.3 billion users.
This document provides a step by step guide to integrate Facebook with your Airy Core Platform instance.
What you will learn
- The required steps to configure the Facebook source
- How to connect a Facebook page to Airy Core
The Facebook Messenger source is not enabled by default.
You need to add configuration in your airy.yaml file and apply it to activate it.
The Facebook source requires the following configuration:
- Connect a Facebook page to your instance
- Connect a Facebook source via API request
- Connect a Facebook source via the UI
- Send messages from a Facebook source
Let's proceed step by step.
To connect a page, you must have an approved Facebook app. If you don't have one, you must register and create a Business app on Facebook for Developers.
All of your registered apps are listed on developers.facebook.com/apps.
The dashboard of each registered app can be found on:
On your application's dashboard, note down the
App ID of your application and then head to the Basic Settings page.
You will find your
App Secret on this page:
Copy and paste your App ID and App Secret as strings next to
components/sources/facebook in your
Facebook must first verify your integration with a challenge to start sending events to your running instance. To verify your Facebook webhook integration, set the value next to
components/sources/facebook in your
airy.yaml file, to a value of your choice.
You are now ready to configure the webhook integration. Click on the + icon next to "Products" on the left sidebar of your app's dashboard: scroll down, a list of products will appear.
Click on the button 'Set Up' on the Webhooks product card.
This will add the Webhooks as one of your app's products and will lead you to the Webhooks product page.
Select 'Page' from the dropdown (the default is 'User') and click on the button 'Subscribe to this object'.
This will open a modal box: add your Callback URL (your instance's Facebook Webhook URL) and Verify Token (the webhookSecret you added in your
airy.yaml file in the previous step).
Your Facebook Webhook URL should have the following format:
or if you are using Ngrok:
If you encounter errors, please make sure that the Verify Token matches the
webhookSecret in your
airy.yaml file and that your variables have been
successfully set to your Airy Core instance.
Once the verification process has been completed, Facebook will immediately start sending events to your Airy Core instance.
Go to the Products page (click on the + icon next to Products on the left sidebar).
Click the 'Set Up' button on the Messenger product card.
This will add Messenger as one of your app's products and will lead you to the Messenger product page.
Notice that at the bottom of the page, the Webhooks product has been added with the variables you gave at the previous step.
Click on the blue button 'Add or Remove Pages' and select your page.
Once your page has been added, scroll down and click on the button 'Add Subscriptions'.
This opens a modal box: tick 'messages' and 'messaging_postbacks' from the Subscription Fields list.
Next, scroll up, and click on the button 'Generate Token'.
This will open a pop-up revealing your page Access Token. Copy it, you will need it to connect the Facebook page to your instance.
Success! You are now ready to connect a Facebook page to your Airy Core instance 🎉
There are 2 options to connect a Facebook source to your instance:
- you can connect the source via an API request (using curl or platforms such as Postman)
- you can connect the source via the UI
We cover both options in this document.
The next step is to send a request to the Channels endpoint to connect a Facebook page to your instance.
Connect a Facebook source to your Airy Core instance through the Channels endpoint
Connects a Facebook page to Airy Core.
page_idis the Facebook page ID
page_tokenis the page Access Token
nameis the custom name for the connected page
image_urlis the custom image URL
If you encounter errors, please follow this debugging advice:
Make sure the credentials you have added to the airy.yaml file (refer back to step 1) have been applied to your Airy Core instance.
Verify your webhook integration (refer back to step 2). Make sure your Facebook Webhook URL has been correctly added on your app's dashboard. You should edit the 'Page' subscriptions for the Webhooks and Messenger product each time you create a new instance. Make sure that you have selected 'Page' subscription and not 'User' (which is the default).
You can connect a Facebook source via your Airy Core instance UI.
On your instance's Airy Core UI, click on 'Channels' on the left sidebar menu and select the Facebook channel. Add your Facebook Page ID and Page Access Token in the respective fields. You can optionally add a name and an image.
Your can find your Facebook Page ID and Page Access Token on your app's dashboard on Facebook For Developers: the Facebook Page ID is the ID of the page you want to connect and the Page Access Token is generated on the Messenger product section (refer back to the previous steps).
Make sure the variables have been successfully applied to your instance, otherwise you won't be able to connect the Facebook channel through the UI.
To test this you can now send a message to Facebook page.
Once a conversation has been successfully created, you will be able to send messages through the Messages endpoint.
Send messages to your Airy Core instance from different sources through the Messages endpoint
Sending a text message
Now that you connected this source to your instance and started a conversation, you can see the conversations, messages, and templates in the Airy Inbox, and use it to respond to the messages.
Receive messages from different sources and send messages using the Inbox UI