how subscribing to instagram realtime api helps me to get user/media details - instagram

I have subscribed to instagram realtime api to receive POST updates for hashtag #sudhir
I am able to get updates to my server this way :
{"changed_aspect":"media", "subscription_id":2935881, "object":"tag", "object_id":"sudhir", "time":1362748903}
I don't find any user related or media related info in these updates. I found in SO that we have to hit their (instagram) endpoints explicitly to get photos/user info, inspite of subscribing to endpoints.
If we have to make request explicitly, then what is the use of subscribing to particular endpoint.?
What is the use of this json data ({"changed_aspect":"media","subscription_id":2935881,"object":"tag","object_id":"nofilter","time":1362748903}) we get in request body of our servlet. ?
Can we use this data in any way to get actual data of user/media ?
Any help or suggestions would be appreciated :)

Nothing useful I'm afraid. Once you have that information you know that something has changed on Instagram's end. You are then supposed to fire off the corresponding request. From your example it looks like you want to then do a tag/recent/ request and filter out anything earlier than the "time" variable.
Not the easiest way to do things unfortunately but they seem to have decided that the hard way of doing things is the way to go.

Related

How to make twitter bot track tweets from our followers?

I was making a twitter bot with Twit, I found making tutorials using T.stream('user')
to get stream data about our account, now its deprecated. So in 2021, how can i achieve these?
requirements:
Know when someone follows my bot, and make a thanks post.
Know when someone in my followers list or following list makes a tweet.
Also I have a doubt, when we use stream, old data is also coming, so how exactly stream works? if i only want latest tweets, I have to sent get by setting interval?
For the new followers, you will need to build something using the Account Activity API, which uses webhooks to send you event messages. You will need to filter for the follow events.
For new Tweets from people you are following, you will need to poll the home timeline endpoint. There’s no realtime method for this.

How to build a notification system for followed posts

MERN stack
In my app, you can follow users and when those users make a post, you should get a notification.
Currently, my User model has an array that lists all the users they're following as well as users who are following them:
users_you_follow: [ <object_ids>... ],
users_who_follow_you: [ <object_ids>... ]
My current idea looks something like this:
When a user makes a post in the frontend, we pass in the array of users_who_follow_you as well as the post details into the backend.
Then, using mongoose, parse the users_who_follow_you and find the users with the same ID's.
Finally, within that User model, I would store the post details along with some other metadata.
Then in the frontend, I would have a setInterval call to check if there are any new notifications.
This method although might work seems very server intense with all the API calls to check notifications. Is there a better way around this?
I currently don't know how to start on this process. From my research, some people said to use websockets while others say web workers.
What would be the best way to achieve something like this?
A very similar system to compare it to would be StackOverflows inbox thing. If a user comments on your post, the header/navbar shows a notification without having you to refresh your screen.
Thank you.

YouTube Data API LiveChatId assistance

I've looked online for quite some time now, and I have come up empty. I am working in C#, and I am trying to locate the code I can use to get the liveChatId so I can post to livestream chat. Even the "Try it now" section of Google's example resource https://developers.google.com/youtube/v3/live/docs/liveChatMessages/list#try-it asks for the liveChatId as well. I know I need to make a HTTP GET request, but I really need the actual code that will allow me to do this.
Assistance is GREATLY appreciated.
Here, from the very documentation you provided:
The liveChatId parameter specifies the ID of the chat whose messages will be returned. The live chat ID associated with a broadcast is returned in the liveBroadcast resource's snippet.liveChatId property.
That means you first need to get your liveBroadcast resource. You can obtain those at the liveBroadcasts.list endpoint. If you want to retrieve broadcasts that you (or a user of your application) is the owner of, you might consider authenticating with OAuth 2.0 and using the mine parameter.

Is there a way to get Instagram #Mention History via API or otherwise?

The native application doesn't show all the activity, only the most recent.
Therefore I lose 70-90% of my notifications overnight. There must be a way to get all that historical data.
I told you can't, but, thinking.. you can. :)
The API don't provide that facility.. You can check all endpoints here: http://instagram.com/developer/endpoints/
But you can iterate over all your medias an get all comments and likes. If you store it locally, after, will be possible to request API again and check your new unseen interactions.
It will work for likes and comments.

User authorization in google talk with nodejs and node-xmpp

I'm writing a bot in node.js using node-xmpp. So far it's pretty straight forward except I'm having an issue with figuring out how google Talk handles it's user authorization (when dealing with requesting to chat with someone NOT on your roster).
I'm catching all stanzas coming through and logging them to the console but there is no data coming from the user that is requesting authorization.
Any explanations of what I should be looking for or if this event even happens over the jabber protocol.
[appended] I know that technically when a subscription request is made a presence stanza is sent with the subscription request. I can't see these coming over the wire using node-xmpp for some reason. Also, I need to find out a way to determine what presence requests are "pending" when my bot logs in. I thought (innacurrately) that they would be listed in the roster with some sort of flag, but that's not correct.
Any help with finding out where to go from here would be useful.
Ok, I finally figured out how to get the subscription requests after they have been made. There isn't much info on it out there so I'll put together a blog post, but I feel that answering it here might be good as well.
I found that if I did a google roster query based on the below information:
http://code.google.com/apis/talk/jep_extensions/roster_attributes.html
example stanza:
<iq from="username#gmail.com/D2D4E5A8" type="get" id="google-roster-1"><query xmlns="jabber:iq:roster" xmlns:gr="google:roster" gr:ext="2"/></iq>
The server would respond first with your pending server subscription "presence" stanzas
ex:
<presence type="subscribe" from="pendinguser#gmail.com" to="namehere#gmail.com/D2D4E5A8" xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client"/>
and then the rest of your roster's "presence" stanzas. It's important to note that your subscription "presence" stanzas don't get sent to you from the server unless you do a roster query. I'm not sure why this is and why it's not documented somewhere is beyond me. Anyways, at least I can get the list of people trying to get access to my bot now.
Note: This is not my area of knowledge just an interest of mine. I have not got practical experience just a bit of research. This would have been a comment however doing some more searching on the topic, I have come up with some more things that might help.
Here's a google chat chat room homepage http://partychapp.appspot.com/ you can get the source http://code.google.com/p/partychapp/
Those links came from http://xmpp.org/2010/02/xmpp-roundup-13-services/ which has quite a few other resources that might be helpful.
http://code.google.com/p/node-xmpp-bosh/ has some code about that, I've not done it but the topic is interesting.
I hope if you do find the answer your after you write up a blog post and or a project and share it. It would be of interest to me.

Resources