Add bot to Facebook

Important

Power Virtual Agents capabilities and features are now part of Microsoft Copilot Studio following significant investments in generative AI and enhanced integrations across Microsoft Copilot.

Some articles and screenshots may refer to Power Virtual Agents while we update documentation and training content.

You can add your bot to Facebook Messenger to use the Facebook experience to engage with your end users.

Facebook Messenger and related services are subject to Facebook's own terms and conditions. For support related to Facebook Messenger, contact Facebook directly.

Important

This article is intended for experienced IT professionals who manage your organization's Facebook page.

Note

By publishing your bot to a Facebook page, some of your data such as bot content and end-user chat content will be shared with Facebook (meaning that your data will flow outside of your organization's compliance and geographic or regional boundaries).
For more information, see Facebook's Platform Policies.

Add bot to Facebook Messenger

You need a Facebook app, and an associated developer account, to connect your Microsoft Copilot Studio bot to Facebook Messenger on your Facebook pages.

These are the steps involved in this process:

  1. Configure Facebook app settings: retrieve your Facebook app information, enable API access, add Facebook Messenger to your app, and configure the Facebook pages your app should appear on.

  2. Configure the Facebook publication channel in Microsoft Copilot Studio.

  3. Connect your Facebook app to Microsoft Copilot Studio using webhooks.

You will then need to submit your app for Facebook review before you can publish your app and make it public.

Configure Facebook app settings

Retrieve Facebook app information

  1. Sign in to the Facebook app that you want to add your bot to at Facebook for Developers.

  2. Under Settings on the side menu pane, select Basic .

  3. Copy the App ID and App Secret. You will need these when you configure the Facebook channel in Microsoft Copilot Studio.

    Get Facebook App ID and secret.

Enable API access for your Facebook app

  1. Sign in to the Facebook app that you want to add your bot to at Facebook for Developers.

  2. Under Settings on the side menu pane, select Advanced.

  3. Make sure Allow API Access to App Settings is set to Yes.

  4. Select Save Changes to confirm your changes.

    Allow API Access to App Settings.

Add Facebook Messenger to your app

  1. Sign in to the Facebook app that you want to add your bot to at Facebook for Developers.

  2. Go to the Dashboard. Under the Add a Product section, select Set Up on the Messenger tile.

    Add Messenger product.

Configure Facebook pages

  1. Sign in to the Facebook App that you want to add your bot to at Facebook for Developers.

  2. Select Settings under Products and Messenger on the side menu pane.

  3. Add the pages you want to add the bot to by selecting Add or Remove Pages under the Access Tokens section. You can also create a new page by selecting Create New Page.

    Add Facebook page to Facebook app.

  4. When adding pages, make sure Manage and access Page conversations in Messenger is set to Yes.

    Messenger permission for page.

  5. Copy the Page ID and Token for each of the pages that you want to add the bot to. You'll need to select Generate Token for each page. You'll need these when you configure the Facebook channel in Microsoft Copilot Studio.

    Get page ID and token.

Configure the Facebook channel in Microsoft Copilot Studio

  1. In Microsoft Copilot Studio, in the navigation menu under Settings, select Channels.

  2. Select the Facebook tile to open the configuration window.

    Facebook channel.

  3. Paste the App ID, App Secret, Page ID, and Token you retrieved earlier into their corresponding fields.

    Provide Facebook app and page information.

  4. At least one page is required, but you can select Add Page to add additional pages.

    Provide multiple Facebook pages' information.

  5. Select Add and wait for the success confirmation message. Once successful, copy the Callback URL and Verify token. You'll need these when you connect your Facebook app to Microsoft Copilot Studio.

    Get callback information for Facebook.

Connect your Facebook app to Microsoft Copilot Studio

  1. Sign in to the Facebook app that you want to add your bot to at Facebook for Developers.

  2. Select Settings under Products and Messenger on the side menu pane.

  3. Under the Webhooks section, select Add Callback URL.

    Set up webhooks for Facebook app.

  4. Provide the Callback URL and Verify token from the Configure the Facebook channel in Microsoft Copilot Studio section and select Verify and Save.

    Add Callback URL and Verify Token.

  5. Select Add Subscriptions for each page that you want to add the bot to.

    Add webhook subscription.

  6. Select the following fields:

    • messages
    • messaging_postbacks
    • messaging_optins
    • message_deliveries
  7. Select Save.

    Add webhook subscription fields.

Submit for Facebook review

You need to submit your app for Facebook review before you can make your Facebook app public. Facebook requires a Privacy Policy URL and Terms of Service URL. You need to provide those on the Facebook basic app settings page (after signing in to your app at Facebook for Developers, select Basic under Settings on the side menu pane).

The Code of Conduct page contains third-party resources to help create a privacy policy. The Terms of Service page contains sample terms to help create an appropriate Terms of Service document.

Facebook has its own review process for apps that are published to Messenger. You can learn more about it at Sample submissions and Common rejection reasons. Your bot will be tested to ensure it is compliant with Facebook's Platform Policies before approved by Facebook to become public.

Make the app public and publish the page

Until the app is published, it is in Development Mode. The bot will not be public and it will work only for admins, developers, and testers.

After the review is successful, in the app's Dashboard under App Review, set the app to Public. Ensure that the Facebook Page associated with the bot is published. The status appears in the Pages settings.

Remove your bot from Facebook Messenger

When you do not want the bot to be reachable in Facebook Messenger, you can remove the bot from Facebook.

  1. In Microsoft Copilot Studio, in the navigation menu under Settings, select Channels.

  2. Select the Facebook tile and then Delete.

    Delete Facebook channel.

Updating bot content for existing conversations on Facebook

To prevent disruptions during a chat between a user and the bot, existing conversations will not be updated to the latest bot content immediately after a new publish. Instead, the content will be updated after the conversation has been idle for 30 minutes.

New conversations between user and the bot will have the latest published bot content.

Known limitations

  • You will need to create a new bot if the Customer Satisfaction (CSAT) survey shows up as a non-interactable card image for a bot created during public preview to access the latest CSAT content.
  • It might take a few minutes before the bot becomes reachable by users on Facebook pages after the Facebook channel is added.
  • After removing the Facebook channel, it might take a few minutes before the bot is removed fully and becomes unreachable on Facebook Messenger.
  • After removing a Facebook page, it might take a few minutes before the bot becomes unreachable by visitors to the removed page through Facebook Messenger.