Instagram channel testing and management

The following sections provide information on testing and managing the Instagram channel of your Conversation API app.

Testing the integration

To test the integration after setting up an Instagram channel on your Conversation API app:

  1. Add a webhook to your Conversation API app using the Sinch Customer Dashboard , or the API itself, if you haven't done so already. For more information on how to do this using the Customer Dashboard, see How to add a webook to a Conversation API app . Below is an example of how to create the webhook programmatically:
    Copy
    Copied
    {
      "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 Instagram channel. To send a message, visit your Instagram profile as a user with adequate permissions (for example, the user who created the corresponding Facebook Page) and try sending a message to the profile. You should receive one callback with the message you've just sent:
    Copy
    Copied
    {
    "app_id": "01F6T8M717SPW0186EC5A90Z0E",
    "accepted_time": "2021-05-30T21:57:05.043890Z",
    "event_time": "2021-05-30T21:57:04.198Z",
    "project_id": "5b7c830f-4183-4275-a028-13e40c98e29e",
    "message": {
        "id": "01F6ZMFKRHKW7E0P58M9VM041G",
        "direction": "TO_APP",
        "contact_message": {
        "text_message": {
            "text": "Hello World Instagram"
        }
        },
        "channel_identity": {
        "channel": "INSTAGRAM",
        "identity": "3964920326927846",
        "app_id": "01F6T8M717SPW0186EC5A90Z0E"
        },
        "conversation_id": "01F6T8NG7D6M3Y0DT0RMDP1KFE",
        "contact_id": "01F6T8NG3ZWF460K28RHAM1DHW",
        "metadata": "",
        "accept_time": "2021-05-30T21:57:04.981939Z"
    }
    }
  3. With a conversation created automatically, you can use the received contact_id to send a response to the user:
    Copy
    Copied
    {
      "app_id": "{{APP_ID}}",
      "recipient": {
        "contact_id": "{{CONTACT_ID}}"
      },
      "message": {
        "text_message": {
          "text": "Text message from Sinch Conversation API."
        }
      },
      "channel_priority_order": ["INSTAGRAM"]
    }
  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 Instagram integration

To completely delete the Messenger integration, you need to remove the integration from the Conversion API using the Sinch Customer Dashboard:

  1. Navigate to your Conversation API app and select the Instagram channel.
  2. Click the Reset Integration button to detach your Facebook Page from the Conversation API:

    Messenger Channel Setup

  3. The permissions you have granted to the Conversation API app can only be revoked from your Facebook account. Follow this guide to revoke the permissions granted to the Conversation API app. If you have multiple Instagram business accounts connected to the Conversation API app, make sure you only revoke the permission for the Page you are detaching from Conversation API.
Was this page helpful?