Wednesday, June 17, 2015

iMacro in action with APIs

Hello there, I know it’s been a long time since I am posting something new out here. Anyways, I am here and let’s start with something cool.

Today, I am going to open a whole new domain of possibilities where you can actually use your iMacro code for doing cool this; things that cool developer dudes (nerds) do often and charge a huge amount of money for that. ,, wait,, what’s coming ahead? Is it like some computer language tutorial or some cheap selling campaign? Well, not exactly, today’s section focuses upon utilization of iMacro scripting (simple scripting) for doing complicated activities without understanding or actually going through lengthy processes .

I am sure you must have heard of API, it’s a common term these days; it’s a fancy name given to a technique used for data/information transformation from one website to another. Let’s say you want to talk to your twitter account from your website, what will you do for it? Twitter allows standalone interface where you can login, see and send tweets and much more but what if you want to add this functionality in to your website so that whenever there is a news update from your company, it should get updated at your twitter account. Now, this is the place where API comes in to action; twitter, just like thousands of other website allows this functionality using its public API where you get free access to their API by registering and blah blah blah, oh crap, there are a bunch of tutorials out there, go and Google it yourself. As I said earlier and as you already know from my previous posts that I only share solutions that a common men can do (of course basic understandings of iMacro is must :P) so lets see how it is done.

There is a website called ‘www.apigee.com’, it’s a platform where you can actually access thousands of APIs of different websites including all of your favorite social media platforms. Today, we are going to see how easy it is to send periodic tweets using iMacro combined with apigee functionality; you will have to register a free account first and once you login, you will land at their home page with list of API’s that they have in their inventory, you can add more however let’s just stick with already listed ones. Now go through the lists and click ‘twitter’:

 An API allows interaction with the parent website and each API has different functions, as in our case, it allows getting data like tweet counts, friend lists, changing data from timeline, re-tweeting, posting a new tweet and many more functions, you must be seeing all these details if you’ve been following me.

Since you’ve got basic idea, let’s go for the real part where you actually link an API. There is a menu called ‘Console’ at the top, click it and click Authentication select box and select ‘OAuth 1’, it will show a popup, asking you to login your twitter account and allow it’s access to API, just hit ok/yes/authorize button (you know). Here I have allowed access to mine:


Now click “Select an API method” and select ‘Update.json’:



Now type the actual tweet text and click “Send” button:


And that’s it, go check your twitter account, you have actually posted a tweet using Twitter API :P

Keep in mind that twitter has limit of 160 characters, you can’t post a long tweet.

There are thousands of other APIs, some are listed at apigee and rest are more like personal however you can still utilize them using apigee if you have access to them. Here is the code for sending bulk tweets using iMacro:

VERSION BUILD=8920312 RECORDER=FX
'
'    Instructions:
'    Create a file in datasource folder, named Tweetsfile.csv; first row contains header and there is only 1 column
'
CmdLine !DataSource Tweetsfile.CSV
Set !DataSource_Columns 1
Set !Loop 2
Set !DataSource_Line {{!Loop}}

TAG POS=1 TYPE=INPUT:TEXT FORM=ID:request_params ATTR=ID:apigee_console_0_status CONTENT={{!Col1}}
TAG POS=1 TYPE=BUTTON FORM=ID:console_request ATTR=ID:send_button
TAG POS=1 TYPE=A ATTR=ID:control_request_params
Wait Seconds=3

And more scheduling auto-tweets, checkout my previous post about scheduling iMacro scripts!

No comments:

Post a Comment