Roger
Roger

Reputation: 238

How Instagram Real Time Subscription works

I am following this link Instagram Real time updates tag - getting empty data, why? to implement Instagram Real Time Subscription.

I am thinking do I need to hit the url every time in order to check the new update, how is gonna work?. Some are using nodejs, socketio,etc, which I dont want to get into this.

What I am trying to achieve through this that every time is a new update, It starts getting analytic automatically without letting my system know which image to mointor.(I already implemented this part), but stuck on the real time.

Any suggestion to that.

Upvotes: 0

Views: 2788

Answers (1)

François Richard
François Richard

Reputation: 7045

You don't need socketio. https://instagram.com/developer/realtime/?hl=en

  1. You subscribe to something passing an url that will be used for answers
  2. Everytime there is an update instagram will send you a payload to the url you passed during your subscription.

The point of subscription: You create a subscription (you'll give some parameters, client_id, client_secret and the url you want instagram to call when there is an update, check the documentation for details).

curl -F 'client_id=CLIENT-ID' \
     -F 'client_secret=CLIENT-SECRET' \
     -F 'object=user' \
     -F 'aspect=media' \
     -F 'verify_token=myVerifyToken' \
     -F 'callback_url=http://YOUR-CALLBACK/URL' \
     https://api.instagram.com/v1/subscriptions/

Each time the media you subscribed to is updated instagram will send you new data to the urlcallback you provided in the subscription.

I hope it helps you to understand how it works. Read the documentation throghroughly.

you NEED to read the documentation =D From the documentation:

"When someone posts a new photo and it triggers an update of one of your subscriptions, we make a POST request to the callback URL that you defined in the subscription".

Upvotes: 2

Related Questions