it works if there is a "assignedUser"
but in the email generated by the system, field, the “assignedUser” field is empty
user is in the “assignedUsers”
Telegram notifications
Collapse
X
-
That's not what I said.
You can do it in this way
$chatId = assignedUser.telegramGroupChatId;
Edit:Code:{ "chat_id": "{$$chatId}*, "text": "*{$subject}*\nDate: {$dateSent}\nTest: {$body}", "parse_mode": "HTML", "disable_web_page_preview": "True" }
Are you using a multiple assigned users field?
The problem is that as far as I know there is no way to make a bot to sendMessage to multiple chat id at the same time, since you are using an assignedUsers field you would retrieve more than 1 chat id, as such you would need to create a custom endpoint to do so (a simple php script would do just fine)
In alternative you can extract the first result in the array and send the notification to just the first assigned user.
Last edited by Kharg; 07-09-2024, 09:57 AM.Leave a comment:
-
I also tried to extract the value using a formula, but it didn’t work:
$chatId = record\findRelatedOne('User', assignedUsersIds, 'telegramGroupChatId');Leave a comment:
-
this won't work, "assignedUser" is empty and the user is listed in the Multiple Assigned Users fieldCode:{ "chat_id": "{$assignedUser.telegramGroupChatId}", "text": "*{$subject}*\nDate: {$dateSent}\nTest: {$$bbody}", "parse_mode": "markdown", "disable_web_page_preview": "True" } -
Telegram notifications
I want to duplicate Notifications
(In-app and email notification settings) in telegrams to users.
The logic is simple, after the system sends an alert, Workflows forwards the message to a telegram.
The user has a Varchar type field "telegramGroupChatId" which I want to extract using a formula and substitute it into Payload
$chatId = assignedUser.telegramGroupChatId;
the problem is that I can't get the "telegramGroupChatId" value from the user, assigned User is not filled by the system but added to assigned UsersCode:{ "chat_id": "$$chatId", "text": "*{$subject}*\nDate: {$dateSent}\nTest: {$body}", "parse_mode": "HTML", "disable_web_page_preview": "True" }Tags: None

Leave a comment: