Instagram API: The Ultimate Guide
Instagram API: The Ultimate Guide
Instagram has grown in popularity in the last decade. With over 1 billion users, it’s one of the most popular social media apps we have. A testament to this photo- and video-sharing app’s prevalence and power is that Instagram is now officially a verb!
But what does it mean for a business? Approximately 150 million individuals interact with businesses on Instagram. If you want to get closer to your users and engage with them meaningfully, this is your platform.
Being the social media marvel that it is, Instagram has many APIs (application programming interface) that allow you to connect your Instagram account with third-party apps. These APIs make it easier for you to engage and support your customers.
- Top 12 Instagram statistics you should know about
- Why is Instagram important for businesses?
- What is an API? Explained with an example
- What is an Instagram API?
- Graph API
- Basic Display API
- Messaging API
- How to use Instagram APIs (with examples)
- Using Instagram API – The best practices
Before we go into the details of what APIs you can use and how to use them, let’s understand why businesses should be on Instagram.
Psst: If you want to skip this and read about APIs, you can jump to that section by clicking here.
Top 12 Instagram statistics you should know about
Since its launch, Instagram has become the public’s favourite platform to connect with their friends, family, celebrities, thought leaders and brands. Below we give you a dozen stats that show just how mainstream is Instagram for business.
1. Instagram is among the top 5 most downloaded apps in 2020. In the second quarter of 2020 alone, the app was downloaded around 13 million times.
2. An average Instagram user clocks in at least seven hours per week on the platform. When users are frequently logging in, brands have higher visibility and engagement rates.
3. Another stat on usage. 63% of Instagram users check the app at least once a day and 42% open it multiple times a day. (Yes, we are addicted to good photos and videos.)
4. 90% of people on Instagram follow a business. Here’s an opportunity for your brand to showcase and sell your products/services as well as support customers.
5. And we aren’t talking about just B2C brands. 46% of B2B marketers have used Instagram to engage with their audience. Slowly and steadily, it’s staging its claim for business and SaaS marketers.
6. Coming to what kind of posts users engage with, carousel posts have seen the highest engagement with 1.94%, followed by images (1.74%) and videos (1.45%).
7. Stories are another type of media users engage in. Instagram’s research goes on to show that 500+ million people use stories daily and 1/3rd of the MOST-VIEWED stories come from brands.
Brands have more to look forward to.
8. Over 130 million users engage with shopping posts on a monthly basis.
9. Instagram’s influence game is so strong that 50% of people have made a purchase off-platform after seeing a product on the brand or an influencer’s stories. Stories also seem to improve brand recall.
10. 1 out of every 100 followers of a business account engages with a post. That’s about .96%. It might not seem like a lot, but it’s definitely much higher than what Facebook and Twitter see (around 0.1%).
11. To make things interesting for brands, 81% of users have used Instagram to research a brand’s products and services. Now you see why you should be on this app? It’s an opportunity for you to show relevant information about your product.
12. It doesn’t stop there. 75% of users will definitely take action on at least one ad at some point. That means, if you run campaigns on Instagram, you are surely going to see results that will help you connect with your audience.
These statistics prove that Instagram is a big customer engagement powerhouse. Videos and photos generally have higher appeal and Instagram users are more willing to engage with brands here than on other platforms.
Now that we’ve backed our claim with numbers, let’s see what benefits brands can see and how they can leverage Instagram to engage, sell and support customers better.
Go back to the table of content →
Why is Instagram so important for businesses?
From the above data, it’s clear that Instagram is possibly one of the best platforms for businesses to sell products and services.
With payment methods easily available on social media platforms, Social Commerce is picking up. Instagram’s key feature of sharing images and videos has made it one of the most used platforms to shop.
But it can do more than that for a brand. Improving customer’s post-purchase experience is also important. With the Instagram Messaging API, that too is now possible at scale.
There are other features too that make this platform a go-to app. Customers have full freedom to like, comment, share, and give their opinions on your product and services on the platform.
Instagram also provides valuable analytics to business accounts to help understand consumers’ behaviour, emotions and pain points. With an excellent assortment of services, features, and tools, Instagram assists your business by providing the best techniques to achieve optimum customer satisfaction.
Here we have mentioned some of the benefits of using Instagram for business.
1. Increase reach and expand your market
Instagram has reported that its platform has around 1 billion active users. Amongst these 1 billion users, over 400-500 million users open the platform every day. With free access to this huge pool of people, a business can increase its visibility and reach greater heights. As we had mentioned earlier, it also improves brand recall.
And if people are hanging out here and buying from the brands, they will also come here to seek support. With a proper strategy, businesses can not only showcase their products and services in the best light but also provide delightful customer support to these customers.
2. Multiple features to connect with your users
Customers look for many things in a brand and trust is on top of the list. So when seeing a post from you, they’d want to know more When they visit your profile, the first thing they see is your bio. You can use it to show your brand’s offerings, your website link.
Customers seeking support can check contact details too.
You can use regular posts as images or videos to showcase your products and services. In addition to this, you have stories, highlights, reels, IGTV, and Instagram Live. With a mix of photos and videos (most consumed content format), you can engage with a wide range of audience demographics.
Sometimes, customers prefer to find solutions to their product or service-related issues by themselves rather than contacting the support staff of businesses. For this, they constantly look for relevant responses on the web. This is where Instagram’s self-service option comes into play.
One of the methods you can use is Stories. You can add FAQs that your visitors can easily find whenever they want. Another thing that you can do with Stories is creating a highlight album in which you can add all the stories containing FAQs so that your customers can go through them whenever they want.
The attention span of people has significantly reduced. So, you can create short videos or reels to convey your message and get more engagement out of them. Reels are 15-30 seconds long videos. This option will work best when you want to notify your customers about product launches, discounts, or any other offer.
3. Talk to customers with quick reply
“Instagram quick reply” is another helpful feature that businesses can use to provide customer service.
If you have a business account on Instagram, you must have noticed that most questions asked by your customers related to your product or services are similar. Replying to the same queries over and over again can be a daunting task. To solve this issue, you can use the “Quick Reply” feature.
Identify the common queries and prepare replies for them. Whenever you receive questions from your customers, you can select a suitable response from the list.
4. Convenient for both large and small businesses
Instagram is a great platform for large as well as small businesses. If you are running a business or planning to start one, you can create an account on Instagram for free. The user base of Instagram is accessible to all businesses. So whether you have are a local bakery business or a big MNC brand, you will always have a large group of interested users.
Instagram helps you maintain your business’s authenticity by allowing you to connect with your customers through direct messages, posts, stories, etc. There is something for everyone.
5. Boost sales and increase profits
In today’s competitive market, product placement has become a key factor for increasing sales margin. Instagram has added the “shop tab” to allow brands to sell their products.
The shop tab enables Instagram users to purchase directly through your business account. The platform also facilitates businesses to use product tags on their posts and stories.
The product tags contain links that redirect them to your website, where they can check the product description and its price. This function lets Instagram users discover different products and conveniently buy items or services.
6. Maintain transparency
As a business owner, you must be aware that transparency is the key to delivering a robust customer experience. It is a proven fact that shoppers prefer to buy products from businesses that maintain transparency.
Instagram allows businesses to be more open to their existing, as well as potential, customers by sharing in-depth details about their products and services. By enabling comments under your product-related posts, you receive honest reviews from the users.
Their feedback can help you identify all the flaws and improve the quality of your products. Hence, it can help you build good relationships with your customers that can further assist you in improving your business’ reputation.
Go back to the table of contents →
Now that you have a good understanding of Instagram’s impact on your business, let’s get back to APIs.
What is an API? Explained with an example
Definition: An Application Programming Interface (API) is an intermediary software that allows two different applications to talk to each other.
Let’s understand this with an example. Imagine you want to book flights. You have two options.
In the first scenario, you visit an airline’s website, select your destination location and dates and then book your flights. The website shows you a list of options and you can select your preferred option from this list. Here, the airline website directly fetches the information about the flights from the company database.
In the second scenario, you aren’t sure which airlines to select. So you visit a travel aggregator’s website, such as Expedia or Kayak. Again, you fill in your destination location and dates, and the website will show you a list of flights from different airlines. In this case, the travel aggregator’s website interacts with the airline’s API to get their details. The API collects the information and delivers it to the travel aggregator’s website, which then shows you the most relevant and up-to-date information.
Looping back to our definition of API, the travel aggregator’s website is talking to the airline’s website through an API.
Suggested Reading: Webhook vs API
What is an Instagram API?
Instagram’s API lets other apps (thrid-party) use Instagram’s interface for their business. With these APIs, it’s simpler for business entities to support their services on this platform.
From the time of its launch, Instagram has been a social media phenomenon. And Instagram developers have noticed this. To enhance user experience further, they have developed Instagram API.
Instagram APIs let you manage your user’s experience in powerful ways. Instagram has many APIs that leverage various endpoints to create useful tools and services for the Instagram community.
These days, there are numerous Instagram APIs to connect Instagram with third-party business apps. Until 2018, one of the most popular Instagram API was the Public API.
With the Instagram Public API, businesses had access to user and competitor information. However, to safeguard data privacy, Instagram developers decided to shut down Instagram’s public API and built a more controlled and restrictive API. Now, only a few limited apps have access to this; apps that strictly follow the Instagram guidelines.
To replace the public API, Instagram released two newAPIs: the Graph API and the Basic Display API.
Instagram Graph API enables businesses and creators to manage their presence on Instagram from a third-party app. With an Instagram Graph API, your business can build unique services that allow your customers to reply to comments on your posts, analyse insights, conduct searches with hashtags, and more.
Who is it for? It’s best for professionals on the Instagram platform, i.e., owners of Instagram Business and Creator accounts.
Instagram Basic Display API enables people to import their media from Instagram, connect their Instagram profiles, and more with third-party apps. From the very beginning, Instagram has been ingrained with the Basic Instagram API, which allows users to access fundamental profile data, photographs, and video recordings of targeted audiences.
Who is it for? Anyone on Instagram can use this API, i.e., owners of Instagram Personal, Business, and Creator accounts.
Go back to the table of contents →
A little bit more about Instagram APIs…
Psst: this is extra information to understand Instagram APIs better. If you’d like to skip this and read about the three main APIs (Graph API, Basic Display API and Messenger API for Instagram) that we’ll cover in this post, click here.
Instagram APIs have many advantages. Anyone who has ingrained it in their account can get complete control over their Instagram customer interactions, publish content of their choice, take care of comments, check detailed account insights, and use webhooks to receive real-time notifications.
To get access to Instagram API endpoints, you need to generate an access token. It is the key element that allows Instagram APIs to manage an account’s interactions. With the help of Instagram Developer API (which generates access tokens), specific sets of codes are embedded in the intended Instagram account.
To get a little more technical, third-party app developers usually install python V.3 to generate Instagram API using python. However, coding can be done using several other programming languages, such as JavaScript, HTML5.
The developers do not lend the complete program information (or code) through an API. Instead, they make an assortment of data available to external users. Using the code, the developers fetch data and create third party apps. Businesses can use these apps to enhance their customer experience.
When software developers choose to make a portion of their information accessible to the public, they “uncover endpoints.” After that, different developers can acquire information from the application by building URLs or utilising customer’s HTTP to obtain data from those endpoints.
As we know, an API is a medium for two apps to interact with each other. The server keeps the data and develops the language. Simultaneously, the user operates that language to get useful data from the server. Servers never send information without a user’s request. Still, developers have set up several ways to do it using webhooks.
The four types of tools that an Instagram API uses are:
- GET: It requests data (specifics or status) from a server. For example, last_name.
- POST: It sends modifications from the user to the server. It is just like adding information to the server or adding a new entry.
- PUT: It amends existing data.
- DELETE: This function erases existing data.
After knowing this, you’d think it’s easy to get all information about Instagram users. In fact, there was an Instagram Bot API but it was shut down in 2020. Before its deactivation, brands and influencers used this API to auto-generate likes, follows, and comments in addition to scrape information from users profiles. Now, all the activities you see on the platform are organic.
Instagram does not permit users to upload pictures in an automated manner to prevent customised robots from sending videos in large numbers. Fortunately, with the GET, PUT, DELETE, and POST tools, you can resolve this issue to some extent.
Although Instagram API is not as powerful as the Twitter or Facebook API, it has a few appealing features to help business owners run errands relevant to their business. Let us look at some tools and their uses:
1. Likes:
This tool permits users to see the number of likes of a photograph or video.
2. Users:
This is maybe the broadest technique, despite being read-only. It generally uses GET requests and permits businesses to get insights about an account whenever they want by using USERS requests. You need to have a verified business account on Instagram to use this.
To get data about another account, regardless of its type, we can call on Users. This technique is beneficial as:
- It allows business owners to analyse the most recent likes given by the user.
- It can help them know about the user’s most recent posts.
3. Relationships:
To oversee who we follow or stop following, Instagram offers us the option to check the follow-up connections between users. Instagram API can help you get the details of your followers. You can get a list of the accounts that follow a particular account. It allows you to get the list of accounts that a particular account follows.
With the GET request, you can check the engagement status between the targeted account and the account with which you are verified. You can make edits by using POST requests such as following or unfollowing an account, approving a follow request or rejecting it, etc.
Lamentably, you cannot check the engagement status between the users that do not correspond to the verified account.
4. Tags:
If you are an advertiser, Tags are the best choice for you, even though they are read-only. Tags permit business owners to get useful information about the tag along with the total accessible content, popularity, etc. They permit admittance to the entire sub-universe comprising Instagram and to contact specific audiences.
As you see, there can be many opportunities for your business if you learn to use Instagram’s business APIs. It will permit you to arrive at a point where many companies have not come yet. Moreover, you can discover an audience that is genuinely interested in your services or products.
In the next three sections, we will cover 3 APIs in detail:
- Graph API
- Basic Display API
- Messenger API for Instagram
Go back to the table of contents →
Instagram Graph API
The Graph API, as it’s commonly known, allows business and creator accounts to collect or publish media, manage and reply to comments, track mentions by users, identify media with particular hashtags, and get insights about other businesses and creators on Instagram.
Note: Instagram introduced this API to replace its public API and hence, this is more restrictive than the original API.
Brands can track up to 30 hashtags over a seven-day period using this API. For example, let’s say Verloop.io is tracking 30 hashtags already. Now we want to track a new hashtag (#BestAutomationPlatform). We’d have to wait for seven days before switching from #ConversationalAI (old hashtag) to #BestAutomationPlatform (new hashtag).
This API is built on the Facebook Graph API. Developers can build on this API to find many new features. Once approved by Instagram, they can create apps that allow brands and creators to post directly to stories and feeds, track mentions, increase business discovery, get insights and moderate comments.
Why do you need the Instagram Graph API?
The Instagram Graph API is recommended to Instagram creators and business people who want valuable insights and complete control of their social media interactions. The API permits businesses to oversee and manage their communications with their followers on Instagram.
In case you are a creator or business person who uses the Graph API, you’ll discover numerous features. With admittance to Instagram’s API, you can follow hashtags to perceive the performance of your account, gather information to analyse the behaviour of your followers, examine your brand’s image, and post photos on your site.
There is an excellent chance for companies to improve customer satisfaction and increase sales figures by having significant interactions with potential customers on Instagram.
Creating a business account on Instagram can be very profitable for your organization or brand. It empowers you to post advertisements that will appear in front of the eyes of millions of users. There are a few formats that you can use:
- Simple photo: Send an image as a promotion, with a call-to-action button such as “Sign up,” “Buy,” or “Discover more.”
- Video: You can send 60-second long videos to the intended group of people.
- Carousel: You can send some collages to create a promotional advertisement.
- Stories: The new full-screen design of the Instagram mobile application is very appealing. It empowers promoters to catch the full attention of the intended group using short video clips.
The data that Instagram lends its customers is very precise. It shows the number of clicks, views, the number of times a particular advertisement or post has been shared, installations, conversions, etc.
Use Cases
Instagram Graph API lets businesses access essential bits of information, such as survey metrics for developing their content and the overall impression of their brand on Instagram. This helps businesses to monitor the performance of their content, posts, and social interactions more efficiently.
The Instagram API allows business owners to effectively distribute media, oversee and reply to comments left by users on the platform, get timely notifications, find relevant media by using hashtags, and obtain fundamental analytics and insights about the performance of rival businesses or creators.
Below we list the top use cases of the Graph API by businesses to boost their presence on Instagram.
- Content Publishing: Manage and publish photos, videos and stories on your account.
- Comment Moderation: Respond to comments, delete or hide/unhide comments, and enable/disable comments on media owned by your account.
- Business Discovery: Download data about other Instagram Business and Creator accounts.
- Insights: Measure user interaction metrics for your account and specific media objects.
- Hashtag Search and Mentions: Discover hashtag (#) media and mentions from public photos and videos where you’ve been tagged with specific hashtags.
With webhooks, you can also get real-time notifications whenever your account gets a mention on another user’s account, or an Instagram user leaves a comment on your media object (images, videos or stories).
Restrictions
Despite being able to do so many things from the Graph API, there are few limitations when it comes to accessing information. Remember the note above? Graph API was introduced to replace the public API and hence, doesn’t pull all information about users.
- Brands and creators can use the Instagram Graph API to access information about other business and creator accounts only. That means you cannot get data on consumer accounts (i.e., non-business and non-creator accounts).
- Only business accounts can publish content. If you have an individual account, then you cannot use the Graph API.
- Reels are not supported. So with the Graph API, you can publish and manage media like images, videos and stories but not reels.
- The Graph API allows you to get and submit data on Instagram. But when you get the result, it doesn’t allow you in any particular order. For example, you can get data on your ads, but ordering them on highest to lowest views is not possible.
- There are many endpoints you can get from the Graph API. Most of these support cursor-based pagination, but only the user insights endpoint supports time-based pagination.
How to get started with Instagram Graph API?
In this next section, we will share the steps you can use to call the Instagram Graph API to manage media. Before you start this process, you will need access to the following:
- Instagram business or creator account
- Facebook page connected to the above account
- Facebook Developer account
- Basic Facebook app configured with basic settings
P.S. It would be good if you are familiar with Facebook’s Graph API and know, how to perform REST API calls.
- Add the Facebook Login product to your app in the App Dashboard. Let the settings be on default.
- Follow the instructions on Facebook Login documentation and implement it on your app. You need to set up your implementation to request the below-shown permissions:
instagram_basic
Pages_show_list
- Sign in to your Facebook Developer account, access your app and trigger the Facebook Login modal. Your developer account should have permission to perform tasks on the Facebook Page connected to the Instagram account you want to query. After you click OK, you will get the above-listed permissions.
- The App will return a User access token. Capture this token so your app can use it in the next few steps. The Graph API Explores captures and displays it in the field automatically.
- Now that you have the access token and have registered your app, you can begin requesting data from Instagram. Use the GET tool to request account information. With the query GET /me/accounts endpoint, you can see the Facebook Pages that the user can use the Graph API on.
- Once you get this information, capture the Facebook page IDs.
- Use the page ID to query the GET /{page-id}?fields=instagram_business_account endpoint. It will return the list of Instagram Users that’s connected to that Facebook page.
- Capture the Instagram User IDs.
- Use the Instagram User ID to query the GET /{ig-user-id}/media endpoint. This will show you all the media objects on this Instagram user.
- Similarly, Using the above steps, you can get access to other endpoints, if needed. And also track the permissions required for each endpoint.
- To get approval for all permission, complete the App review process.
If you are not a developer and would still like to use the APIs, you can use the third-party apps. If the app asks you to link your business account, then it means it’s approved by Instagram. Otherwise, they might be using a hack and is not sustainable in the long run.
Go back to the table of contents →
Instagram Basic Display API
With this API, users can get basic profile information, photos and videos of all types of individual Instagram accounts. However, it’s read-only access.
This is an HTTP-based API. You can utilise it to collect basic information about your followers and related information, such as their stories, comments, and tags.
Use Cases
In its effort to protect user’s privacy, Facebook removed the public API and introduced two new APIs — the Graph API and Basic Display API. The Basic Display API, as the name suggests, provides only the basic information about the consumer profiles, i.e., non-business and non-creator accounts.
Launched in October 2019, the Basic Display API is still in development and only recently, Facebook provided support for long-lived API tokens (more on this shortly).
Unlike the Graph API, brands cannot use the Basic Display API to moderate comments on user’s profiles, etc. Below are the three common use cases businesses use this API:
- Access Token: Business and creator accounts can get an Instagram user’s access token and permissions from them to view their data.
- Profile Information: The API lets you view (read-only access) an Instagram user’s basic profile.
- Media: Get an Instagram user’s images, videos, and albums (only if the profile is set for public view.)
Restrictions
As the name suggests, this API only lets you get the basic information on users. In that too, there are a few limitations that we’ve listed for you below:
- Verification: You cannot completely rely on Instagram Basic Display API as it is not a valid source of data. Information returned by the API cannot be used to verify the users of your application. If you are looking for an authorisation solution, you can use Facebook Login.
- Application Types: Business accounts are not supported. For business accounts, you must use the Instagram Graph API instead of the Basic Display API.
- Legacy IDs: Basic Display API doesn’t support the Instagram Legacy API User IDs.
- Unsupported Media: Just like how the Graph API doesn’t support reels, the Basic Display API doesn’t support reels, IGTV videos, and also stories.
- Promoted Posts: Basic Display API doesn’t support promoted posts that contain media items.
- Insights: Insights are not supported by the Basic Display API.
How to get started with Instagram Basic Display API?
In this next section, we will share the steps you can use to call the Instagram Basic Display API to fetch user information. Before you start this process, you will need access to the following:
- Facebook Developer Account
- An Instagram account with media
- A public website that you own. This can be a generic free one like a Github Page or Heroku web app, or your actual website.
- A command-line tool such as Terminal or an app like Postman that can perform cURL requests.
P.S. This section contains some technical jargon and assumes you can perform basic cURL requests on apps such as Postman.
- Log in to your developer account on Facebook.
- Tap on “My Apps” on the developer account screen. Then, make a new Facebook app with any name of your choice. It will be best if you choose a name that can be easily remembered.
- Once you have made the new app, go to “Settings,” tap on “Basic,” scroll down to the bottom of the page, and click on the “Add Platform” option.
- Select the intended website. Then, add the URL of the intended website, and save the changes. Make sure you put the full URL link in the box, including the forward slash at the very end of the link.
Now, your Instagram developer account is ready to be accessed by your newly developed Facebook app while it is in “Development Mode.” It does not have to be live or be in any different mode for any purpose.
- Tap on the “Products” option. You will get multiple app options (Facebook login, messenger, account kit, etc.) on the screen. Look for “Instagram” on the list, then click on the “Set up” button to embed it into your application. As you are using Instagram, it is advisable to choose only the Instagram product.
- Select the “Basic Display” option and click on “Set Up”.
7. Scroll down to the bottom of the page, then tap on “Create New App.”
After that, a form will come up on the screen. Fill in each section according to the guidelines given below. The form will contain:
Display Name:
Here, you have to enter the name of the newly created Facebook app.
Valid OAuth Redirect URLs:
Here, you have to add the complete URL of your website. For example, https://verloop.io/. After adding your site’s URL, save the changes. Ensure that the URL link is complete with the trailing forward slash, depending on your URL structure. In fact, it will be best if you just copy your website link from the browser and paste it into the given space.
Deauthorize Callback URL:
Again, fill in your website’s URL link here. You can paste the URL you just copied. Then, save the changes.
Data Deletion Request Callback URL:
For the last time, copy and paste the website’s URL link and ensure that everything is saved.
App Review:
We’ll come back to this when we go live with the API. For now, you can skip it.
- Click on “Roles” on the left side bar. Then, scroll down to the section of “Instagram Testers.”
- Tap on the “Add Instagram Testers” and fill in the username of your Instagram account. Then, click on “Send invitation.”
- After that, open a separate tab and sign in to your Instagram account to which you just sent an invitation.
- Then move towards the Profile Icon, click on “Edit profile” > “Apps and Websites.” Go to “Tester Invites” and accept the received invitation.
Now your Instagram developer account is connected to your Facebook app and is ready to use while it is in development mode.
- Construct the Authorisation Window URL, replacing the app ID with your Instagram app’s ID. You can get this data from the App Dashboard > Products > Instagram > Basic Display > Instagram App ID field. Use the redirect-uri (URI stands for Universal Resource Identifier) with your website URL that you provided in Step 2 (Valid OAuth Redirect URIs). Make sure the URL is exactly the same.
- On a new window, load the Authorization Window URL. It should appear and display your Instagram user’s name, the app’s name, and a description of the permissions your app is requesting.
- Authenticate your Instagram test user by signing into the Authorization Window, then click on Authorize to grant your app access to your profile data. Upon success, the page will redirect you to the redirect URI you included in the previous step and append an Authorization Code.
Authorization codes are short-lived and are only valid for 1 hour.
Generate long-lived Instagram user access token
Bypass the endless process of window authentication URL and generate a long-lived token by directly heading towards the token generator. These long-lived tokens are acceptable for 60 days and can be updated before their expiry date.
Once you possess a long-lived access token, you will be able to refresh it before its expiration by using the GET/refresh_access_token endpoint. You can approach the token generator through the App Dashboard. Click on “Products,” select Instagram, and go to the “Basic Display” tab. Then, find and specify the Instagram App Secret to receive your token.
To obtain data from a public profile on Instagram, you will need to send a GET request. Take your newly generated long-lived access token and write down the fundamental request format with this endpoint in Postman:
“https://graph.instagram.com/?fields={fields}&access_token={access-token}”
In place of {fields}, add a comma-separated roster of user fields that you want to get and replace {access-token} with the newly generated access token. Then the endpoint “GET /me” will deduce the user’s ID from the sent token. After that, it will redirect the request to the user node. The response that you will get should look like this:
{
“id”: “17876505709887123”,
“username”: “yourusername”
}
That is it! Once you get all the information you expect to display, put it in your project in a way that will suit your requirements!
Go back to the table of contents →
Instagram Messaging API
The Instagram Messaging API allows businesses to use third-party apps to manage their Instagram Direct Messages (DMs). That means you can automate the process of sending and receiving messages from your users.
Since August 16 2021, all Instagram business accounts can connect to the Messenger API for Instagram.
This is particularly useful to support customers on Instagram at scale. With the Instagram Messaging API, you can manage DMs and allocate multiple live agents to attend to customer queries.
The Instagram Messaging API is built on the Facebook Graph API and is only supported from Graph API v5.0 onwards.
If your business is using this API, you will need to comply with all applicable Facebook terms and conditions. In addition to this, you also need to comply with the technical requirements.
This is because the Instagram Messaging API leverages CDN URLs. These URLs allow you to retrieve user’s rich media content via webhooks and conversational API, which are privacy-aware.
Privacy-ware means the CDN URL will not be asked to return the media when the content is deleted or expired (as in the case of stories). Without prior consent, you cannot download, retain or store media content. If your app requires continued access to the media made available via the Instagram Messaging API, you must only store the privacy-aware CDN URL in your system.
Use Cases
Instagram Messaging API is a breather for all brands wanting to support their customers on Instagram. Especially, those who wanted to automate this process and use conversational AI support.
Below are some of the use cases where you can use Instagram’s Messaging API:
- Send and receive text, media, stories, etc.
- Retrieve conversation history from the business inbox.
- Respond to public comments with private messages.
Through this API brands can delight customers with a good messaging experience.
Suggested Reading: Instagram Messaging API: Automate Support the Right Way
Some of the features that they can use for this are:
Feature | Description |
Messaging | Use text, video, and more while conversing with users. |
Webhooks | Get real-time notifications when an event happens. For example, when a user interacts with your post, mentions you in their post or sends you a direct message. |
Conversation | Retrieve past conversation history from your inbox. |
User Profile | Create a unified customer profile and let you personalise conversations. |
Story Mention | Get notified when a user mentions you in a story. Since stories last for 24 hours only, they are ephemeral by nature and hence, you must meet specific requirements and follow guidelines to comply and respect user privacy. |
Private Replies | Privately reply to user’s comments on your post. |
Quick Replies | Pre-fill answers to commonly asked questions and use them to instantly reply to users who ask FAQs. You can set a maximum of 13 quick replies (up to 20 text-only characters) and these will be shown as buttons to the agent during the conversation. |
Ice Breakers | Show users a list of FAQs to select from when they start a conversation with you for the first time. You can set a maximum of 4 questions to select from. For now, this feature is available only on the mobile app interface. |
Generic Template | Set a generic message to greet customers and send a structured message that includes an image, text and buttons. |
Product Template | Improve user’s shopping experience on Instagram by sending a structured message from Facebook Product Catalog. The message will include product details (image, title, price) that will automatically be pulled from the Product Catalog. |
Handover Protocol | Enable two or more applications to collaborate by passing control of the conversation (thread) between Primary Receiver and Secondary Receiver apps. For example, you can use one Facebook app to handle automated responses and another for customer service with live agents. |
Restrictions
Currently, there are two limitations while using the Instagram Messaging API:
- The API cannot access Instagram non-business accounts.
- Group conversations with more than 2 users are not supported.
How to get started with Instagram Messaging?
As a very useful customer support feature, you’d want to get started with this asap. Below we discuss how.
P.S. This section is slightly technical and we hope you are familiar with Facebook’s Graph API and Facebook Login. You will also need to perform few REST API calls.
As we had mentioned above, you need to thoroughly follow the privacy and technical guidelines. Hence, before you get started, here are a few things you’ll need to make sure of.
- The app has Send API, Webhooks and Conversation API implemented correctly.
- Your App should respect the message delete webhooks guidelines.
- The messaging experience has an escalation path, i.e., an option for your users to escalate the query to a human agent.
- Your App has correctly implemented the way it handles media CDN URLs.
- The App has correctly implemented Instagram Story (for mentions and replies).
Now coming back to the Instagram Messaging, you need access to the following:
- Instagram Business Account
- A Facebook Page that’s connected to your Instagram Business Account
- A Facebook Developer account with access that can perform tasks with at least “Moderate” level
- A registered Facebook App with basic settings configured
Once you’ve set them up, follow these steps to get started.
1. On your App Dashboard, add the Facebook Login product and leave all settings on their defaults. If you are doing this manually, you need to enter your redirect_uri in the Valid OAuth redirect URIs field. If you are using one of Facebook’s SDKs, you can leave it blank.
2. To implement Facebook Login into your app, follow the Facebook Login documentation steps. You will need to set up your implementation such that it can request these permissions:
instagram_basic
instagram_manage_messages
pages_manage_metadata
3. After implementing Facebook Login, you need to sign in to your Facebook Developer account, access your app from there and trigger the Facebook Login modal. (P.S. Remember to set your account to perform moderate level tasks on the Facebook page that’s connected to your Instagram account.)
4. Once the trigger for the modal is activated, click OK to grant your app the instagram_basic, instagram_manage_messages, and pages_manage_metadata permissions.
5. The API will return a User access token. Capture this token to use in the next few queries. The Graph API Explorer captures and displays this in the respective field automatically.
6. Query the GET /me/accounts endpoint and you will see a collection of Facebook Pages on which the current Facebook User can perform the MANAGE, CREATE_CONTENT, MODERATE, or ADVERTISE tasks.
7. Capture the ID of the Facebook Page that’s connected to the Instagram account that you want to query.
8. To perform various Instagram Messaging API calls, you will need to use the associated Page Access Token (PAT) of the relevant Instagram account.
9. Send a GET request to the /{page-id} endpoint using your User access token. The short-lived User access token is valid for only 1 hour while the long-lived User access token has no expiration date.
10. Get the Page Access Token via Instagram Developer Dashboard Tool.
Instagram and Facebook are still rolling out this tool to developers. So if you don’t see this in settings under the App Dashboard, generate the Page Access Tokens from previous steps. Alternatively, you can leverage the Instagram setup tool under the Developer App Dashboard (Dashboard > Messenger > Instagram Settings).
11. To manage Instagram messages via API, your Instagram business account need to enable the connected tools to toggle under message control settings.
12. Use the Page ID you captured and the Page Access Token (PAT) to query the GET /{page-id}/conversations?platform=instagram endpoint:
If you can perform this final query successfully, you should be able to perform other queries using any of the Instagram Messaging API endpoints. For these, you can refer to the guides available on the Facebook Developer Docs.
To enhance this experience, you can develop your app further. Like adding more endpoints, completing the webhook set up so you can get notified in real-time, and complete the App review process so that all approvals are granted when your app goes into production.
Go back to the table of contents →
How to use Instagram API (examples)
Once you’ve unlocked access to Instagram API, business and creator account holders can use it in many ways to improve customer engagement and grow your brand by aligning your efforts with your business goals.
For example, you get significant in-depth data regarding the performance of your content on Instagram. This data helps you find trends in customer behaviour and strategise your next steps accordingly.
Below we discuss some common examples and use cases of Instagram APIs.
1. Automate support
Latest in the Instagram API family, the Messaging API allows you to automate your customer support. Without logging in to the app, you can respond to comments and reply to DMs. Not just that, you can automate the whole process to respond to your customers quickly and accurately.
By integrating Instagram Messaging API with your conversational AI platform, you can reply to up to 80% of your customer queries through an Instagram chatbot. If the question is complex, the bot transfers the chat to a live agent. The agent will get to see the context and the user doesn’t have to repeat their question. A win-win situation for everyone.
With this, companies can respond to customers quickly and round the clock. As it also frees up the agent’s time, brands can see improved agent productivity and reduced operational costs.
2. Schedule posts on your account
Probably one of the most requested features, Instagram enables content publishing with the Instagram Graph API. This helps businesses manage their presence on the app more effectively and organically. Instagram business account users can schedule posts, views posts they’ve been tagged in and view other business profiles.
With the content publishing API, brands can schedule and publish single photos or video posts to their Instagram feed. While the feature is limited to just 25 posts in a 24-hour period per business account, it is still probably one of the best features.
3. Track the performance of your posts
Direction is more important than speed. When you are building something, you need to pause every now and then to look at how you are performing before moving again.
With Instagram API, you can pull information on how your posts are performing, where you are doing better and where you can improve. And it’s not just your performance, but the general market’s too. The Instagram API allows you to fetch information on your follower’s demographics, hashtag data and mentions.
For example, let say you are in the travel business and you want to see which sightseeing spot people are clicking the most photos of in a particular city. Or if you offer a product, you can see how people are using that product and what they are saying about it.
Based on this data, you can get better ideas to market your product and services. If you see negative patterns, you can use this information to educate your users about them and improve their experience.
4. Re-engage with customers
The Instagram Messaging API lets you send messages to your users who have engaged with your business account previously. You can share updates on new product/service launches, invites to events, notifications on upcoming sales/offers etc.
For a better customer experience, brands can use this feature to proactively communicate upcoming downtime or inform users about a common bug reported by many people.
In their blog, Instagram shared an example of Kiehl’s Malaysia. After people messaged them enquiring about a product or service, Kiehl’s automated interactions and converted these conversations into product recommendations.
By doing this, they drove 30% more qualified leads on Instagram compared to other channels and converted 20% of consultations into sales. They have also improved their response time to customer inquiries.
People appreciate such communication and trust the brand more. Such engagement also sees higher open rates and read rates.
5. Use data for social proof
Hashtags have an important place in the Instagram community. Consumers and creators tag brands in their posts and add brand names or brand-specific hashtags.
The Instagram API can track mentions, find the performance of specific hashtags and pull images from certain hashtags. The information could be the engagement level on a post or follower count. You can then share this information (or images, depends on what you are fetching) and post them on your Instagram page (as post or story) or website and use it as social proof.
What’s good about the Instagram Graph API is that you can use it to get similar data on your competitors (as long as they have a business account) as well. You can then perform competitor analysis and improve your marketing plan.
6. Expand your reach with Instagram API
Instagram influencers are all the hype these days. They have a huge fan following because they engage with their followers in creative and innovative ways. These users can eventually help you to boost the number of your followers by giving a shout-out to your business profile.
With Instagram Graph API, you can identify influencers who can become your unofficial brand ambassadors. Instagram API can help you track down all the accounts that regularly visit your profile, actively interact with your posts and have their own following. If they can promote your brand, you can increase your followers and hence, brand reach.
P.S: Earlier, something similar could have been done using the Instagram Bot API. With this API, brands could automate likes, comments and follows. But it violated Instagram’s terms of use and has been discontinued.
With Instagram Messaging API, you can also speak with your users in multiple languages. But you need the right tool or conversational AI platform for this. For example, H&M partnered with Sprinklr to detect languages and route the message to the right support team. By doing this, they were able to see an increase of 9 points in their CSAT score. It also improved agent efficiency by 31%.
7. Identify trends to build campaigns
Before starting a new campaign, it’s important to understand what’s trending. For example, if you are targeting a new region, you’d like to know what are people talking about in that geography. Instagram API lets you know exactly that.
The Graph API can pull the most popular content in a specific geography, age group, gender, etc. With this, you can identify trends and build your campaign around them to see higher engagement.
8. Engage with more people with Live feed
Yes, the Instagram API allows you to showcase your event live. This kind of activity helps you increase awareness and engage with your audience.
With the Instagram Graph API, you can immediately and automatically repost images or videos from your guest in real-time. You can create a live feed of such media and encourage more people to participate in it.
9. Improve shopping experience
With the launch of Messaging API on Instagram, brands can improve customer’s shopping experience. Features like Quick Replies, Ice Breakers and Product Templates (see above to know how they work), help you automate the process of sharing more information with your customers and answering their questions.
With new interactive messaging and multimedia formats, customers can find all the relevant information from the Instagram app and don’t have to switch platforms to talk to the brand. This improves CSAT and reduces cart abandonment drastically.
10. Moderate comments
The Instagram Graph API gives business accounts the ability to moderate comments on their profile. Brands can enable/disable comments on a post, hide/unhide comments, delete them, retrieve replies on comments and respond to comments. All this without logging in to the app.
Using third-party apps which integrate with your Instagram account, you can manage your interactions with your users in real-time and respond to them quickly. With this feature, you can improve your social media customer care experience at scale.
Go back to the table of contents →
Using Instagram API – The best practices
Now that you know how to get started with the Instagram API and how to use it to improve your customer engagement and support, let’s talk about the best practices. A well-designed Instagram API should aim to provide:
1. Platform independence
Businesses opt for Instagram APIs so that they don’t have to log in to the platform every single time. You have to pay attention to how the API is embedded internally and how a user communicates with a business. The APIs should be created with these pointers in mind.
2. Service evolution
The Instagram API should have the option to develop and add functions autonomously from customer applications. As Instagram and Facebook come up with new changes and upgrades, existing customer apps should keep on working without any change.
3. Design of the API
There are many aspects of the design that we should keep in mind. We’ve listed some of them below:
- When designing the API, you should focus on the business entities connected by the API. For instance, in an e-commerce framework, the fundamental entities can be clients and orders. You can place an order by sending an HTTP POST request that includes the order data. The HTTP response shows if the order was assigned effectively or not.
- Asset URIs should be based on nouns (the asset) and not verbs (the action carried out on the asset).
- Try not to make APIs that just mirror the internal build of a database. The purpose should be to demonstrate elements and the tasks that an app can perform on those elements.
- Elements are frequently gathered in assortments. All the elements in an assortment are distinctive assets. However, remember that the assortment is also a unique asset, and it should have its unique URI.
- When you send an HTTP GET request to the assortment, the URI recovers a list of elements in the assortment. All the elements in an assortment have their unique URIs. An HTTP GET request to an element’s URI brings back the subtleties of that element.
- While using perplexing frameworks, people often develop complex URIs that empower customers to explore different grades of relationships. However, managing complex URIs can be challenging. So, try to keep the URIs simple.
- Install a mapping layer between the database and the Instagram API. In that way, consumer applications will not be affected by the changes in the primary database system. However, it is impossible to map each activity executed by an Instagram API. You can handle such situations by using HTTP requests.
Go back to the table of contents →
Conclusion
Due to its large user base, Instagram is known as one of the most valuable networking platforms for companies and creators. More and more people and brands are paying attention to this platform.
We are already seeing its impact on the brand-consumer relationship. 72% of Instagrammers purchased products from a business at least once.
Instagram APIs help your business expand its reach and increase engagement with the users. With the advancement of Instagram APIs, businesses are reaching new heights on the marketing and support front using Instagram chatbots.
Getting started with Instagram commerce and customer care now can give you a competitive advantage. Verloop.io is a leading provider of conversational AI for customer support. With an accuracy of over 90%, we help companies support their customers on the web, mobile, WhatsApp and social media channels such as Facebook and Instagram. We ensure you can provide your customers with a seamless omnichannel experience.
Turn Instagram customers into loyal brand ambassadors by helping them easily discover, purchase and get support from you – right in the moment.
Looking for more comprehensive and information-rich content? Check out our eBook on how you can Improve End User Experience with Conversational AI.