# Set up a Facebook Channel

A Facebook channel links a Facebook Page to Cloud Voice, letting your agents read and answer Messenger conversations directly from the system. Setting it up spans two places: you build and configure a Meta app on the Meta for Developers portal, then create a matching channel in the Cloud Voice portal and connect the two with a webhook (a URL that Meta calls automatically whenever your Page receives a new message).

Work through the four steps in order, keeping the credentials you copy along the way close at hand.

## Step 1. Create a Meta app

Start on the Meta for Developers portal by registering an app for the integration.

1. Sign in to the [Meta for Developers portal](https://developers.facebook.com), then open **My Apps** from the top menu.

   ![Meta for Developers landing page with the My Apps menu](/images/pbx/meta-for-developers-myapp-facebook.png)

2. Click **Create App** in the top-right corner.

   ![Create App button on the My Apps page](/images/pbx/create-facebook-app.png)

3. Under **App details**, fill in an app name and a contact email, then click **Next**.

   
   ![Cloud Voice, app details form with name and contact email fields](/images/pbx/facebook-select-business-account.png)

4. Under **Use cases**, choose **Other**, then click **Next**.

   ![Use case selection with the Other option chosen](/images/pbx/facebook-use-case.png)

5. For **App type**, select **Business**, then click **Next**.

   ![App type selection showing the Business option](/images/pbx/facebook-app-type.png)

6. Under **App details**, pick the Meta business portfolio you want to use.

   
   ![Cloud Voice, business portfolio selection for the app](/images/pbx/facebook-app-details.png)

7. Click **Create app**.

   The app is created and Meta takes you to the **App Dashboard**.

## Step 2. Set up the Meta app

Next, add the Messenger platform to the app and gather the three credentials Cloud Voice needs: an access token, the App Secret, and your Page's name and ID.

:::caution
The access token and App Secret are sensitive credentials. Anyone who has them can read and send messages as your Facebook Page, so treat them like passwords: copy them somewhere secure, do not share them, and avoid leaving them in email or chat.
:::

1. On the **Add products to your app** page, click **Set up** on **Messenger**. Meta opens the Messenger API configuration page.

   ![Add products page with the Set up action on Messenger](/images/pbx/facebook-setup-messenger.png)

2. Connect the app to your Facebook Page and generate an access token.

   a. Scroll to the **2. Generate access tokens** section and click **Connect** to add your Facebook Page.

      
      ![Cloud Voice, Connect button in the Generate access tokens section](/images/pbx/connect-facebook-pages.png)

      Refresh the page; your Facebook Page now appears as connected.

      
      ![Cloud Voice, the connected Facebook Page listed after refreshing](/images/pbx/facebook-page-added.png)

   b. Generate an access token. This authorizes the app to act on behalf of the Page.

      :::note
      Copy the access token and keep it somewhere safe. You will paste it into Cloud Voice later.
      :::

      
      ![Cloud Voice, generated access token for the Facebook Page](/images/pbx/facebook-generate-access-token.png)

   c. Copy and note down your Facebook Page's name and ID as well; both are required in Cloud Voice.

      ![Facebook Page name and ID shown in the token panel](/images/pbx/facebook-page-name-id.png)

3. Retrieve the app's secret key.

   a. In the left navigation, go to **App settings > Basic**.

   b. Click **Show** next to the **App secret** field to reveal the key.

      
      ![Cloud Voice, App secret field with the Show control](/images/pbx/facebook-app-secret.png)

   c. Copy the revealed key and note it down for use in Cloud Voice.

      
      ![Cloud Voice, revealed App secret ready to copy](/images/pbx/facebook-show-app-secret.png)

## Step 3. Create a Facebook channel

Now create the channel in Cloud Voice using the credentials you collected.

1. Sign in to the Cloud Voice portal and go to **Messaging > Message Channel**.

2. Click **Add** and choose **Facebook Messenger**.

3. On the **Authentication** tab, supply the Facebook details.

   
   ![Cloud Voice, Facebook channel authentication tab](/images/pbx/facebook-auth-setting-pce.png)

   - **Name**: A label that helps you recognize the channel.
   - **Webhook URL**: Note this value down. You will paste it into the Meta portal in Step 4.
   - **Verify Token**: Note this value down as well; it is also needed in Step 4.
   - **Access Token**: Paste the access token you generated in Step 2.
   - **App Secret**: Paste the App Secret you retrieved in Step 2.
   - **Page ID**: Paste your Facebook Page ID from Step 2.
   - **Page Name**: Paste your Facebook Page name from Step 2.

4. On the **Messaging Settings** tab, configure how the channel behaves.

   ![Cloud Voice, Facebook channel messaging settings tab](/images/pbx/configure-facebook-page.png)

   - **Destination for Inbound Messaging**: Decide where incoming messages from the Page are routed.

     | Option | Description |
     | --- | --- |
     | Extension | Choose an extension from the **Extension** list. Only that extension user receives inbound messages from the Page. |
     | Message Queue | Choose a queue from the **Message Queue** list. Every agent in the queue sees the first message of a new session, but once an agent picks it up, only that agent receives and replies to the rest of that session. |
     | Third-Party Message Analytics Platform (Transmitted via API) | Inbound messages are forwarded automatically to a third-party analytics platform over the API (Application Programming Interface) for further processing. |

     :::note
     Forwarding to a third-party analytics platform only works if your Cloud Voice server is already integrated with that platform through the Cloud Voice API. Once this option is on, inbound messages are transmitted automatically; you can track them by monitoring the New Message Notification API event, and the platform can use the Cloud Voice Message API for richer interactions.
     :::

   - **Close Session Automatically**: Optional. Select this checkbox to have the system end sessions that stay idle for a set time, then enter the number of days in the **Session Timeout (Days)** field.

5. Click **Save**.

## Step 4. Set up Meta webhook

Return to the Meta for Developers portal to point the app's webhook at Cloud Voice and subscribe to message events, so Cloud Voice is notified whenever the Page receives a message.

1. Open the Messenger API configuration page for your app.

2. In the **1. Configure webhooks** section, add a webhook and subscribe to the **messages** field.

   a. Click **Configure** to add the webhook.

      
      ![Cloud Voice, webhook configuration dialog with callback URL and verify token fields](/images/pbx/facebook-verity-webhook-pce.png)

      - **Callback URL**: Paste the Webhook URL you noted from Cloud Voice in Step 3.
      - **Verify Token**: Paste the verify token you noted from Cloud Voice in Step 3.

      :::caution
      The Callback URL and Verify Token must match exactly what Cloud Voice generated in Step 3. If either value is wrong, Meta cannot verify the webhook and messages from your Page will never reach Cloud Voice.
      :::

   b. Click **Manage** and subscribe to the **messages** field.

      
      ![Cloud Voice, webhook field subscription showing the messages event](/images/pbx/facebook-app-webhook-pce.png)

3. In the **2. Generate access tokens** section, click **Add Subscriptions** and subscribe your Facebook Page to the **messages** field.

   
   ![Cloud Voice, Add Subscriptions control for the Page's messages field](/images/pbx/facebook-subscribe-webhook.png)

## Result

- In the Cloud Voice portal, the channel's **Status** shows a green connected indicator (![connected](/images/pbx/trunk-ok.png)), confirming the Facebook channel is set up.

  ![Facebook channel listed with a connected status](/images/pbx/facebook-channel-ok.png)

- Cloud Voice keeps a running count of messages sent and received on the channel. The **Total** column reflects every outbound message, including both successful and failed sends.

  :::tip
  Use the time filter to narrow the statistics to a specific date range.
  :::

  ![Message activity report for the Facebook channel](/images/pbx/facebook-message-report.png)

## What to do next

Test message delivery between your Facebook Page and Cloud Voice, then [submit your app for review](/pbx/contact-center-guide/submit-app-for-review/).
