Using the Bot Framework to post to a Microsoft Teams channel with NodeJS - node.js

Is there a way to send proactive cards from a bot to a Teams channel? The use case is a channel for service tickets. Once they get posted, a user will be able to interact with them with a few actions.
I’m looking at the documentation here for sending proactive messages. At the bottom, there’s a section for ”Creating channel conversations”, with a small reference to the startReplyChain(). However, the actual code and sample on GitHub still seem to reference a conversation with a member rather than sending something proactive to a channel.
There does appear to be documentation for incoming and outgoing webhooks, which is what I may end up doing. My only real concern is that it requires using Actionable Cards, which it references as legacy everywhere. This is despite saying that you can’t send Adaptive Cards with them. Perhaps they intend to enable these connectors to send Adaptive Cards, it’s not just very clear to me if this is a long-term solution I should be focusing on.

This is definitely possible, and it's important to note that you can even send from another process/application (e.g. on a schedule from an AWS Lamba). You can see a sample here for this.
The process of sending the message is just part of the story though - you need to have certain information already saved (e.g. in your database) to know how to contact the right user, group chat, or channel conversation, but there are a few ways to get that information. The most common is, when you bot is added to the conversation, to get it from the conversationUpdate event. You'll need conversation id, service url, tenant id, and your bot's App Id (what you get in the Azure portal for your bot, and which you're using already in your app's configuration, teams manifest, etc.). You can read more about the topic here and here.
Another option, if you don't have access to conversationUpdate (e.g. the user hasn't installed your app) is to call the Graph API to install your app. It's only possible to do this to a channel (on the v1 or beta api) (see here) or to a user (see here), but on the beta api only, and not (yet?) for a group chat.

Related

Azure Communication Services - Delete 3rd Party Chat Messages

I am trying to implement a chat functionality using azure communication services. One special use case is, that this chat must be administrated by one single administrative role.
This administrative role called "moderated" shall be allowed to delete selected messages from other chat participants.
Couldn't find a way to do this so far, any recommendations?
This is currently not supported.
Participants don't have write access to messages sent by other participants, which means only the message sender can update or delete their sent messages.
Please refer to the User Access section of the documentation for more details.
You can upvote the Implement basic Roles for the Chat Clients idea if you'd like to see this implemented in the future.

Send a Google Chat message from a regular account (not a bot)?

I'm trying to send a notification out using Google Chats. But I have a few problems with the documentation I've been able to find:
It requires me to have a paid service account, which I do not have, and will not be getting
It requires using a chat bot, which (in my understanding) needs to be added to a room, and cannot just send out messages
Chat bots can't send out messages directly to personal accounts?
I'm already using Google OAuth2 authentication to access another Google API, so I'd like to use a Google API to send messages directly from the authenticated account. How would I do that?
So far:
All the documentation I can find is about making a chat bot.
I've considered some alternatives to sending out messages, but due to corporate device restrictions that will not be changing, google chats is my best option.
At the moment what you're trying to do is not possible, for multiple reasons.
You may know this already, but Google Chat is an upgrade to their old "Classic Hangouts" chat. In Google's own words, this is focused on enterprise (i.e. paid) accounts. While personal accounts are also able to upgrade and get some of the benefits, their documentation shows that Google Chat for personal accounts is very similar to the old Hangouts and most of the new features are meant for the paid accounts. This also includes the use of bots.
As you've observed, the Chat API currently only has methods to create and manage bots. There are no methods to send messages as your own account. This could be to prevent spam or because their Chat API is relatively new, since the Classic Hangouts did not have an API, and Chat hasn't fully replaced it yet. Even then, given that Chat is "enterprise-focused", it is uncertain whether or not personal accounts would get access to any new API features.
You could try to post feedback on their issue tracker or request the feature to see if you get a response, but for an immediate solution you may want to just use the Gmail API to send a regular email or reconsider the other alternatives that you had in mind.

Microsoft Teams - read out channel messages (ReactJS, NodeJS)

in Microsoft Teams we have a Team called "BD" and this team has a channel named "Global".
Now I have a ReactJS app with a NodeJS backend and I would like to
display all the messages that are written in the Global Channel of the Team "BD"
I only need to show which messages are written in the channel (so readonly would be sufficient).
What is the easiest way to achieve this ? Even an iFrame would be ok, if somehow possible.
Please take a look at List channel messages Graph API. First try these APIs in Graph Explorer.
To implement this in a code, you need to follow either Get access on behalf of a user or Get access without a user
Before calling this API with application permissions (access without a user), you must request access. For details, see Protected APIs in Microsoft Teams.

How to use botframework on Azure endpoint to work in your own bot design?

My question is simple. However, I am unable to find it anywhere on Internet.
I have published my bot on azure. It gives my messaging endpoint as https://something.azurewebsites.net/api/messages (it is not exactly real).
How can I use this to get and post json files that it should give? The file I will receive, I will hold it on variable and then loop around to get particular messages or post messages. However, it is not work? Do I need to give secret along with this on header? How will this endpoint work so I can give and receive messages through input field on my chatbot design on HTML?
You won't ever need to get or post messages directly. If you have a Bot Channels Registration resource or a Web App Bot resource then that takes care of all communication with your endpoint. Connect your resource to whatever channels you want (like Direct Line) and then use those channels' clients to communicate with the bot. Have a look at the documentation for more information: https://learn.microsoft.com/en-us/azure/bot-service/bot-service-overview-introduction?view=azure-bot-service-4.0

How to get conversation details in microsoft bot framework for skype?

I'm able to get conversation details for webchat using https://webchat.botframework.com/api/conversations/[conversationId]/messages
Service URL for skype channel is https://skype.botframework.com, but I dont find any documentation for getting conversation details
You can use the DirectLine Rest API (see docs).
The Direct Line API is a simple REST API for connecting directly to a single bot. This API is intended for developers writing their own client applications, web chat controls, mobile apps, or service-to-service applications that will talk to their bot.
Within the Direct Line API, you will find:
An authentication mechanism using standard secret/token patterns
The ability to send messages from your client to your bot via an HTTP POST message
The ability to receive messages by polling HTTP GET
A stable schema, even if your bot changes its protocol version
You need to enable the DirectLine channel for your bot on (see screenshot)
You don't have to access each specific channel endpoint separately, you can do it all (with some limitations) through the DirectLine API.
Start a New Conversation
POST /api/conversations
Get Messages in a Conversation
GET /api/conversations/{conversationId}/messages
Send a Message
POST /api/conversations/{conversationId}/messages
The full details are in the docs as linked above.
Hope this helps
Can you be more specific about conversation details and what you're looking for?
Generally, you shouldn't assume those URL's are static BTW; an incoming message from the Bot Framework will have a ServiceURL that should be used for the life of that conversation. Some services may have multiple ServiceUrl's that they give out for different users.

Resources