# Facebook Messenger channel testing and channel management The following sections provide information on testing and managing the Facebook Messenger channel of your Conversation API app. ## Testing the integration To test the integration after setting up a Facebook Messenger channel on your Conversation API app: 1. Add a webhook to your Conversation API **app** using the [Sinch Build Dashboard](https://dashboard.sinch.com/convapi/overview), or the API itself, if you haven't done so already. For more information on how to do this using the Sinch Build Dashboard, see [How to add a webook to a Conversation API app](https://community.sinch.com/t5/Conversation-API/How-to-add-a-webhook-to-a-Conversation-API-app/ta-p/8100). Below is an example of how to create the webhook programmatically: ```json { "app_id": "{{APP}}", "target": "{{WEBHOOK_URL}}", "target_type": "HTTP", "triggers": [ "MESSAGE_DELIVERY", "EVENT_DELIVERY", "MESSAGE_INBOUND", "EVENT_INBOUND", "CONVERSATION_START", "CONVERSATION_STOP", "UNSUPPORTED" ] } ``` 2. An end-user must start the conversation. This creates a contact which can be used as a recipient in the Facebook Messenger channel. To send a message, visit your Facebook Page as a user with adequate permissions (for example, the user who created the Page) and try sending a message to the Page. You should receive two callbacks, one with `conversation_start_notification`: ```json { "app_id": "01E9DQJFPWGZ2T05XTVZAD0BYB", "conversation_start_notification": { "conversation": { "id": "01E9DV2N8C6CK41XFPGQPN0NWE", "app_id": "01E9DQJFPWGZ2T05XTVZAD0BYB", "contact_id": "01E9DV2N7TYPJ50V0FYC08110D", "last_received": "2020-05-28T14:30:48Z", "active_channel": "CHANNEL_UNSPECIFIED", "active": true, "metadata": "", "active_channel_senders": [] } } } ``` and one with the message you've just sent: ```json { "app_id": "01E9DQJFPWGZ2T05XTVZAD0BYB", "accepted_time": "2020-05-28T14:30:47.850538Z", "project_id": "ab5536b1-31b0-45e8-aec6-b35f13c41d0b", "message": { "id": "01E9DV2N92BMDD034JZ0AQ0VKB", "direction": "TO_APP", "contact_message": { "text_message": { "text": "Hello World" } }, "channel_identity": { "channel": "MESSENGER", "identity": "3630555555589", "app_id": "01E9DQJFPWGZ2T05XTVZAD0BYB" }, "conversation_id": "01E9DV2N8C6CK41XFPGQPN0NWE", "contact_id": "01E9DV2N7TYPJ50V0FYC08110D", "metadata": "", "accept_time": "2020-05-28T14:30:47.841429Z" }, "message_metadata": "" } ``` 3. With a conversation created automatically, you can use the received `contact_id` to send a response to the user: ```json { "app_id": "{{APP_ID}}", "recipient": { "contact_id": "{{CONTACT_ID}}" }, "message": { "text_message": { "text": "Text message from Sinch Conversation API." } }, "channel_priority_order": ["MESSENGER"] } ``` 4. You should receive callbacks with information that the message has been delivered and read. Successfully sending a message to the user indicates that the channel is configured correctly. ## Removing the Facebook Messenger integration To completely delete the Messenger integration, you need to remove the integration from the Conversion API using the [Sinch Build Dashboard](https://dashboard.sinch.com/login): 1. Navigate to your Conversation API **app** and select the Facebook Messenger channel. 2. Click the Reset Integration button to detach your Facebook page from the Conversation API: ![Messenger Channel Setup](/assets/resetintegration.3df89235c147c2ed7e32362fe0846c507dabe639fe14e0d6fdc2cbd5bc2adfca.d0f1d71a.png) 3. The permissions you have granted to the Conversation API app can only be revoked from your Facebook account. Follow this [guide](https://www.facebook.com/help/405094243235242) to revoke the permissions granted to the Conversation API app. If you have multiple pages connected to the Conversation API app, make sure you only revoke the permission for the Page you are detaching from Conversation API.