riemann.twilio

Forwards events to Twilio

twilio

(twilio)(twilio opts)(twilio twilio-opts msg-opts)

Returns a messenger, which is a function invoked with a phone number or a sequence of phone numbers and returns a stream. That stream is a function which takes a single event, or a sequence of events, and sends a message about them.

(def messenger (twilio)) (def text (messenger “+15005550006” “+15005550006”))

This messenger sends sms out via twilio using the twilio http api. When used it outputs the http response recieved from twilio.

(changed :state #(info “twilio response” (text %)))

The first argument is a map of the twilio options :account and :key. The second argument is a map of default message option (:from).

(def text (twilio {:account “id” :service-key “key”} {:from “+15005550006”}))

If you provide a single map, the messenger will split the twilio options out for you.

(def text (twilio {:account “id” :service-key “key” :from “+15005550006”}))

By default, riemann uses (body events) to format messages. You can set your own body formatter functions by including :body in msg-opts. These formatting functions take a sequence of events and return a string.

(def text (twilio {} {:body (fn [events] (apply prn-str events))}))

twilio-message

(twilio-message twilio-opts msg-opts events)

Send a message via Twilio