Skip to content

Instantly share code, notes, and snippets.

@totzyuta
Created March 2, 2016 05:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save totzyuta/86bd470a2b5beff9f0fb to your computer and use it in GitHub Desktop.
Save totzyuta/86bd470a2b5beff9f0fb to your computer and use it in GitHub Desktop.
require 'twilio-ruby'
class ShortMessageService
ACCOUNT_SID = 'xxxxxxxxxxxxxxxxxxxxxxxxx'
AUTH_TOKEN = 'xxxxxxxxxxxxxx'
FROM = '+xxxxxxxxx'
def self.send_short_message(to, body)
client = Twilio::REST::Client.new ACCOUNT_SID, AUTH_TOKEN
client.account.messages.create({
from: FROM,
to: to,
body: body
})
end
end
ShortMessageService.send_short_message("+xxxxxxxxx", "Hello by twilio")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment