As noted yesterday I have been waiting on Twitter to provide xAuth access. They declined, saying it was not appropriate. I’m not really sure why.
No matter, I decided to make a small DLL to simplify Tweeting from Macro Scheduler. It uses the full oAuth interface.
Implementing oAuth in Macro Scheduler code would require lots of VBScript code and would be very complicated (although doable in theory). So instead I decided to create a DLL which you can use in Macro Scheduler to tweet in one line of code.
You can download it here.
And then to post a status update all you need to do is something like this:
Let>message=Hello from Macro Scheduler LibFunc>%SCRIPT_DIR%\tweetlib.dll,UpdateStatus,r,message,buff,1024
Note that the first time you call UpdateStatus you will be asked to log into Twitter and click “Allow” to authorise Macro Scheduler to access your account. You will then be given a PIN to enter. You only need to do this once. If you ever need to revoke access and start over call the RemoveCredentials function. Your Twitter username and password are NOT stored anywhere. This uses the oAuth authorisation scheme which provides an access token. It is the access token which is stored and this only allows Macro Scheduler to access the API for your account.
The return buffer will contain the XML of the status update operation if successful or an error message if not.
See readme.txt and sample .scp in the zip file. Enjoy.
Related posts:
That’s great Marcus. Nice one.
Quick question: If this were included in a script to be compiled – Would the tweetlib.dll then be required at installation on a new user’s machine? Presumably the dll would not be automatically included in the compiled script?
Hi Phil,
Correct, the DLL would not be included in the EXE so would either need to be distributed with it (could be zipped up or you could use an installer like Inno Setup) or you could import it into the script with Tools/Import Binary File and then use ExportData to extract it at runtime.
Marcus,
This is GREAT! I would be especially interested in being able to use the DM (Direct Message) API.
Hey, for that matter, looking forward to your chipping away at (or finding a generalized parameterization means to) access the entire API.
But, to the point, DM please!…. when you are not too busy helping with and enjoying Maria Christine! While programmatic tweeting to the world is important for lots of folks, there are MANY situations where DM’s private messaging is VERY useful especially in business, in particular microenterprise and small business networks with remote team membership.
Thanks…
Sohodojo Jim and Timlynn
P.S. The full API in a DLL would be a very interesting a salable new MS Add-on product. It sure could open up a significant new customer base of the hyper-addicted TechnoTweeters.
That’s already possible. Set the message as follows:
d @username Hello, this is a DM
E.g.:
Let>message=d @marcustettmar Hello!
LibFunc>%SCRIPT_DIR%\tweetlib.dll,UpdateStatus,r,message,buff,1024
Similarly a “mention” can be sent by setting the message to:
@username this is a mention message
Hi Marcus… Cool, thanks for the quick and helpful reply. That sure takes care of sending DMs. I was thinking that having the other DM APIs would allow MS to function as a programmable Tweet-based team messaging app. That would be really useful.
Sure. I could add support for the rest of the API. But need to gauge demand first, what with all other priorities.
Hi Marcus,
This project looks like something I could use in my own self-educational attempt to build a Windows Twitter client. Is the source for your DLL available, or if not is there a function list? Thanks!
The functions in the DLL are documented in the readme file in the zip.