Working on another blogpost on some design best-practices for workflows (stay tuned…) a promising idea came into my mind:
What about sending text messages to my mobile from workflows?

I guessed there are many SMS-Gateway-Services out there which provide any kind of SOAP or REST-API… (I want to leverage an existing plugin for vCO for quick results). So google came up with this nice discussion:
http://stackoverflow.com/questions/2383542/recommendations-for-sms-gateways-with-api-support
I decided to give https://www.clickatell.com a try, because they
- provide interational service
- provide multiple kinds of API
- seem to be reliable and widely used
- don’t force you in a contract/monthly plan for my limited test usage
What you need to reproduce this example:
- a clickatell account (I think it will work with most of the other SMS-Gateway services in a comparable fashion)
- the REST-Plugin for vCO installed in your Orchestrator environment (see details here: http://www.vmware.com/support/pubs/vco_plugins_pubs.html (Select HTTP-REST for the plugin-download and a bunch of examples)
Step-by-step…
I quickly signed-up for an account, used the web-form to send a test message to German) mobile number, and prepaid for some credits to be able to send via the API.
After that, I created a new access for the “HTTP”-API of clickatell (no special settings):
(You may open clickatell’s API Documentation now in background if you’re a read-first-try-then kind of guy.)
For myself I just started my vCO client and ran the “Add a REST host”-Workflow from the library, providing just a name and http://api.clickatell.com as URL:

The workflow finished sucessfully, I confirmed the new host in the Inventory:

Now I called the “Add a REST operation”-Workflow to invoke the API-Call to clickatell (based on their example given when creating the API account):

(instead of hardcoding my credentials I used the generic {parameter}-notation of the REST-plugin for all the necessary parameters like username, password, API-Id, …, so that I can re-use the operation later flexibly). The full “Template URL” value is:
/http/sendmsg?user={username}&password={password}&api_id={apiid}&to={tonr}&text={message}
When the operation was created (again: Confirm in Inventory-Tree) I started the “Invoke a REST operation” workflow providing all the input parameters:

aaand voila, 😎 seconds later the text messgae arrived on my mobile!  

Now, the real-world use-case:
Well, sending generic messages to a mobile from a vCO workflow is cool|geeky, but what for? For a realistic example I used the Workflow-Generation of the REST-Plugin to let vCO generate my very own “Invoke ‘send a text message'”-Workflow in my very own Workflow folder for easy re-usage:

So I was able to re-use the created workflow in my Snapshot-Hunter-Workflow… (you know the pain with backup software which accidentally forgets to cleanup the VM snapshots! :evil:)

(The first element to find these workflows leverages the xpath-filter of the VcPlugin.getAllSnapshots()-Method, see the discussion here: http://communities.vmware.com/thread/342686 and http://communities.vmware.com/message/1673575 )
At the end: After scheduling the workflow as Scheduled Task in vCO, starting from tomorrow I will get waked-up by my mobile receiving an text message from vCO when there are leftover snapshots from the nightly backups!

Summary
- Don’t fear any tasks integrating vCenter Orchestrator! When the external system provides an API, chances are that you get in run in a few minutes…
- Remember: less and simple workflow inputs make it easy to use, many and generic workflow inputs make it easy to re-use! (referencing the “Workflow Development Best Practices”-session as a shameless plug :mrgreen:)
- Sometimes it IS good to be creative|distracted when drafting a blog-post (expect the post I actually was working on soon…)
- Turn off your mobile when you want to sleep in!
- …and thank god I’m too tired to think about other use-cases for this…
(I will not make an Orchestrator & Ringtone joke!
I do not plan to provide a monthly subscription for my content, just text a SMS with “vCO Rockz!” to …..
And I better not search for an API for Asterisk (“If you want to execute workflow XYZ, press 1; for all other requests press 2” 8-O)
Download the example
These Workflows search your inventory for certain Snapshots, and call the clickatell-API to send a text message to your mobile if they found some.
(They will NOT run out-of-the-box, see corresponding post for details!)
Languages: |
Englisch |
Author: |
Joerg |
Platforms: |
vCO 4.x |
Category: |
Workflows, Actions and Packages |
Date: |
March 5, 2012 |
Be aware that it will NOT run out-of-the-box, because you have to add the REST-Host and the Operation in your environment! And: Don’t forget to set the necessary values for username, password, mobilenr, … in the configuration elements.You know that blogpost whith a great description of Configuration Elements, don’t you! 😛