Instagram APIs

🚧

API Endpoint and Authentication

  • Your API endpoint varies based on where your imiconnect account is hosted. Visit Know Your API Endpoint section to know more.

  • You can use either Service Key or JSON Web Tokens (JWT) for authentication. If you use both JWT authentication and Service Key in an API request, JWT authentication takes priority, and the Service Key is ignored.

❗️

API Access

This API is only available on an on-request basis. Please reach out to your support contact for enabling Instagram APIs.

Instagram

{
    "content": "A while back I needed to count the amount of letters that a piece of text in an email template had (to avoid passing any character limits). Unfortunately",
    "contentType": "TEXT",
    "from": "a_637921640978680000",
    "to": "7947908538583264",
    "callbackUrl": "https://requestinspector.com/inspect/01g1mv0mvndfpy19bc009tqvh6",
    "callbackData": "customerID123|1234|new_sale",
    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
    "notificationType": "REGULAR",
    "messagingType": "RESPONSE"
}
{
    "content": "hello",
    "contentType": "TEMPLATE",
    "from": "a_637921640978680000",
    "to": "7947908538583264",
    "callbackUrl": "https://my.website.com/callback",
    "callbackData": "customerID123|1234|new_sale",
    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
    "notificationType": "REGULAR",
    "messagingType": "RESPONSE",
    "template": [
        {
            "title": "Welcome!",
            "subtitle": "We have the right hat for everyone.",
            "imageUrl": "https://sample-videos.com/img/Sample-jpg-image-2mb.jpg",
            "defaultAction": {
                "type": "WEB_URL",
                "url": "https://www.originalcoastclothing.com"
            },
            "buttons": [
                {
                    "type": "web_url",
                    "url": "www.google.com",
                    "title": "View Website"
                },
                {
                    "type": "postback",
                    "title": "Start Chatting",
                    "payload": "DEVELOPER_DEFINED_PAYLOAD"
                },
                {
                    "type": "postback",
                    "title": "Start Chatting",
                    "payload": "DEVELOPER_DEFINED_PAYLOAD"
                }
            ]
        }
    ]
}
{
    "url": "https://www.learningcontainer.com/wp-content/uploads/2020/08/Sample-Image-file-Download.png",
    "contentType": "MEDIA",
    "from": "a_637921640978680000",
    "to": "7947908538583264",
    "callbackUrl": "https://requestinspector.com/inspect/01g6t5dkqvhr2fy7nwp60y17hn",
    "callbackData": "customerID123|1234|new_sale",
    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
    "notificationType": "REGULAR",
    "messagingType": "RESPONSE"
}
{
    "type": "like_heart",
    "contentType": "STICKER",
    "from": "a_637921640978680000",
    "to": "7947908538583264",
    "callbackUrl": "https://my.website.com/callback",
    "callbackData": "customerID123|1234|new_sale",
    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
    "notificationType": "REGULAR",
    "messagingType": "RESPONSE"
}'
{
    "content": "Please confirm to proceed.",
    "contentType": "TEXT",
    "from": "app-id",
    "to": "igsid",
    "callbackUrl": "https://my.website.com/callback",
    "callbackData": "customerID123|1234|new_sale",
    "correlationId": "de36bb32-3f5d-46c9-b132-15e010a80ccc",
    "notificationType": "REGULAR",
    "messagingType": "RESPONSE",
    "quickReplies": [
        {
            "type": "TEXT",
            "title": "Confirm",
            "payload": "confirm"
      
        },
        {
            "type": "TEXT",
            "title": "Cancel",
            "payload": "cancel"
        
        }
    ]
}

Instagram Text Message

Parameter

Type

Mandatory

Description

content

String

Yes

Specifies the message text. Note: Either text or attachment or sender_action is mandatory.

contentType

String

Yes

Specifies message type. Specify from the following:

  • TEXT
  • TEMPLATE
  • MEDIA
  • STICKER
quickRepliesJSONArrayNoSpecifies an option in the text message to reply back to the sender. When the quick reply is tapped, the message is sent with the option tapped. Once the message is sent, the options disappear.
fromStringYesYour Instagram app Id
toStringYesInstagram recipient Id i.e. igsid

Instagram Generic Template

Generic template allows you to send horizontal scrollable set of images with an option to configure short description and buttons to request input from the users. You can add up to 10 images per message.

Parameter

Type

Mandatory

Description

type

String

Yes

Specifies the type of the attachment. The options are:

  • image
  • audio
  • video
  • file
  • template

template

JSONObject

Yes

Specifies the payload of attachment. The parameters of payload are:

  • template_type: There are two types of templates:
    • generic
    • button
  • elements: Specifies the parameters of the selected template type in an array.
quickRepliesJSONArrayNoSpecifies an option in the text message to reply back to the sender. When the quick reply is tapped, the message is sent with the option tapped. Once the message is sent, the options disappear.

Buttons object

Parameter

Type

Mandatory

Description

title

String

Yes

Specifies the bubble title. It has a limit of 80 characters.

defaultAction.type

String

Yes

Specify as WEB_URL

defaultAction.url

String

Yes

Specifies the URL that is opened when bubble is tapped.

image_url

String

No

Specifies the bubble image.

subtitle

String

No

Specifies the bubble subtitle. It has a limit of 80 characters.

buttons

JSONArray

No

Specifies a set of buttons that appears as call-to-actions. You can add up to 3 buttons only. The parameters are:

  • type
  • title
  • url
  • payload

quickReplies

Quick Replies are buttons with some text that appears above the text composer. Users can tap on the button to respond to the message. Once the message is tapped, the options disappear. You can add up to 10 buttons. These buttons are useful to get a specific response from the users. You can configure buttons to have a plain text or a combination of text and image. You can also configure a button with location so that users can send geographic locations in the conversation. You can configure the button with a payload that can have custom data that will be sent back to the enterprises through a webhook.

ParameterTypeMandatoryDescription
content_typeStringYesSpecifies the type of content. Supported value: TEXT
titleStringYes.Specifies the caption for button. You can add up to 20 characters as title.
payloadStringYes.Specifies the custom data that will be sent back to you through web hook. The limit of this payload is 1000 characters.

Media

ParameterTypeMandatoryDescription
content_typeStringYesSpecify as MEDIA
urlStringYesURL of the image media file. The channel only supports image at the moment
quickRepliesJSONArrayNoSpecifies an option in the text message to reply back to the sender. When the quick reply is tapped, the message is sent with the option tapped. Once the message is sent, the options disappear.

Sticker

ParameterTypeMandatoryDescription
content_typeStringYesSpecify as STICKER
typeStringYesSpecify as 'like_heart'. The channel only supports like_heart sticker at the moment
quickRepliesJSONArrayNoSpecifies an option in the text message to reply back to the sender. When the quick reply is tapped, the message is sent with the option tapped. Once the message is sent, the options disappear.
Language
Authentication
Click Try It! to start a request and see the response here!