SMSv2 RubyOnRails

From CDYNE Wiki
Jump to: navigation, search

Ruby On Rails calling a WCF Webservice using REST and JSON.

def deliver_sms(phone,message)
payload ={}
phone_numbers =[phone]
smsrequest = {"Message" => message ,"PhoneNumbers" => phone_numbers, "AssignedDID" => 'MYDID'}
smsrequests =[smsrequest]
payload = {}
payload["LicenseKey"] ="KEY"
payload["SMSRequests"] =smsrequests
http = Net::HTTP.new("sms2.cdyne.com",80)
header ={}
header['Content-Type'] ='application/json'
req = Net::HTTP::Post.new("/sms.svc/AdvancedSMSsend",header)
puts "===================SMS====================="
puts payload.to_json
puts "================SMS========================"
req.body =payload.to_json
response =http.request(req)
puts response
end
Personal tools
Namespaces

Variants
Actions
Navigation
Tools

Trial Key