Skip to content

Instantly share code, notes, and snippets.

@jarodreyes
Created February 26, 2015 03:20
Show Gist options
  • Save jarodreyes/1e7c0e01711b06ae368e to your computer and use it in GitHub Desktop.
Save jarodreyes/1e7c0e01711b06ae368e to your computer and use it in GitHub Desktop.
3rdSpace Candy Machine
# Register a subscriber through the web and send verification code
route :get, :post, '/sms-register' do
@phone_number = Sanitize.clean(params[:From])
@body = params[:Body]
puts @error
if @error == false
user = AnonUser.first_or_create(:phone_number => @phone_number)
if not @body.nil?
user.messages.create(:body => @body)
user.save
end
end
@msg = "Hi! I am the candy machine. Please let me know what would you like to be in the candy machine next month?"
message = @client.account.messages.create(
:from => @cowork_number,
:to => @phone_number,
:body => @msg
)
puts message.to
end
@minerick
Copy link

minerick commented Mar 2, 2015

You're the man, Jarod.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment