Twilio SMS integration.
Sms::Twilio provides a Twilio integration to be used to send SMS messages from Decidim using the Twilio APIs.
Add this line to your application's Gemfile:
gem "decidim-sms-twilio", github: "Pipeline-to-Power/decidim-module-ptp", branch: "main"
And then execute:
bundle
You need to add the followings to your .rbenv-vars:
Name | Description | option |
---|---|---|
TWILIO_ACCOUNT_SID | Account SID from twilio.com | Required |
TWILIO_AUTH_TOKEN | Auth token from twilio.com/console | Require |
TWILIO_SENDER | Sender number assigned to your account from Twilio | Required |
Please refer to Twilio documentation for more information.
Next, you need to add the followings to your secrets.yml file:
# Add the following to the end of your environment list:
twilio:
twilio_account_sid: <%= ENV["TWILIO_ACCOUNT_SID"] %>
twilio_auth_token: <%= ENV["TWILIO_AUTH_TOKEN"] %>
twilio_sender: <%= ENV["TWILIO_SENDER"] %>
Make sure you have enabled sms authentication option from system pannel.
To run the tests, run the following in the gem development path:
$ bundle
$ DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rake test_app
$ DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rspec
Note that the database user has to have rights to create and drop a database in order to create the dummy test app database.
In case you are using rbenv and have the
rbenv-vars plugin installed for it, you
can add these environment variables to the root directory of the project in a
file named .rbenv-vars
. In this case, you can omit defining these in the
commands shown above.
If you want to generate the code coverage report for the tests, you can use
the SIMPLECOV=1
environment variable in the rspec command as follows:
$ SIMPLECOV=1 bundle exec rspec
This will generate a folder named coverage
in the project root which contains
the code coverage report.