Class: Nuntius::InboundMessages::TwilioInboundSmsesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Nuntius::InboundMessages::TwilioInboundSmsesController
- Defined in:
- app/controllers/nuntius/inbound_messages/twilio_inbound_smses_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
Point twilio to you nuntius mount path (/nuntius/inbound_messages/twilio_inbound_smses) { ‘ToCountry’ => ‘NL’, ‘ToState’ => ”, ‘SmsMessageSid’ => ‘SMb711289e438f577f230f5837e9c74a08’, ‘NumMedia’ => ‘0’, ‘ToCity’ => ”, ‘FromZip’ => ”, ‘SmsSid’ => ‘SMb711289e438f577f230f5837e9c74a08’, ‘FromState’ => ”, ‘SmsStatus’ => ‘received’, ‘FromCity’ => ”, ‘Body’ => ‘St’, ‘FromCountry’ => ‘NL’, ‘To’ => ‘+3197014204768’, ‘MessagingServiceSid’ => ‘MG790b6bd09f119b54ffb7f03b8841b1c9’, ‘ToZip’ => ”, ‘NumSegments’ => ‘1’, ‘MessageSid’ => ‘SMb711289e438f577f230f5837e9c74a08’, ‘AccountSid’ => ‘ACf54dd7a47a8011d65b54d472a7190549’, ‘From’ => ‘+31612345678’, ‘ApiVersion’ => ‘2010-04-01’, ‘controller’ => ‘nuntius/inbound_messages/twilio_inbound_smses’, ‘action’ => ‘create’ }.
Instance Method Details
#create ⇒ Object
Point twilio to you nuntius mount path (/nuntius/inbound_messages/twilio_inbound_smses) { ‘ToCountry’ => ‘NL’,
'ToState' => '',
'SmsMessageSid' => 'SMb711289e438f577f230f5837e9c74a08',
'NumMedia' => '0',
'ToCity' => '',
'FromZip' => '',
'SmsSid' => 'SMb711289e438f577f230f5837e9c74a08',
'FromState' => '',
'SmsStatus' => 'received',
'FromCity' => '',
'Body' => 'St',
'FromCountry' => 'NL',
'To' => '+3197014204768',
'MessagingServiceSid' => 'MG790b6bd09f119b54ffb7f03b8841b1c9',
'ToZip' => '',
'NumSegments' => '1',
'MessageSid' => 'SMb711289e438f577f230f5837e9c74a08',
'AccountSid' => 'ACf54dd7a47a8011d65b54d472a7190549',
'From' => '+31612345678',
'ApiVersion' => '2010-04-01',
'controller' => 'nuntius/inbound_messages/twilio_inbound_smses',
'action' => 'create' }
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/nuntius/inbound_messages/twilio_inbound_smses_controller.rb', line 36 def create = Nuntius::InboundMessage.find_or_create_by!(transport: "sms", provider: "twilio", provider_id: params[:SmsSid]) .from = params[:From] .to = params[:To] .text = params[:Body] . = params .save! twiml = Nuntius::DeliverInboundMessageService.perform(inbound_message: ) # twiml = Twilio::TwiML::MessagingResponse.new do |resp| # resp.message body: 'The Robots are coming! Head for the hills!' # end render body: twiml.to_s, content_type: "text/xml", layout: false end |