-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Notifier] [Telegram] Add support for local API server #57769
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
base: 7.4
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -14,6 +14,27 @@ where: | |||||||
- `TOKEN` is your Telegram token | ||||||||
- `CHAT_ID` is your Telegram chat id | ||||||||
|
||||||||
Interacting with local API server instead of official Telegram API | ||||||||
------------------------------------------------------------------ | ||||||||
|
||||||||
If such a case is needed, you can replace the `default` keyword in the DSN | ||||||||
with the desired domain/IP address of your local API server. You may also want to | ||||||||
disable the bridge's default behavior of using `https` protocol as local API servers | ||||||||
can only accept `http` traffic. | ||||||||
|
||||||||
Example: | ||||||||
``` | ||||||||
TELEGRAM_DSN=telegram://TOKEN@localhost:5001?channel=CHAT_ID&disable_https=1 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In AmazonSns, this option is named symfony/src/Symfony/Component/Notifier/Bridge/AmazonSns/AmazonSnsTransportFactory.php Line 34 in 9ad4353
This would become:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know you've already changed the name in response to our request #57769 (comment), but perhaps the consistency with other bridges hadn't been examined. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like |
||||||||
``` | ||||||||
|
||||||||
Caution: Disabling the use of the `https` protocol can pose a security risk. | ||||||||
You should only do this if your local API server is hosted somehow internally | ||||||||
and the traffic will remain within a secure environment. | ||||||||
|
||||||||
Otherwise, you may want to implement a TLS-termination proxy in front of | ||||||||
your server for handling the encryption and decryption of the traffic, | ||||||||
So you can continue using it normally over `https` protocol. | ||||||||
|
||||||||
Adding Interactions to a Message | ||||||||
-------------------------------- | ||||||||
|
||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,10 +26,16 @@ public function createFactory(): TelegramTransportFactory | |
|
||
public static function createProvider(): iterable | ||
{ | ||
yield [ | ||
'telegram://host.test?channel=testChannel', | ||
'telegram://user:[email protected]?channel=testChannel', | ||
]; | ||
yield ['telegram://host.test?channel=testChannel', 'telegram://user:[email protected]?channel=testChannel']; | ||
|
||
// Tests for `disable_https` option | ||
yield ['telegram://host.test?channel=testChannel&disable_https=1', 'telegram://user:[email protected]?channel=testChannel&disable_https=1']; | ||
yield ['telegram://host.test?channel=testChannel&disable_https=1', 'telegram://user:[email protected]?channel=testChannel&disable_https=yes']; | ||
yield ['telegram://host.test?channel=testChannel&disable_https=1', 'telegram://user:[email protected]?channel=testChannel&disable_https=on']; | ||
yield ['telegram://host.test?channel=testChannel', 'telegram://user:[email protected]?channel=testChannel&disable_https=0']; | ||
yield ['telegram://host.test?channel=testChannel', 'telegram://user:[email protected]?channel=testChannel&disable_https=no']; | ||
yield ['telegram://host.test?channel=testChannel', 'telegram://user:[email protected]?channel=testChannel&disable_https=off']; | ||
yield ['telegram://host.test?channel=testChannel', 'telegram://user:[email protected]?channel=testChannel&disable_https=random-string']; | ||
} | ||
|
||
public static function supportsProvider(): iterable | ||
|
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 option should be added to this list, similar to this: https://github.com/symfony/symfony/blob/7.3/src/Symfony/Component/Notifier/Bridge/AmazonSns/README.md#dsn-example