-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] Add Free Mobile notifier #35690
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
[Notifier] Add Free Mobile notifier #35690
Conversation
82e539a
to
0a37acb
Compare
|
||
public function supports(MessageInterface $message): bool | ||
{ | ||
return $message instanceof SmsMessage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about checking an additional information about the $message
as the payload is not exactly the same as others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Guikingone what do you mean?
like checking the sms phone is empty as it will be not used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By example but I'm more worried about the fact that the TwilioTransport use the same approach to detect if it can support SmsMessage
: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Notifier/Bridge/Twilio/TwilioTransport.php
I don't know if it's possible but it could be a good idea to differentiate both transport when it comes to detect if it can support the message ? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is the same implementation for Nexmo as well, so maybe there is another thing that differentiate the notifier event if it is « supported »
I did not look at the internal component code yet tbh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is that we can choose between providers that support sending SMS messages.
Here, the provider is a bit special as you can only send to your number. I think we need to add this phone number in the DSN that is then used here in the supports
method to trigger this Transport. It's then your responsibility to make this transport the first one. That way, if you are using the special number, the Free notifier is used, if not, it falls back to other SMS providers. And in any case, the SMS message can also be send by other providers if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok I see, I will improve this one
thank you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fabpot @Guikingone I've tried what you suggested, but I do not know if it is what both of you have in mind in term of implementation
also I added some tests (based on other transports)
PRs doc updated as well
0a37acb
to
2b0a5b8
Compare
I don't think this should be added. There are thousands of providers like this and adding them would make it unmaintainable. |
@stephanvierkant there is no thousands of ISP (it is the 2nd biggest of France), no. I'm 👍 with this addition, it feels absolutely legit to support biggest notification providers to me. |
39b3b67
to
edaef59
Compare
edaef59
to
1b8709e
Compare
test failures are not related
|
Thank you @noniagriconomie. |
This PR was squashed before being merged into the master branch. Discussion ---------- [Notifier] Add FreeMobile SMS entry Hi, I was reading this [blog post](https://symfony.com/blog/new-in-symfony-5-1-new-and-improved-integrations#notifier-component) and remind I have not yet added it to the doc [this feature](symfony/symfony#35690) Just a question as I am not sure where and how to document the fact that this sms notifier is a bit special, is it ok like this in the `versionadded code block`? or maybe it is better in a note afterward? Thank you Commits ------- 259c1e2 [Notifier] Add FreeMobile SMS entry
This PR was merged into the 5.2-dev branch. Discussion ---------- [Notifier] add doc for free mobile dsn | Q | A | ------------- | --- | Branch? | master (maybe 5.1 ? it is only code doc) | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix symfony/symfony-docs#13600 (comment) | License | MIT | Doc PR | Improve readme according to the linked comment I've taken info of my original PR #35690 (with some rewrite) Also the package was renamed, fixing the doc here symfony/symfony-docs#14057 Commits ------- eb067ed [Notifier] add doc for free mobile dsn
…rt (94noni) This PR was submitted for the 5.4 branch but it was squashed and merged into the 5.3 branch instead. Discussion ---------- [Notifier] Fix encoding of messages with FreeMobileTransport | Q | A | ------------- | --- | Branch? | 5.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix sending accents chars | License | MIT When I first [introduce this transport](#35690) I used to test it with basic text, now with some French accent I need this fix otherwise the accent chars are not sent Commits ------- 5760694 [Notifier] Fix encoding of messages with FreeMobileTransport
Add a new notifier (SMS) with the French Free Mobile provider.
It is a special notifier as it only send the SMS to the self user,
but I think it can be useful for notification alerting purposes (the way I use it already, and plan to use it with the component)
Provider doc: (🇫🇷 sorry)
https://mobile.free.fr/moncompte/index.php?page=options
Usage:
where:
LOGIN
is your Free Mobile loginPASSWORD
is the token displayed in the config panelPHONE
is your Free Mobile phone numberThen you can then use it like documented here https://symfony.com/doc/current/notifier/texters.html
ℹ️ As this is a special notifier, the
PHONE
provided inside the DSN mut be the same used here for$phone
valueVoilà!