以下是twilio短信双向消息的webhook。 每当我从手机回复短信时,下面的函数会被调用并打印from,message和messageSid,但它无法将twiml响应发送回电话号码。我在twilio消息日志中看不到任何日志。
require 'twilio-ruby'
require 'sinatra'
module Api
module V2
class TextableInboundController < ApplicationController
# Respond to incoming calls with a simple text message
def process_incoming
from = params["From"];
message = params["Body"];
messageSid = params["MessageSid"];
puts from
puts message
puts messageSid
twiml = Twilio::TwiML::Response.new do |r|
r.Message 'The Robots are coming! Head for the hills!'
end
twiml.text
#Send message to user
end
end
end
end