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

add feature for sending telegram notifications on expense create, update and delete and group creation. #252

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ NEXT_PUBLIC_ENABLE_CATEGORY_EXTRACT=true
OPENAI_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

### Telegram notifications

You can send telegram notifications when expenses are created, updated or deleted. This feature requires a bot token, which can be created from telegram's [BotFather](https://core.telegram.org/bots/features). To enable, set the following environment variables:

```.env
NEXT_PUBLIC_ENABLE_NOTIFICATIONS=true
TELEGRAM_API_URL=https://api.telegram.org
TELEGRAM_BOT_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

For a custom notification provider, you can substitute the TELEGRAM_API_URL with your own url.
Notifications will be sent as a GET request to {TELEGRAM_API_URL}/bot{TELEGRAM_BOT_TOKEN}/sendMessage with a json payload containing chat_id and text keys, where chat_id is taken from the group settings.

## License

MIT, see [LICENSE](./LICENSE).
15 changes: 15 additions & 0 deletions messages/de-DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "€, $, £…",
"description": "Wir benutzen es, um Beträge anzuzeigen."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Mitglieder",
"description": "Füge einen Namen für jedes Gruppenmitglied hinzu.",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "TV/Internet/Telefonie",
"Water": "Wasser"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "$, €, £…",
"description": "We’ll use it to display amounts."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Participants",
"description": "Enter the name for each participant.",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "TV/Phone/Internet",
"Water": "Water"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense {expenseTitle} was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "$, €, £…",
"description": "Lo usaremos para mostrar balances."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Participantes",
"description": "Ingresa el nombre de cada participante.",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "TV/Teléfono/Internet",
"Water": "Agua"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "$, €, £…",
"description": "Näytetään rahasummien yhteydessä."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Osallistujat",
"description": "Syötä jokaisen osallistujan nimi.",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "TV/Puhelin/Internet",
"Water": "Vesi"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "$, €, £…",
"description": "Nous l'utiliserons pour afficher les montants."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Participants",
"description": "Entrez le nom de chaque participant.",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "TV/Téléphone/Internet",
"Water": "Eau"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/it-IT.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "$, €, £…",
"description": "Lo useremo per visualizzare gli importi."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Partecipanti",
"description": "Immettere il nome per ciascun partecipante.",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "TV/Telefono/Internet",
"Water": "Acqua"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "PLN, zł, $, €, £…",
"description": "Użyjemy go do wyświetlania ilości."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Członkowie",
"description": "Podaj nazwę dla każdego członka.",
Expand Down Expand Up @@ -396,5 +401,15 @@
"TV/Phone/Internet": "TV/Telefon/Internet",
"Water": "Woda"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "$, €, £, RON …",
"description": "O vom folosi pentru a afișa sume."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Membri",
"description": "Adaugă numele fiecărui membru.",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "TV/Telefon/Internet",
"Water": "Apă"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "$, €, £…",
"description": "Этот символ будет использован для отображений денежных сумм."
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Участники",
"description": "Введите имя каждого участника.",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "ТВ/Телефон/Интернет",
"Water": "Вода"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/ua-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "₴, $, €, £..",
"description": "Ми будемо використовувати його для відображення сум"
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "Учасники",
"description": "Введіть ім'я кожного учасника",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "ТБ/Телефон/Інтернет",
"Water": "Вода"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
15 changes: 15 additions & 0 deletions messages/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
"placeholder": "$, €, £…",
"description": "我们根据这个显示相应的货币金额。"
},
"TelegramChatIdField": {
"label": "Telegram Chat Id",
"placeholder": "0000000",
"description": "We'll send expense notifications to this chat Id."
},
"Participants": {
"title": "群组成员",
"description": "输入每位成员的名字。",
Expand Down Expand Up @@ -397,5 +402,15 @@
"TV/Phone/Internet": "电视/手机/互联网",
"Water": "水"
}
},
"Notifications": {
"Expense": {
"created": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' for amount {groupCurrency}{expenseAmount} was created by {participantName}",
"updated": "[{groupName}]({groupUrl}): Expense '[{expenseTitle}]({expenseUrl})' was updated by {participantName}",
"deleted": "[{groupName}]({groupUrl}): Expense '{expenseTitle}' was deleted by {participantName}"
},
"Group": {
"created": "[{groupName}]({groupUrl}) has been created"
}
}
}
38 changes: 38 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading