Tutorial: Create your own Twitter Application with a vCO workflow in a few minutes

If you thought vCO was powerful, think again. The new SOAP and REST plug-in are taking it to new levels. With the following tutorial you can in as little as 30 minutes and without a single line of code (yes really !) create a workflow that will update your Twitter status. If you never had a chance to do a vCO Tutorial this one is really an easy one for starting.

Why Twitter ? Because this is a really popular application offering a public REST web service and today's tutorial is about leveraging the vCO REST plug-in. Going through this article will help you to understand how to orchestrate various REST web services.

Pre-requisite :

Having a Twitter account. If you do not have one just create one for this tutorial, it only takes a couple of minutes.

Download and install the REST plug-in

When dealing with web services the first thing to do is to find how to authenticate. While some web services may allow to get information without authenticating updates requires it. For Twitter it is located here : https://dev.twitter.com/. If you have time to spend read it, otherwise skip that part to get going.

Go to https://dev.twitter.com/apps. If you were not authenticated log in.

Register a new App as follows (be inventive for the application name since these need to be unique and less than 32 characters).

alt

alt

Once done Copy / Paste the Consumer key and secret separately to a test file.

Click on "my Access Token"

alt

Copy / Paste the Consumer key and secret separately to a test file.

Make a little note of the actual time so you can have a record on how long you had to work. Open your vCO Client and start the following workflow.

alt

Set a name for the host, the https://api.twitter.com/1.1 URL and OAuth 1.0 type of authentication (if you wonder what it is, it is because you did not read the Twitter API doc above).

Copy and paste from your text file your consumer key, consumer secret, access token and access token secret. Submit.

alt

(NB: this screenshot contains previous Twitter API)

We have created the host connection, now we want to create a REST operation. Start the following workflow.

alt

Select the parent host. Give a name for the operation such as "Update my Twitter Status". In the Template URL enter : /statuses/update.json?status={status}.

HTTP method is POST and content type is application/json. Submit. The URL is the operation to be taken, the curly brackets define the parameter to be passed (here a string indicating your status).

alt

(NB: this screenshot contains previous Twitter API)

Now go in the inventory tab. Unfold it as below.

alt

Right click on Update Twitter Status (Your menu may only show the two first items, displaying the workflows in the menu is a tools manu / User preferences / Inventory Option). Select "invoke REST operation" or "Run workflow" and then "invoke REST operation".

alt

In Parameter 1 Enter your text message. For example "@vCOTeam Sending my first workflow powered tweet !". Make sure you keep this under 140 characters since this is Twitter limit.

Content Type is application/xml and keep content blank. Submit.

alt

(NB: this screenshot contains previous Twitter API)

Done ! If you go on twitter.com or any other twitter client you will see your message.

alt

Note the time.

Now we want a workflow doing the Update. Start the following workflow:

alt

Select the update operation. Make sure you have the right content type. Give a name and a folder for the workflow. Submit.

alt

(NB: this screenshot contains previous Twitter API)

Check in the Folder you selected. A new workflow is here. You just ran a workflow that generated another workflow !!!

alt

If you start it you will notice that besides the status message it is expecting a content Twitter is not using. Lets fix that.

alt

Right Click / Edit the workflow. Look at the schema. This is what was generated automatically.

alt

Go in the input tab. Right click on the content input and select "Move as attribute". This converts the input we did not want into an attribute (a variable for the workflow).

alt

Click on the presentation tab, select the "Request Content group" and then the red cross to delete it. This was the "Request Content section" in the screenshot above.

alt

Save and quit. Now you have a workflow to update your twitter Status that you run or insert in your other workflows.

Note your time.

For example you can send twitter update on workflows failure as a way to alert all your followers something went bad (a bit silly but you get the idea of what you could do with the REST based applications in your environment.).

alt

Please comment on the article on how long it took you to complete this tutorial.