Sha256: 02aadea2bb034c254b91524e7bccbb9b635e2a5c017d3878db89188902266421

Contents?: true

Size: 1.06 KB

Versions: 12

Compression:

Stored size: 1.06 KB

Contents

= 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 xref:configure:initializer.adoc[initializer].

This service can also be used by some spaces (such as xref:admin:spaces/votings.adoc[Votings]), and external modules could use it too.

An example class would be something like:

[source,ruby]
....
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:

[source,ruby]
....
  config.sms_gateway_service = "MySMSGatewayService"
....

You can find an example on how this is set up at https://github.com/AjuntamentdeBarcelona/decidim-barcelona/blob/672f5a8938d884940899b4304f0a17e25d42d2a0/app/services/sms_gateway.rb[DecidimBarcelona's app/services/sms_gateway.rb]. Your final implementation will depend on how your SMS provider works.

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-0.27.9 docs/modules/services/pages/sms.adoc
decidim-0.27.8 docs/modules/services/pages/sms.adoc
decidim-0.27.7 docs/modules/services/pages/sms.adoc
decidim-0.27.6 docs/modules/services/pages/sms.adoc
decidim-0.27.5 docs/modules/services/pages/sms.adoc
decidim-0.27.4 docs/modules/services/pages/sms.adoc
decidim-0.27.3 docs/modules/services/pages/sms.adoc
decidim-0.27.2 docs/modules/services/pages/sms.adoc
decidim-0.27.1 docs/modules/services/pages/sms.adoc
decidim-0.27.0 docs/modules/services/pages/sms.adoc
decidim-0.27.0.rc2 docs/modules/services/pages/sms.adoc
decidim-0.27.0.rc1 docs/modules/services/pages/sms.adoc