Instagram is a photo and video sharing social network. Publish posts and reels and manage comments on an Instagram professional account.
Categories: Social Media, Marketing Automation
Type: instagram/v1
Connections
Version: 1
OAuth2 Authorization Code
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| clientId | Instagram App ID | STRING | true | |
| clientSecret | Instagram App Secret | STRING | true |
Connection Setup
This component uses the Instagram API with Instagram Login. It works only with Instagram professional accounts (business or creator). Personal accounts cannot publish through the API.
Switch your Instagram account to a professional account
- In the Instagram app, open your profile and go to Settings and activity.
- Open Account type and tools and choose Switch to professional account.
- Pick Business or Creator and finish the steps.
Create a Meta app
- Go to Meta for Developers and click Create App.
- Choose the Business app type, or the use case Manage messaging and content on Instagram, and finish the steps.
- In the app dashboard, add the Instagram product and open API setup with Instagram login.
- Under Set up Instagram business login, add the ByteChef OAuth redirect URL as a valid redirect URL, for example
https://app.bytechef.io/callback. For a self-hosted instance usehttps://<your ByteChef host>/callback. - Copy the Instagram app ID and the Instagram app secret. Do not use the Facebook app ID and secret shown on the basic settings page.
- While the app is in development mode, add your Instagram account as an Instagram Tester under App roles, then accept the invitation in the Instagram app or on the Instagram website under Apps and websites.
Create the connection in ByteChef
- Paste the Instagram app ID into Instagram App ID and the Instagram app secret into Instagram App Secret.
- Keep the default scopes:
instagram_business_basicto read the account and its media.instagram_business_content_publishto publish images, carousels and reels.instagram_business_manage_commentsto read comments and reply to them.
- Click Connect and log in with your Instagram professional account.
Tokens
ByteChef exchanges the short-lived token from the login for a long-lived token that is valid for 60 days. Instagram does not issue a refresh token. To keep the connection working, reconnect it before the 60 days run out. Meta describes how long-lived tokens can be refreshed in its documentation.
App review
To use the connection with Instagram accounts that are not testers of your app, submit the app for App Review and request advanced access for the three permissions above.
Helpful links:
- Instagram API with Instagram Login: https://developers.facebook.com/docs/instagram-platform/instagram-api-with-instagram-login
- Content publishing: https://developers.facebook.com/docs/instagram-platform/content-publishing
Actions
Create Image Post
Name: createImagePost
Publishes a single image post to the connected Instagram professional account.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| imageUrl | Image URL | STRING | Public URL of the JPEG image to publish. Instagram downloads the image from this URL. | true |
| caption | Caption | STRING | Caption of the post. It can include hashtags and mentions. | false |
Example JSON Structure
{
"label" : "Create Image Post",
"name" : "createImagePost",
"parameters" : {
"imageUrl" : "",
"caption" : ""
},
"type" : "instagram/v1/createImagePost"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | ID of the published Instagram media. |
Output Example
{
"id" : ""
}Create Carousel Post
Name: createCarouselPost
Publishes a carousel post with 2 to 10 images to the connected Instagram professional account.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| imageUrls | Image URLs | ARRAY Items[STRING] | Public URLs of the JPEG images to publish, in the order they appear in the carousel. Instagram downloads each image from its URL. | true |
| caption | Caption | STRING | Caption of the post. It can include hashtags and mentions. | false |
Example JSON Structure
{
"label" : "Create Carousel Post",
"name" : "createCarouselPost",
"parameters" : {
"imageUrls" : [ "" ],
"caption" : ""
},
"type" : "instagram/v1/createCarouselPost"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | ID of the published Instagram media. |
Output Example
{
"id" : ""
}Create Reel
Name: createReel
Publishes a reel to the connected Instagram professional account. Waits until Instagram has finished processing the video, for up to about five minutes.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| videoUrl | Video URL | STRING | Public URL of the video to publish. Instagram downloads the video from this URL. | true |
| caption | Caption | STRING | Caption of the reel. It can include hashtags and mentions. | false |
Example JSON Structure
{
"label" : "Create Reel",
"name" : "createReel",
"parameters" : {
"videoUrl" : "",
"caption" : ""
},
"type" : "instagram/v1/createReel"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | ID of the published Instagram media. |
Output Example
{
"id" : ""
}Things to know
- Instagram processes the video before it can be published. The action checks the processing status every 30 seconds, up to 10 times, and publishes the reel as soon as it is ready.
- If Instagram reports an error or the video is still not ready after about five minutes, the action fails and nothing is published.
Get Comments
Name: getComments
Lists the comments on an Instagram media item of the connected account.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| mediaId | Media ID | STRING | ID of the Instagram media item whose comments to list. | true |
Example JSON Structure
{
"label" : "Get Comments",
"name" : "getComments",
"parameters" : {
"mediaId" : ""
},
"type" : "instagram/v1/getComments"
}Output
Type: ARRAY
Items Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | ID of the comment. |
| text | STRING | Text of the comment. |
| username | STRING | Username of the Instagram user who wrote the comment. |
| timestamp | STRING | ISO 8601 date and time when the comment was created. |
| like_count | INTEGER | Number of likes on the comment. |
| replies | OBJECT Properties{[{STRING(id), STRING(text), STRING(username), STRING(timestamp)}](data)} | Replies to the comment. |
Output Example
[ {
"id" : "",
"text" : "",
"username" : "",
"timestamp" : "",
"like_count" : 1,
"replies" : {
"data" : [ {
"id" : "",
"text" : "",
"username" : "",
"timestamp" : ""
} ]
}
} ]Reply to Comment
Name: replyToComment
Replies to a comment on a media item of the connected Instagram professional account.
Properties
| Name | Label | Type | Description | Required |
|---|---|---|---|---|
| commentId | Comment ID | STRING | ID of the comment to reply to. | true |
| message | Message | STRING | Text of the reply. | true |
Example JSON Structure
{
"label" : "Reply to Comment",
"name" : "replyToComment",
"parameters" : {
"commentId" : "",
"message" : ""
},
"type" : "instagram/v1/replyToComment"
}Output
Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| id | STRING | ID of the reply comment. |
Output Example
{
"id" : ""
}Triggers
New Comment
Name: newComment
Triggers when someone comments on one of the 10 most recent media items of the connected Instagram professional account.
Type: POLLING
Output
Type: ARRAY
Items Type: OBJECT
Properties
| Name | Type | Description |
|---|---|---|
| media_id | STRING | ID of the media item the comment was posted on. |
| id | STRING | ID of the comment. |
| text | STRING | Text of the comment. |
| username | STRING | Username of the Instagram user who wrote the comment. |
| timestamp | STRING | ISO 8601 date and time when the comment was created. |
| like_count | INTEGER | Number of likes on the comment. |
| replies | OBJECT Properties{[{STRING(id), STRING(text), STRING(username), STRING(timestamp)}](data)} | Replies to the comment. |
JSON Example
{
"label" : "New Comment",
"name" : "newComment",
"type" : "instagram/v1/newComment"
}Things to know
- The trigger checks the comments on the 10 most recent media items of the account. Comments on older posts are not picked up.
- Each comment fires the workflow once. The first check after the workflow is enabled only remembers the time, so comments written before that are skipped. When you test the trigger in the workflow editor, it returns the comments from the last three hours.
- Each comment in the output has a
media_idvalue with the ID of the post it belongs to.
What to do if your action is not listed here?
If this component doesn't have the action you need, you can use Custom Action to create your own. Custom Actions empower you to define HTTP requests tailored to your specific requirements, allowing for greater flexibility in integrating with external services or APIs.
To create a Custom Action, simply specify the desired HTTP method, path, and any necessary parameters. This way, you can extend the functionality of your component beyond the predefined actions, ensuring that you can meet all your integration needs effectively.
Additional Instructions
Before you start
- Only Instagram professional accounts (business or creator) are supported.
- Images must be JPEG files and videos must be reachable at a public URL. Instagram downloads the media from the URL, so links that need a login or that expire quickly do not work.
- Instagram allows up to 100 posts published through the API in a 24 hour period. A carousel counts as one post.
- Every action works on the Instagram account that was used to create the connection.
How to find a Media ID
- Use the New Comment trigger and look at the
media_idvalue in its output, or - Use the
idvalue returned by Create Image Post, Create Carousel Post or Create Reel.
How to find a Comment ID
Use the id value of a comment returned by Get Comments or by the New Comment trigger.
How is this guide?
Last updated on
Insightly
Insightly is a customer relationship management (CRM) software that helps businesses manage contacts, sales, projects, and tasks in one platform.
Intercom
Intercom is the complete AI-first customer service solution, giving exceptional experiences for support teams with AI agent, AI copilot, tickets, ...