开发者

Receiving data via a callback URL into my rails app

I'm trying to receive data from the Nexmo SMS API which can be found here:

a link

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.


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"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜