An IronWorker for sending sms's and making calls.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This example shows you how to send and schedule SMS messages with Twilio via IronWorker. IronWorker for scheduling and Twilio for sending the SMS's. Using IronWorker not only gives you scheduling capabilities, but also allows you to do some pre-processing before hand to generate custom messages for each of your users and you can parallelize all that work without any extra effort.

There are two common scenarios:

  1. you want to schedule a single SMS/call to go out at some point in the future.
  2. you want to schedule a recurring task that will send SMS's or make call on some recurring schedule, like nightly for example.

We'll cover both of these.

Getting Started

Add this worker to your account

First install the iron_worker_ng gem:

$ gem install iron_worker_ng

From the command line:

$ iron_worker upload

Sending a Text Now or in the Future

You can queue up tasks for it in any language. Check out our Client Libraries in the language of your choice to make it easy, but here's an example using curl:

$ curl -d '{"tasks": [{"code_name": "twilio", "payload": "{ \"sid\": \"YOUR TWILIO SID\", \"token\": \"YOUR TWILIO TOKEN\", \"from\": \"5555555555\", \"to\": \"5555555555\", \"body\": \"Hello from IronWorker!\" }"}]}' --header "Authorization: OAuth YOUR_TOKEN" --header "Content-Type: application/json"

Now go look at HUD to see the task and the log.

And here's how to queue up tasks using Ruby (from enqueue.rb):

require 'iron_worker_ng'
@iw =
# This is the input required for the worker
payload = {
    sid: "YOUR TWILIO SID",
    token: "YOUR TWILIO TOKEN",
    from: "5555555555", # YOUR TWILIO PHONE NUMBER
    to: "5555555555",
    body: "Hello from IronWorker!"
# delay is the number of seconds to wait before running the task, you can change this if you want it to
# run in the future.
delay = 0
task = @iw.tasks.create("twilio", payload, {:delay => delay})

Making a call

Just change the payload by adding type and url parameters, for example, your new payload might be.

payload = {
    sid: "YOUR TWILIO SID",
    token: "YOUR TWILIO TOKEN",
    from: "5555555555", # YOUR TWILIO PHONE NUMBER
    to: "5555555555",
    type: "call",
    url: ""