Calling code on a push Twitter notification - python-3.x

Is there an API provided by Twitter to call back some code on a push notification?
I would like to execute some code when someone I am following is tweeting.
Looked at TweePy but it does not seem to implement callbacks for push notifications.

I think you could use the streaming API (with TweePy) and filter for the accounts you follow e.g.:
stream.filter(follow=['#user1',...])
You get the users you follow by calling: GET friends/list Twitter API
You can then call any callback you like per tweet that is found... works but needs a permanently running (small ressource consuming) process...
There also seems to be something like the Account Activity API which looks good but seems to be "enterprise" ... or premium this page does not mention enterprise needed...(now premium ??)
But I personally don't know what you need for premium or enterprise access...

Related

Firebase Messaging Push Notifications

hi guys I'm trying to add push notifications to my flutter app. I want them to be sent to specific users an hour before an event happens the time of the event will be stored in firebase by the user. I have been doing my research and I think need to write these conditions in a node.js file? I also want to send another notification if an entry is added which is pretty straight forward. However I only would want to send it to the users in the same area as the user who added the entry. In my flutter app I use geohashes and haversine to query firebase for the user in the same area would I need to do the same in the node.js file. I am having trouble finding some good examples if this correct please direct me to some better resources if not please help me better understand what I should be doing. Thank you
Your question's scope is wide but I will try to give you some kind of guideline for you to begin with.
First to set up an environment for firebase functions follow this, then there are different triggers for firebase functions like database write calls a function to be executed when new data is written to the database.
In your case when you add an event inside your trigger write some code to get the users near that area and send notifications, and to send the notifications you will need to get the token of every user when they login to your app and save it somewhere else.
For firebase functions, you need to know basic Javascript/TypeScript and for that, this video series of Doug Stevenson is very helpful. I recommend finishing the tutorial first.

How to get instant changes in background from private api in mobile app?

I am planning to create a mobile application for android and ios users, i think i will take a try with xamarin since i will be alone on this project and i don't have a lots of time.
I want that the mobile app for both platform get datas from the api, then if there is new datas available we notify the user by a notification.
How the mobile will work in that kind of project? I mean should i make a background service then check every x seconds/minutes by http request? In that case which time interval? Should i use websockets instead for this case?
The app might be used by many people, so i would to know the scenario in this kind of project: Getting very fast changes, without overload the server due to too many connects or whatever else.
I'm confused about this and i need some lights around, any mobile application/server experiences related would be apprecied!
EDIT:
As suggered by an user, here additional infos:
The api is homemade, restful using JWT made in NodeJS.
Each users on their device should get messages from server asap, even when the app is in background/closed.
Maybe in the future a way to send messages between users themselves.
You have to implement push notification.
It is quite easy to implement this in xamarin. just send the push notification to the device and on the notification received call back send the API request to retrieve the updated data.
Here is the document for sending push notification from custom API.
https://learn.microsoft.com/en-us/appcenter/push/pushapi
I'm not a mobile developer, so take this with a grain of salt.
The answer to this really depends on what you're doing, which informs how often to check the API. If it's a messaging app, for example, you could have it check every couple minutes to see if there are undelivered messages, then check more frequently for the next X minutes (to facilitate a conversation in real time).
If it's a GPS navigation app to be used while driving, you'd need much more frequent requests.
As for the API, that also depends on what type of API and the number of requests you can make to it. Is it a commercial API that you get x number of calls per hour on? Is it an API that you built? Etc.
Basically, you need to give more information in order to get more specific answers.

How do I fetch my own Instagram media feed

I have a use case that Instagram does not seem to acknowledge. I am hoping that someone else has an idea for what I can do.
The website that I am maintaining has been using the API endpoint:
https://www.instagram.com/anyUser/media/
And I am aware that Instagram has recently stopped supporting this endpoint. So I am looking for a replacement.
My use case is that I do not want to allow the users of my website to authenticate and browse their own photos. Instead I want to show only the latest 20 images that "I" (aka my employer) have posted, one at a time in a loop.
Instagram's API documentation seems to be entirely focused on the use case of allowing users to authenticate and share their photos.
Is there an API call that will return the last 20 images that I have posted?
From its specs, the Sandbox will work fine for me, I cannot find a way to register with Instagram that does not require me to build a user authentication work flow that will NEVER be used.
You would want to use self feed endpoint.
https://www.instagram.com/developer/endpoints/users/#get_users_self
https://api.instagram.com/v1/users/self/?access_token=ACCESS-TOKEN

SHKTwitter's followMe function in iphone

I don't know how to implement the twitter followMe feature.
I found the SHKTwitter's followMe function, but I haven't any reference informations about it.
Please tell me or send a bit of samples.
If you look at the source code, you'll see that it's basically making a Twitter API request to add the account defined in "SHKTwitterUsername" (SHKConfig.h) to the user's friends list (follows).
So, if you have a Twitter account for tweeting to your app users, you can add a follow button in your app that calls [SHKTwitter followme], and configure SHKTwitterUsername to your twitter handle.
Hope this helps!

Like a page via foursquare API

Can't find an endpoint providing "Like a page" (not a page update) via the API. Any suggestions? Looking here https://developer.foursquare.com/docs/pages/pages
You won't find such an endpoint: "like a page" is explicitly intended to be done by users, never via an API. None of the major platforms that allow things like Likes provide API endpoints for that action (Facebook doesn't, Foursquare doesn't either) because they do not want developers gaming the system and inadvertently (or on purpose) performing those actions without user consent.
So no: you're probably never going to find an API endpoint for that.
Documentation for this endpoint is coming soon (we're in the process of auditing our API to document the new APIs introduced by #allnew4sq)
The endpoint is /pages/USER_ID/like and without any additional params probably does what you want it to do.

Resources