cooperlyt / keycloak-phone-provider

A Keycloak provider for phone and SMS
MIT License
286 stars 159 forks source link

Allow sending message by MessagingServiceSid for TwilioSmsSenderServiceProvider #76

Open youb93 opened 1 year ago

youb93 commented 1 year ago

Today we can send message with a phoneNumber/orce MessageServiceId but the new PhoneNumber(twilioPhoneNumber) is ambiguous as we can see inside keycloak-phone-provider/keycloak-sms-provider-twilio/src/main/java/cc/coopersoft/keycloak/phone/providers/sender/TwilioSmsSenderServiceProvider.java

public void sendMessage(String phoneNumber, String message) throws MessageSendException { Message msg = Message.creator( new PhoneNumber(phoneNumber), new PhoneNumber(twilioPhoneNumber), message).create();

Maybe we can think about this feature : https://www.twilio.com/docs/messaging/services#:~:text=Send%20a%20message%20with%20a%20Messaging%20Service,-If%20you%20use&text=However%2C%20instead%20of%20including%20a,based%20on%20your%20service's%20configuration Which allows to send a message with a configured messaging service.

and think about changing naming of phoneNumber for something more generic or think about handling messaging service id in an other way.