通过回调 URL 将数据接收到我的 Rails 应用程序中
我正在尝试从 Nexmo SMS API 接收数据,可以在此处找到该数据:
我有一个包含以下方法的 MessagesController:
def external_message
@message.text = params[:message]
@message.recipient = params[:to]
@message.api_message_id = params[:messageId]
end
我是否以正确的方式处理此问题?我知道我还需要修改routes.rb 文件,但我仍然不确定从哪里开始。
真的,真的很感谢任何帮助/指导。
I'm trying to receive data from the Nexmo SMS API which can be found here:
I have a MessagesController which contains the method:
def external_message
@message.text = params[:message]
@message.recipient = params[:to]
@message.api_message_id = params[:messageId]
end
Am I going about this in the right way? I know that I will also need to amend the routes.rb file but I'm still not sure where to start there either.
Really, really appreciate any help/guidance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这看起来是正确的。
从 Nexmo 文档看来,您可以使用它们定义自己的回调 URL(这相当常见)。因此,如果您将回调网址定义为
http://mysite/nexmo_api
,您的路线将为:get "nexmo_api" => “消息#external_message”
Yes, this looks correct.
It looks like from the Nexmo documentation you define your own callback URL with them (this is fairly common). So if you define your callback url to be
http://mysite/nexmo_api
, your route would be:get "nexmo_api" => "messages#external_message"