1

I'm trying to implement instagram real time photo updates https://instagram.com/developer/realtime/ into my chicagoboss application

When i request a location with the following

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

I want my application to respond to the GET that instagram servers send

http://my-website.com/subscribe/?hub.mode=subscribe&hub.challenge=15f7d1a91c1f40f8a748fd134752feb3&hub.verify_token=myVerifyToken

with the 15f7d1a91c1f40f8a748fd134752feb3

Here's how my code looks as of now

src/controller/example_controller.erl

-module(example_controller, [Req]).
-compile(export_all).


% Get parameters 
subscribe('GET', []) ->
%Split into parameters to get verify_token 
% Set value of hub.challenge to Challenge variable    
RequestBody = string:tokens(binary_to_list(Req:request_body()), "&"),
cowboy_req:reply(200, Challenge).

Any advice or pointers on how to do this would be greatly appreciated.

Capa
  • 65
  • 5

0 Answers0