Skip to content

Commit fc98eb0

Browse files
committed
initial telegram setup with webhook, remote event and notifier
1 parent 1922ba3 commit fc98eb0

24 files changed

+662
-89
lines changed

.env

+7
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,10 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
3535
# DATABASE_URL="mysql://app:[email protected]:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
3636
DATABASE_URL="postgresql://app:[email protected]:5432/app?serverVersion=15&charset=utf8"
3737
###< doctrine/doctrine-bundle ###
38+
39+
TELEGRAM_TOKEN=
40+
WEBHOOK_BASE_URL=
41+
42+
###> symfony/telegram-notifier ###
43+
# TELEGRAM_DSN=telegram://TOKEN@default?channel=CHAT_ID
44+
###< symfony/telegram-notifier ###

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ phpstan.neon
2222
/phpunit.xml
2323
.phpunit.result.cache
2424
###< phpunit/phpunit ###
25+
26+
http-client.private.env.json

.php-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8.2
1+
8.3

LICENSE

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2023 Christopher Hertel
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

chatbot-webhook.http

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
POST {{webhook-host}}/webhook/telegram.update
2+
Content-Type: application/json
3+
4+
{
5+
"update_id": 123456789,
6+
"message": {
7+
"message_id": 555,
8+
"from": {
9+
"id": {{chat-id}},
10+
"is_bot": false,
11+
"first_name": "Foo",
12+
"last_name": "Bar",
13+
"language_code": "en"
14+
},
15+
"chat": {
16+
"id": {{chat-id}},
17+
"first_name": "Foo",
18+
"last_name": "Bar",
19+
"type": "private"
20+
},
21+
"date": 1666538377,
22+
"text": "\/start",
23+
"entities": [
24+
{
25+
"offset": 0,
26+
"length": 6,
27+
"type": "bot_command"
28+
}
29+
]
30+
}
31+
}

composer.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"minimum-stability": "dev",
77
"prefer-stable": true,
88
"require": {
9-
"php": ">=8.2",
9+
"php": ">=8.3",
1010
"ext-ctype": "*",
1111
"ext-iconv": "*",
1212
"doctrine/doctrine-bundle": "^2.11",
@@ -24,6 +24,7 @@
2424
"symfony/property-info": "7.0.*",
2525
"symfony/runtime": "^7.0",
2626
"symfony/serializer": "7.0.*",
27+
"symfony/telegram-notifier": "7.0.*",
2728
"symfony/webhook": "7.0.*",
2829
"symfony/yaml": "^7.0"
2930
},
@@ -57,11 +58,14 @@
5758
"replace": {
5859
"symfony/polyfill-ctype": "*",
5960
"symfony/polyfill-iconv": "*",
61+
"symfony/polyfill-mbstring": "*",
6062
"symfony/polyfill-php72": "*",
6163
"symfony/polyfill-php73": "*",
6264
"symfony/polyfill-php74": "*",
6365
"symfony/polyfill-php80": "*",
64-
"symfony/polyfill-php81": "*"
66+
"symfony/polyfill-php81": "*",
67+
"symfony/polyfill-php82": "*",
68+
"symfony/polyfill-php83": "*"
6569
},
6670
"scripts": {
6771
"auto-scripts": {

0 commit comments

Comments
 (0)