Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Sendethics possibility to the sms gateway #605

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

AyakorK
Copy link
Contributor

@AyakorK AyakorK commented Oct 9, 2024

🎩 Description

This adds the possibility of sending messages through Sendethics api which has a different behaviour from previous providers like ÉtoileDièse or Twilio

📌 Related Issues

Link your PR to an issue

Testing

Describe the best way to test or validate your PR.

Creation of the Instance

  • Create a .env
  • Fill in those data (Please note that you can test both of Sendethics or [Twilio, EtoileDièse] depending what you need to test there
# SENDETHICS 
SMS_GATEWAY_MB_API_KEY=<your_api_key>
SMS_GATEWAY_MB_ACCOUNT_ID=<your_account_id>

# ETOILEDIESE OR TWILIO
SMS_GATEWAY_USERNAME=<username_on_provider>
SMS_GATEWAY_PASSWORD=<password_on_provider>

# GLOBAL ENV VARS
SMS_GATEWAY_SERVICE="Decidim::SmsGatewayService" # Mandatory to be this one
SMS_GATEWAY_URL="<url_to_use>" # Please make sure this does not end with a "/" otherwise it will cause errors
  • Setup your app

🚨 If you have to change your .env you'll need to restart your app to apply changes !

Example:

  • Log in as admin
  • Access Backoffice
  • Go to organization settings
  • Go to authentication settings
  • Enable authentication using SMS
  • Go to participatory processes
  • Access participatory process
  • Access settings from a budget component
  • Make sure you can vote without the zipcode (otherwise won't work)
  • Go to front office
  • Access the budget and try to vote
  • Fill in your phone number and try to send the SMS
  • Make sure you receive the message on your phone

Tasks

  • Add specs
  • Add env vars
  • Modify the service to add the behavior from Sendethics

📷 Screenshots

Please add screenshots of the changes you're proposing if related to the UI

@AyakorK AyakorK marked this pull request as ready for review October 10, 2024 08:32
@luciegrau luciegrau added the release: v2.5 Candidate for 2.5 release label Oct 11, 2024
Copy link
Contributor

@Quentinchampenois Quentinchampenois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will continue this PR

true
end

def build_request
if @url.include?("services.message-business.com")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer to define a dedicated class implementing an interface SmsGateway with method request callable rather than if / else condition

Copy link
Member

@moustachu moustachu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor later 🕐

@luciegrau luciegrau merged commit b331c3b into develop Nov 7, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: v2.5 Candidate for 2.5 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants