How to invoke telegram API to send pm to users? - java

I want to send pm messages via Telegram API not with Bot API, but when I want to read related documents about how to make a request I actually do not understand any thing. Can anyone guide me how to start using Telegram API?

short answer: there's a jave lib you can use (https://github.com/rubenlagus/TelegramApi)
Steps are very clear and straightforward(https://core.telegram.org/api#getting-started):
1- Create yr application(register yrself for API usage):
API Key, Hash, configuration API will be generated for you
2- learn how to call APIs if you dont know there's a great course at codecademy (https://www.codecademy.com/apis)
you should know http concepts like get, post
3- authenticate yrself by auth_key_id and then using auth.sendCode method by passing auth_key_id, hash, phone_registered . steps are in https://core.telegram.org/api/auth
3- call telegram endpoints(https://core.telegram.org/methods). you can use some online tools to ease yr learning curve like https://www.hurl.it/
i have to admit since there's no code samples, it's not easy to use this API but steps are easy and it takes only some time.
hope it helps

Related

Query a gmail inbox through the API

I know this is a pretty noob question but I've been reading some manuals and documentations and can't figure something out.
I have an automation suite (in Java/Groovy) that in some cases needs to query an email inbox to check that a message with a given subject has been received and also probably delete all messages older than X. That's pretty much all I need to do and I've been looking into creating a gmail account and using the Google API Java client that's available here -> https://developers.google.com/api-client-library/java/apis/gmail/v1 but I can't figure our how to actually do it.
Right now what I have absolutely no clue how to do is the authentication. I can probably figure out how to interact with emails by going through the methods/code but I can't find any examples on how to authenticate so that the code can get access.
I tried looking for examples here and checking the code here. I know the answer is there but I still can't wrap my head around how to implement the code to sign in/authorize based on a username and password.
Thanks!.
This is the link you need. In this page it's explained authentication mechanism for Google API. They are using OAuth 2.0, which is probably the most used authentication method nowdays.
There is a standard flow that takes the client from credentials to an access token that can be used to perform authorised requests. This flow is described in the OAuth specification which is very useful to understand. Many APIs use it.
If you have specific questions, please let us know.

How can I create a Lync meeting from my Java program?

I have a program written in Java that uses the Exchange Web Services (EWS) API to create appointments on users' calendars via impersonation. Now I want to create Lync meetings instead.
I thought I could just set the IsOnlineMeeting property to true and be done with it, but apparently this property is useless.
The next idea I had was to use the UCMA, but it seems like you can't call UCMA from Java.
I am looking into using UCWA, but it sounds like it doesn't support impersonation.
Each user has a unique Lync meeting URL. Since UCWA doesn't support impersonation, your application will need to somehow get the user's credentials to sign in and get an OAuth token. Once you have that, you can call Lync to get the JoinUrl (same link as Richard). Once you have that JoinUrl, you can place that in the body of an appointment you make with EWS.
There is a Lync (UCWA) API to do this at http://msdn.microsoft.com/en-us/library/office/dn356790(v=office.15).aspx
This API does not support impersonation, so if you want to create a Lync meeting on behalf of another user, your application will need to somehow get the user's credentials to sign in and get an OAuth token. Once you have a token, you can call the API to get a JoinUrl.
If desired you can then place the JoinUrl for the meeting in the body of a calendar appointment you make with the EWS API.
You could call an external program using Runtime.exec().
i've an experimental java api which can communicate with Lync 2013 UCWA.
Here is the github page

Twitter4j and authenticating to Twitter

For the moment I'm just trying to get up a simple driver in Java to hook into the Twitter streaming API and gather some tweets. But the sample code provided on the twitter4j site doesn't work and it provides little direction as to how to properly authenticate to Twitter.
For now this is what I have (literally copied from the site):
http://pastebin.com/7udeFT9i
I did it programmatically this time, but obviously it doesn't authenticate with nothing but *'s. But I'm not sure what values to put into the ConfigurationBuilder. I've seen some that have hardcoded values and others that call a getter from a Twitter instance, but in general I'm just not sure what Twitter needs for me to be able to access the stream.
Use Scribe -
https://github.com/fernandezpablo85/scribe-java
You need to use OAuth to access twitter programmaticly. You should start with the Twitter OAuth docs:
https://dev.twitter.com/docs/auth/oauth/faq

How to get DL in Exchange Server using Java API?

How to get DL (distribution List) from Microsoft Exchange Server via EWS in Java?
I have tried EWS Java API but could not find list of Distribution List(GAL) of exchange server, any help regarding to this API or any other would be appreciated.
The GAL is not directly supported. You can use the ResolveNames method to resolve individual names. To perform a search on the GAL, you need to use LDAP. See http://www.infinitec.de/post/2005/02/How-to-get-the-Global-Address-List-programatically.aspx.
Take a look on JIntegra. I remember that they support of MS Exchange. Probably some API exists. Good luck.
You can use LDAP if you have access to that. Or PowerShell. But Henning is right EWS itself has pretty limited stuff here.

Uploading to Youtube via a proxy using the Java Youtube API

So I want to write a servlet which uploads a video to a youtube channel using the Java API, but I can't seem to find a way of specifying that I want to go through a proxy server. I've seen an example on this site where someone managed to do this using C#, but the Classes they used don't seem to exist in the Java API. Has anybody managed to successfully do this?
YouTubeService service = new YouTubeService(clientID, developerKey);
I'm new here so I'm unable to comment on posts (and a little late on this topic), but Jesper, I believe this is the C# sample that the original poster was talking about: How to upload to YouTube using the API via a Proxy Server
I can see no "direct" way of porting that example to Java though, since the GDataRequestFactory doesn't seem to have any proxy-related fields.
I was also having issues with the Java client Library with proxy in our application. Basically, the library picks up the global Java proxy settings:
System.getProperty("http.proxyHost");
System.getProperty("http.proxyPort");
but for some reason not everywhere. To be more precise, even with a proxy server properly configured in Java, YouTube authentication (calling service.setUserCredentials("login", "pwd")) would use a direct connection and ignore the proxy. But a video upload (calling service.insert(...)) would use the proxy correctly.
With the help of folks at the official YouTube API mailing list, I was able to nail this down. The issue is that the authentication is performed using SSL (HTTPS) and since there is a different set of properties for the HTTPS proxy, this didn't work. The fix is to simply set https.proxy* properties as well (in addition to http.proxy*), so that these point to a valid proxy server too:
System.getProperty("https.proxyHost");
System.getProperty("https.proxyPort");

Categories