Tag: nexmo

Rails – 如何使用nexmo api通过SMS发送确认代码

我们正在创建一个用于实现Nexmo API的Rails应用程序。 在注册过程中,我们需要使用Nexmo API从服务器端通过SMS向用户发送确认代码。 但我们对此并不了解。 我们只想为印度实现此function。 我使用过https://github.com/dotpromo/nexmos gem,我的代码是: # Gemfile gem ‘nexmos’ #sms_controller.rb: class SmsController < ApplicationController def new @sms = Sms.new end def createclient = ::Nexmos::Message.new('#', '#') res = client.send_text(from: '+910000000000', to: '+910000000000', text: 'Hello world!') if res.success? puts "ok" else puts "fail" end end end 我已将“密钥”和“秘密”的凭据用于“#”,并替换为我的电话号码。 但它不起作用。 即使在未将SMS发送到其他号码之后,也正在执行成功块。 任何人都可以指导我们实施吗?