diff --git a/server/api/helpers/actions/create-one.js b/server/api/helpers/actions/create-one.js
index eb9badf7..7e034448 100644
--- a/server/api/helpers/actions/create-one.js
+++ b/server/api/helpers/actions/create-one.js
@@ -38,6 +38,32 @@ const buildAndSendMessage = async (card, action, actorUser, send) => {
await send(markdown);
};
+const buildAndSendMessageForTelegramBot = async (card, action, actorUser, send) => {
+ const cardLink = `${card.name}`;
+
+ let html;
+ switch (action.type) {
+ case Action.Types.CREATE_CARD:
+ html = `${cardLink} was created by ${actorUser.name} in ${action.data.list.name}`;
+
+ break;
+ case Action.Types.MOVE_CARD:
+ html = `${cardLink} was moved by ${actorUser.name} to ${action.data.toList.name}`;
+
+ break;
+ case Action.Types.COMMENT_CARD: {
+ const commentedText =
+ action.data.text.length > 30 ? `${action.data.text.substring(0, 30)}...` : action.data.text;
+ html = `${actorUser.name} commented on ${cardLink}: ${commentedText}`;
+
+ break;
+ }
+ default:
+ return;
+ }
+ await send(html);
+};
+
module.exports = {
inputs: {
values: {
@@ -119,6 +145,15 @@ module.exports = {
buildAndSendMessage(values.card, action, values.user, sails.helpers.utils.sendSlackMessage);
}
+ if (sails.config.custom.telegramChatId) {
+ buildAndSendMessageForTelegramBot(
+ values.card,
+ action,
+ values.user,
+ sails.helpers.utils.sendTelegramMessage,
+ );
+ }
+
if (sails.config.custom.googleChatWebhookUrl) {
buildAndSendMessage(
values.card,