SMS

If you want to verify your users by sending a verification code via SMS you need to provide a SMS gateway service class through the initializer.

This service can also be used by some spaces (such as Votings), and external modules could use it too.

An example class would be something like:

class MySMSGatewayService
  attr_reader :mobile_phone_number, :code
  def initialize(mobile_phone_number, code)
    @mobile_phone_number = mobile_phone_number
    @code = code
  end
  def deliver_code
    # Actual code to deliver the code
    true
  end
end

Then you’ll need to configure it in the Decidim initializer:

  config.sms_gateway_service = "MySMSGatewayService"

You can find an example on how this is set up at DecidimBarcelona’s app/services/sms_gateway.rb. Your final implementation will depend on how your SMS provider works.