Instagram

The Instagram Managed Source type allows you to track public posts, comments, and likes on Instagram.

Instagram authentication

The Instagram Managed Source type accesses the Instagram API on your behalf to collect data. The platform manages the collection and de­duplication of data, adhering to API rate limits, and complies with authentication requirements of the Instagram API.

Each request made by the platform to Instagram must be authenticated using a valid user token. When you configure an Instagram Managed Source you provide an OAuth 2.0 Access Token issued by Instagram that is used by the platform.

For test and demonstration purposes you can use the DataSift dashboard to generate access tokens. This is the route taken by the Activate an Instagram Managed Source guide.

However, for production usage you must configure your Managed Sources via the DataSift API and provide authentication tokens which relate to an Instagram application that you have created and has been approved for production usage by Instagram.

Obtaining an Instagram access token for production applications

For production implementations, an application must be created with Instagram and approved by Instagram for production usage. Once approved, the application token can be used to generate user tokens for production use and scale. How to register an application is described here.

Tokens must be approved for the “basic” and “public_content” permissions. Read more about Instagram app permissions here.

Failing to use a token generated by a production approved application results in data collection in sandbox mode. This is a test and development enviroment which enforces limitations on the number of users who can use the app, the amount of data which can be returned, and API rate limits. Full details of these limitations can be found on Instagram's Developer Site.

Configuring Instagram Managed Sources

Your DataSift account allows you to create multiple Instagram Managed Sources. Each source will be assigned its own id, have its own independent settings, and can be assigned one or more unique resources to track.

Interaction types

When you configure an Instagram source you can choose which types of interactions to receive. All sources will receive new Instagram posts, but you can optionally choose whether to receive comments, and counts of comments and likes relating to the posts.

Configure this option using the parameters argument when creating or updating the source.

Resources

Each source can be configured to track one or more unique resources. You can combine different types of resources in the same source.

Types of resource include:

  • user - Track posts from a specific user
  • tag - Track posts given a specific tag
  • location - Track posts tagged with a specific location

Access tokens

Each source must have at least one valid Instagram access token. If you provide more than one access token then the source will rotate between tokens, allowing your source to consume more data. See the Managed Sources best practice guide for more details.

You configure access tokens for use by the source using the auth parameter.

Ingested data

A running source will ingest data from the Instagram API. Data arrives as interactions in the platform which you are able to filter against.

  • You can use any of the Instagram targets for your filter conditions.

  • Each Instagram interaction contains data about the activity published on Instagram and about the user posting that activity.

  • If an interaction is an Instagram comment, then it will carry additional information to associate it with the Instagram post that was commented on, such as post id, author, link, content and type.

  • We only monitor posts for a window of seven days. Any new comments or likes to a post that is older than seven days will not be picked up, even if that post was created after you begun running your Managed Source.

  • When you start your Instagram Managed Source the platform will perform an initial 'pull' of data from the Instagram API which will immediately pass through filters you have running. Data will be returned for a maximum of seven days in the past.

Duplicate interactions across Sources and Resources

Each source you create is independent. If you are running multiple Instagram sources then it is possible that you could receive the same interactions from multiple sources.

Similarly, if you monitor multiple Resources (Users, Tags, etc) within a single Source which all match the same Instagram interaction, you should expect to receive that interaction once per Resource.

All interactions returned from Managed Sources contain a source object, which gives you the IDs of the Managed Source and Resource which were responsible for returning that interaction.

Read our notes on handling de-duplication here.

Getting started

To get started read our Activate an Instagram Managed Source guide. This guide shows you how to create a source which you can use for testing and demo purposes.

For production usage you will need to configure sources via the API, as explained in the API step-by-step guide.

Best practices

It's easy to get started with Managed Sources but there are important points to keep in mind.

Read our Managed Sources best practice guide for an overview of our recommendations.