How to make Trigger Action by Reaction Posted on MS Teams - botframework

I am making bot works for Microsoft Teams.
Goal: To make bot to detect reaction posted for any messages in the user's MS teams channel.
Problems:
Using onReactionsAdded in activityhandler(MS BotFramework) , my bot detects the reaction posted only for the bot messages
Is there any possible way to make trigger action by posting reaction for users' posts in MS Teams?

This is similar to the fact that you Bot won't receive every single message posted in the channel / group chat - only those that "#mention" your bot. It's different in a 1-1 chat with the bot though - there it will receive everything. If you want to make sure you get every single reaction, you'd need to call the Graph for that. See Get a reply to a channel message as an example - right near the bottom of the page it shows "reactions" (it's empty in that example).

#Cambria a Bot receive's the reactionAdded event only when there is a reaction on a message the Bot itself posted. Reacting on a user's post does not trigger an event with the Bot.

Related

Power Automate editing posted teams message

I am using power automate to post a message to a teams channel. The message cannot be edited by admin of that teams channel or any user in that channel. I could not find an option to make the teams message editable or make it editable only by admin of that channel. Any pointer on making power automate teams message editable by admin of the group?
In general messages sent from one "user" (or bot) can't be edited by other users, even an admin - that would be a disaster for things like auditability. However, messages sent from a bot (e.g. the Flow bot) -can- be edited by the bot. However, in the case of Power Automate, it does not offer this as an action for the "post a teams channel message" Action, only for the Action that sends an Adaptive Card message. If you can change your flow to send this kind of message, there is an action to then update it later, using the message id.

Can an slack app reply to the person who mentioned me in a channel?

I am looking to build a slack app which can auto-reply to a person whenever they mention me in a channel or DM me. However, i cannot find any method in the slack API for the same.
Is there any particular way i am missing or this cannot be done in Slack?
When you say 'mention me', if you mean the bot,
then you can subscribe to 'app_mention' event and take it from there.
https://api.slack.com/events/app_mention
If you mean - you as user and not the bot, then the bot needs to be part of the conversation to read the messages. This means that it will not work with the DMs.
For channels, you can invite the bot to the channel you want to monitor, and capture the 'message' event to parse the message and look for your id.
https://api.slack.com/events/message

MS Teams Bot - Detect user is typing

I have a MS Team bot, and I'd like to greet user when they start using the bot again.
So I try to use the ActivityTypes.Typing to do so, but it seems MS Teams hasn't supported it yet.
Is there anyone has experience with it or can suggest other solution?
Thanks.
no, user installs the bot as an app so user doesn't uninstall it but
stop using it for a while and then they want to use it again. I think
their behavior would be click to the bot app, start typing, and send
message. I'd like to greet them before they send the message
Unfortunately, this is not possible. For sure not with Teams. onMembersAdded only ever gets fired once. There is no event that would be sent to the bot to tell it that the user is going to be sending a message. I'm not sure which, if any, channels/clients that would send a typing indicator to a bot. I don't know of any that do. Bot's don't typically receive typing activities, only send. You might be able to get that to work, but that wouldn't really help unless the channel/client supported that feature.
I think the best you could do is to have logic to store the last time the user messaged or the bot responded. Then, when the user sends their new message (after that predetermined amount of time away), then the bot could respond with a message before its response.
For example:
last message/active time for this user was 2 days ago
user messages bot with "i'd like to rent a car"
code logic determines it has been long enough to warrant a comment on that:
bot messages with "It's been a while since we chatted, welcome back!"
bot messages with response to intent: "Sure! what make of car would you like to rent?"

MS Teams - fetch the team Ids and channel Ids in which the bot is installed

I have developed a bot in MS Teams and i want to fetch the channel Ids where the bot is installed and can send the messages.
Any ideas how to do this, thanks a lot
You can only really do this when there's an interaction from the user, so for example when the user sends your bot a message. The best time of all, however, is when your bot is actually installed, because then you have it right from the beginning. You use the ConversationUpdate event, as described here.
If it's too late for that (your bot is installed already), then I'm only aware of waiting for the next message - I'm not sure if it's possible to get things like the conversation id another way.

How to find chat conversation with bot

we are working on MS Bot Framework bot. We are integrating with directline and MS teams. In certain cases we need to download conversation history. Within directline we are using standard DL endpoints to retrieve the conversation. However these are not available for teams channel. Therefore we are trying to get chat messages using Graph API by using
/me/chats/{id}/messages
And here's our issue - to get the chat ID we are trying to iterate through chats returned by
/me/chats
And then look up conversation members by
/me/chats/{id}/members
However chat with Bot contains only user and not the bot so it appears it is a single member chat. As workaround we always sort chats by last updated timestamp descending and assuming first single member conversation is the one we are looking for however this is tricky and unreliable and also very slow some times. Is there some better way to get conversation history from MS teams channel?
Using Graph API, you can access information related to channels in Microsoft Teams. You can refer to list channel messages which retrieves the list of messages (without the replies) in a channel of a team. If you want to get the replies for the message, then you need to call list message replies or get message reply API.
GET /teams/{id}/channels/{id}/messages
One more way is to subscribe to the channel using change notifications API which makes you get all the messages of the channel to the notification endpoint.

Resources