We have been playing with the Python API to publish to MS teams. Worked out how to publish to a channel - it is quite easy. Is it possible to publish to a Chat group however?
Happy to publish to a channel and republished to a chat channel if that is possible.
MORE INFO:
This script works via SQL server. The message appears in the Channel associated with the webhook.
declare #script nvarchar(max) = N'
import pymsteams
myTeamsMessage = pymsteams.connectorcard("webhook as generated by Teams")
myTeamsMessage.text("Testing From SQL Server")
myTeamsMessage.send()
'
execute sp_execute_external_script #language = N'Python', #script = #script
The process is that from a channel in teams you use the connector to generate the webhook via the Configure button
However no such functionality exists as far as I can tell to do the same from a Chat group, hence the question above.
As indicated above, I would be happy for teams to automatically repost from a Channel to a Chat group, but not sure how to make this happen.
Related
Is there a possibility to send a user message to specified user(s) in MS Teams?
Elaboration:
My current flow triggers a message to a user, but it is always sent via FlowBot and appears in the Power Automate chat of MS Teams.
Flow: (Outlook; Trigger) "When a new email arrives (V3)" → (MS Teams) "Post message in chat or channel" → (Outlook) "Mark as read or unread" (v3)
Can individual users be set as recipients of direct messages with the message sent in the already existing chat with the user?
If yes, is it possible without a value chain?
Thanks!
As I see it, there are kind of a few different questions in your post, so I'll try deal with each of them:
In order to send a message directly to a user, the user has to come "from" someone/something, and in Teams that basically means a Bot. The easiest way, therefore, to do this is to use the out-of-box FlowBot. If that's fine for you, you're good to go. If you want it to come from another Bot (i.e. one you own) then you need to create a Bot somehow. Two main options are:
Code it from scratch using Microsoft Bot Framework - code in a regular language (C#, Python, etc.) or using Bot Framework Composer
Use Power Virtual Agents - ala "Power" family, it's kind of a "Drag and Drop" bot capability. You don't need to actually have the bot DO anything though, if you don't want it to handle user responses (you can do most of that visually in your Power Automate flow. For this option, you'll be able to select the bot from within Power Automate designer as the "send from" bot
You can choose to have the bot send a message directly to the user (i.e. in a 1-1 chat, like what you're seeing with FlowBot) or you can choose to have it send to a particular Channel inside Teams - either is fine. Be aware that Channels have threaded conversations, if you want to use them, but 1-1 chats do not.
You can try these Power Automate steps to create the 1:1 chat between you and the user, then send a message to it.
I have created a Echo Bot in c# using QnA maker which is working absolutely fine now I wanted to achieve a scenario where if user ask any question and bot unable to find related answer than this question must be sent on Microsoft Teams channel where except will reply to the same and that message will sent to the user.
So, Is there any way to send message user message to Microsoft Teams for expert reply. If you have any sample code for the scenario please feel free to mention.
As per your current requirement this is kind of handoff or human live agent connect.
The following way you can achieve posting a message in ms team ( Go through this article Send proactive messages to Teams channels and users ).
Send proactive messages to Teams channels and users ( Microsoft Bot Framework v4 )
The user should be part of ms teams ( Azure AD valid users ).
Suggestions : If you are using domain bot then human live agent or handoff concept is the best approach otherwise you can integrate bin search api or any other third party api for unanswered question.
As per your requirement you can use Graph API to send message to channel using below code
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var chatMessage = new ChatMessage
{
Body = new ItemBody
{
Content = "Hello World"
}
};
await graphClient.Teams["{team-id}"].Channels["{channel-id}"].Messages
.Request()
.AddAsync(chatMessage);
Please go through this documentation for more info.
We have implement a Skype bot using Bot Builder 4. And this bot run smoothly around 2 years. But from recent days some specify groups cannot receive proactive message from the bot. We have traced both production & development environment to narrow down issue as below:
Those group cannot receive message all have format as: ...#p2p.thread.skype. When we create new group and add this bot into group (new group have format: ...#thread.skype). The message send successfully to new group.
We have get source code Bot Builder 4 from Github and add to my project to debug and see below:
This is group send fail:
fail group
This is group send sucessfull:
sucess group
We got meaningless warning from my azure portal:
azure warning
I don't know if Skype bot has just changed any rules or restrictions about their service?
I am very pleased and appreciate any sharing from everyone.
This issue is a bug from Skype backend service. The MS team has just confirmed on this github:
This is a confirmed bug on Skype backend side. The issue has been
mitigated for the specific bot and the general fix will be rolled out
on the first week of January.
https://github.com/microsoft/BotFramework-Services/issues/270#issuecomment-752455967
I have created a bot by following the steps mentioned in the doc.I have authenticated user using oauth 2.0 (auth code grant) as mentioned in the doc and in reverse I got a access token. But when I send message to channel in the teams using (/teams/{id}/channels/{id}/messages) API the message was sent on behalf of me. But I want my bot as the sender of message. Here is the image of the message that I have sent using the above API. and is there any way to send direct message to user as a bot?
Instead of using the Graph, there's another approach using the Bot Framework itself, to send a message to a team channel, a group chat, or a 1-1 conversation. The code doesn't even need to live inside the bot itself, it just needs to leverage the bot framework under the covers (for example, I have several Azure Functions that pro-actively message users). This idea is called "Proactive messaging" and you can read more about it in the docs here.
You do need to get certain fields when the user first installs the bot though, or any time the bot receives a message. I've described that more at Programmatically sending a message to a bot in Microsoft Teams. You haven't said what language you're using, but there are examples for a bunch of them - I can send you links if you let me know what you're using.
I have a bot, a client start a conversation with it using directline 3.0.
The bot follow a waterfall flow and at one step start an external process that do something. The process, finished the task use directline to start a new connection. i would like to send a message to the bot using a specific connection as the bot receive the message and can continue the flow. Is it possible?
Yes, this is possible using proactive messages. There is no need to use direct line, specifically, to create a new connection to send an activity. In short, in your bot's you will create a new API that external services can ping. As part of the process, when the API is hit, a conversation reference is created that, in short, allows you to pass any received data as an activity to the bot. When the bot receives the activity, you can setup logic to determine what the bot does next.
There is a SO post here that addresses this issue that you can reference. Additionally, you can refer to the BotBuilder-Samples GitHub sample for additional clarification.
Hope of help!