Sunday, January 25, 2015

Groovy Twilio SMS

Very simple Groovy script that sends a message via Twilio APIs...

@Grab(group='com.twilio.sdk', module='twilio-java-sdk', version='3.4.6')
import com.twilio.sdk.TwilioRestClient
import org.apache.http.message.BasicNameValuePair
// Find your Account Sid and Token at twilio.com/user/account
ACCOUNT_SID = 'ACbee9cae6cca2b82845e057571236378e'
AUTH_TOKEN = '811da513032f1f8866e9bcb127b167cd'
client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN)
// Build a filter for the MessageList
params = []
params << new BasicNameValuePair("Body", "Hey!")
params << new BasicNameValuePair("To", "+15005550006")
params << new BasicNameValuePair("From", "+15005550006")
message = client.getAccount().getMessageFactory().create(params)
println message.getSid()

1 comment:

  1. A phone call is a phone bring in which somebody converses with a few individuals in the meantime. The phone calls might be intended to permit the called gathering to partake amid the call, or the ring might be set so that the called party simply listens into the call and can't talk. It is some of the time called ATC (sound video chat).
    Conference Calling Plugins

    ReplyDelete