开发者

Receiving data via a callback URL into my rails app

开发者 https://www.devze.com 2023-03-31 17:03 出处:网络
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:

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

精彩评论

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