Periodic posting to multiple twitter accounts using Java - java

I want to periodically post set of tweets to multiple twitter accounts. To accomplish this task, I have used tweetdeck.twitter.com, had created a twitter account and added all the other accounts that I need to post on under my account.
I have created a Java application using twitter4j library that connects to my twitter account and posts on my timeline.
How can I extend the use of this application to get the other accounts and post for them using twitter4j APIs?

I know it's too late to answer but it may aid other users, I recently encountered this situation, and I've used below approach :-
Store all twitter credentials(I prefer calling them handler details) and tweets in DB
Maintain a relationship between tweet and the handler over which it need to be posted.
Create a scheduler to pick up scheduled tweet and then pick the linked/appropriate handler and simply tweet.
Hope this help.

Related

Data Model for Firebase/Firestore chat application

This is the current Firebase/Firestore data model I am using for my test chat application. However, this model is very hard to use for push notifications on Android side. I want to send push notifications to users phone when they receive messages from any of the channels they are part of. In addition file/image messages need to be added.
Any recommendations or any examples of good data models for chat applications I can use as a reference.
If you want to try another approach regarding a Cloud Firestore database schema, here you can find a tutorial on how you can structure the database for a Chat App.
I have also exaplained in another tutorial of mine, step by step, how you can send notifications to specific users using Cloud Firestore and Node.js. You can also take a look at my answer from this post.

Android : get a unique id on each app to rate a service only once

I have a restaurant app showing profiles of the chefs we got...
I set a Firebase database where users can rate each chef..
yet I want to get a unique id for each installation of the app which is persistent with time, so that a user can re-submit a rate for a chef yet he's contributing to the whole rate only once..
is there such an id ?
is there a better way to do so?
thanks in advance, great people..
If your users sign in with Firebase Authentication, you'd typically use their UID for this purpose.
That would prevent them from rating the same check multiple times, even if they use the same app on multiple devices, or reinstall it on the same device.
If you're not (yet) using Firebase Authentication, I'd recommend adding it for this use-case anyway. You can use it without requiring your users to sign in, by using anonymous authentication. This is as simple as calling:
FirebaseAuth.getInstance().signInAnonymously();
But follow the instructions in the documentation to ensure you don't create a new UID every time the app runs.

How to get the user's country for a HTTP request in the Backend?

I am trying to get the country where the user is sending the request to my server.
So far I have found those solutions:
https://github.com/fiorix/freegeoip
https://github.com/maxmind/GeoIP2-java
These solutions are using MaxMind database GeoIP2 Country Database which has a license and for this specific project I have restriction with Libraries (legal aspects because of the business)
I have found some topics mentioning that Google API can provide this service, but that doesn't interest me as I want a solution that I can host myself and it is implemented using Java or Kotlin.
Does someone know a solution different from the one mentioned (that runs on the backend)?
I've coded a little service that returns the country based on data I've acquired from http://ipverse.net/
It should be license free but correct me if I am wrong. According to the website the data is provided by the five big RIRs.
The website updates its data ~5am. The Cron job that updates the IP Blocks is scheduled at 6am. The data should be accurate I guess.
*edit
I've replicated the algo and created a github action to keep it updated, check it out: https://github.com/jaecktec/ncc-inetnum-parser
Not sure if, from an architecture point of view, this is a good solution, but you could install a command line tool in your backend server and use that.
For example: http://manpages.ubuntu.com/manpages/zesty/en/man1/geoiplookup.1.html
There are also some free web API you could use, have a look here

API limitation Twitter

I'm new to API programming and I need some help.
I have a JAVA application that needs to use twitter API to send a request and get the response for specific data.
For example sending tweet ID and get video or image URL.
My question is that assuming the app will be used by 10,000 people daily with 1 Key for the API call, will there be any problem for my application to send and get the request from Twitter API?
I saw online that there are some limits for APIs calls, for example, your API key can't call more than 100 times daily, if so how it will work for my application if I have 1 key that will be used by 10,000 people from different location and countries.
Thanks in advance.

Get location information from twitter using processing

I'm trying to write a program in processing that can get a location from the user who is using Twitter. In every twitter profile there is information where they live like "New York, NY". I figuered out that I will need to use Twitter4J to do this, but what im really asking, is it possible to get a users location from their profile? or is it limited to only induvidual tweets?
I don't expect a full code as an answer but if somebody can point me in the right direction it would be great!
I can suggest also using
https://github.com/fernandezpablo85/scribe-java
for OAuth integration (very easy to integrate and extend) and then load user profile.
twitter user profile contains all details, including user's location, see example below
...
"location":"Oslo, Norway"
,"geo_enabled":true
...
see twitter api -> https://dev.twitter.com/docs/api/1/get/users/show

Categories