Bot Framework SDK
15 TopicsHow to send a message to a thread (reply) using botbuilder 4.0 SDK
How to send a message to a thread (reply) using botbuilder 4.0 SDK Scenario:- 1. User A -> Types a message in Teams App (bot) 2. Now Bot has to reply to the same thread that user A has started in Teams App (bot) I am able to send a new message in the Teams App (bot) - Not expected The bot needs to reply to the same thread the user started - Expected If you have any document link or example, please point it out. Thank you.3.6KViews1like15CommentsError : The bot is not part of the conversation roster. while sending message in channel through bot
We have a bot that can be installed in a Team as well as in personal scope. We are facing issue when bot is trying to send message in the channel where it is installed. It was working fine few days back but all of a sudden, it's throwing error: > {"error":{"code":"BotNotInConversationRoster","message":"The bot is > not part of the conversation roster."}} > Details : > teamId :19:3684c109f05f44efb4fb54a988d70286@thread.tacv2 > Error: Operation returned an invalid status code 'Forbidden' > StackTrace: at Microsoft.Bot.Connector.Conversations.CreateConversationWithHttpMessagesAsync(ConversationParameters > parameters, Dictionary`2 customHeaders, CancellationToken > cancellationToken) at > Microsoft.Bot.Connector.ConversationsExtensions.CreateConversationAsync(IConversations > operations, ConversationParameters parameters, CancellationToken > cancellationToken) Below is my code: var channelData = new TeamsChannelData { Channel = new ChannelInfo(cId), Team = new TeamInfo(cId), Tenant = new TenantInfo(tenantId) }; var conversationParameters = new ConversationParameters { IsGroup = true, Bot = null, ChannelData = channelData, Members = null, Activity = activity, }; await connectorClient.Conversations.CreateConversationAsync(conversationParameters); The bot is able to send direct message to users Note: - I can confirm that the bot is part on the team, and it is installed within the team. Bot is able to send one-to-one message to the user. We are facing issues only when trying to send message in a channel.67Views0likes2CommentsHow to get access token for Graph API in Teams bot-based message extension?
I'm developing a Teams bot-based message extension application using the Teams Toolkit in TypeScript. I need to retrieve all the replies for a message in the current channel. According to the documentation, I need to use the Graph API to get the replies. However, to use the Graph API, I need an access token. My questions are: How can I implement OAuth to get the token in a bot-based message extension? Are there any specific permissions or configurations needed in the Azure portal to enable this? Is there an alternative way to get the access token or retrieve the replies without using the Graph API?1.4KViews0likes5CommentsHow to deploy a Bot/Message extn app developed with Teams Toolkit (5.6) to a self-managed server?
I'm developing a Bot/Message Extension App for use in our organization. Using Teams Toolkit, I have created a project and using Typescript for it. Local testing is automatically supported from app registration without much consideration, so it seems very convenient. However, when I try to deploy this, I am a bit confused. Teams Toolkit seems to support deployment according to Azure Bot Service by default.(.dev) I can't use the Bot Service for a number of reasons and should consider running the bot on a self-managed host. First of all, is this possible? In this case, what steps should I take in Teams Toolkit, Azure portal, Teams development portal? If this is not possible with Teams Toolkit, how should I configure the bot's hosting? I have checked, we have to mention the endpoint URL but seems confuse to where it has to be mention.769Views0likes5CommentsAdaptive Card to send message to the end user by command / Bot Framework SDK - JavaScript - node.js
For MS Teams chatbot, by adaptive cards, I want the bot to send text message to the client when the client chooses the respective command. What İs want is opposite of Action.Submit - I want user to receive message when the button is clicked. I try to optimize Action.OpenUrl and Action.Submit but results weren't satisfying.815Views0likes3CommentsUnit Test Teams Bot/Message Extension App created using Teams Toolkit
Hi, I have created a Teams Bot/Message Extension App using Teams Toolkit using VS Code. I want to unit test my bot. How can I do it, as I couldn't find any documentations for it. And also it is necessary to publish it to the Teams Store. Thanks.419Views0likes0CommentsInserting the final response directly into the chat in a Teams Messaging extension
I am working on an action-based messaging extension app for teams. My action can be invoked from a message/compose/commandBox. After submitting the action, currently the adaptive card I am sending is getting inserted into the chat and the user must manually click on send. I want the message to be directly inserted into the chat. Microsoft documentation says, "If the message extension is invoked from the compose box or directly from a message, your web service can insert the final response directly into the channel or chat. In this case, the Adaptive Card comes from the bot, the bot updates it, and replies to the conversation thread if needed. You must add the bot object to the app manifest using the same ID and defining the appropriate scopes." But I have no idea how to do this. Yes, we will add the bot to manifest, what next? Currently, I am returning my adaptive card using the following code : async handleTeamsMessagingExtensionSubmitAction(context, action) { switch (action.commandId) { case "executeActions": return await executeActions(context, action); default: throw new Error("NotImplemented"); } } async function executeActions(context, action) { const data = action.data; const adaptiveCard = createAdaptiveCard(data); const attachment = { contentType: adaptiveCard.contentType, content: adaptiveCard.content, preview: adaptiveCard, }; return { composeExtension: { type: "result", attachmentLayout: "list", attachments: [attachment], } } }; Could someone please help how can I tweak the codes, to send messages into the chat directly? So that, the user should not have to click on send every time. I don't mind if the message comes from a bot, into the chat.307Views0likes0CommentsHow to send dm even if the user has not installed the app in personal scope.
I am trying to build a bot which will have a few message extension to submit data and then I will make a request to my custom backend. I want to save the data and want to send dm to the user. I am planning to expose a route from my botbuilder restify server (built by teams toolkit) to send a dm to the user (from bot's account) because I could not find a way to send a dm without bot framework. The only problem is when I am trying to send a dm I am getting an error saying "Bot is not installed in user's personal scope", which is true because the app is only installed in a team. How can I tackle this problem? Basically I am building a feedback bot for companies so I want to proactively send dm message to all the employees and admins. What are different ways to do this thing. Feel free to ask about any other information if you need, thanks!Solved2.5KViews0likes13CommentsReply to message is not working as expected
const { MessageFactory, TeamsActivityHandler, BotFrameworkAdapter, TurnContext, teamsGetChannelId, TeamsInfo } = require('botbuilder'); const properties = { 'membersAdded': [{ 'id': '28:17a' }], 'type': 'conversationUpdate', 'timestamp': '2022-08-11T10:54:30.482Z', 'id': 'f:ce9c82ab7a6feabc', 'channelId': 'msteams', 'serviceUrl': 'https://smba.trafficmanager.net/in/', 'from': { 'id': '29:1YqsjLwgg-0A_V8tL5P3hIw', 'aadObjectId': 'a0858f3e-d57759' }, 'conversation': { 'isGroup': true, 'conversationType': 'channel', 'tenantId': '3272b84e1', 'id': '19:PZppMpIo1@thread.tacv2' }, 'recipient': { 'id': '28:17720bfc7ba', 'name': 'bot 1' }, 'channelData': { 'team': { 'aadGroupId': '9ffd4120579', 'name': 'Ayesha Testing', 'id': '19:PZp9pIo1@thread.tacv2' }, 'eventType': 'teamMemberAdded', 'tenant': { 'id': '3284e1' }, 'settings': { 'selectedChannel': { 'id': '19:PZ1@thread.tacv2' } } } }; const BotConnector = require('botframework-connector'); const adapter = new BotFrameworkAdapter({ appId: '', appPassword: '' }); BotConnector.MicrosoftAppCredentials.trustServiceUrl(properties.serviceUrl); const context = new TurnContext(adapter, properties); const teamsChannelId = '19:PZpplOG9xxoOHhanG9pIo1@thread.tacv2'; console.log(teamsChannelId); const activity = MessageFactory.text('This will be the first message in a new thread'); const [reference] = await TeamsInfo.sendMessageToTeamsChannel(context, activity, teamsChannelId, process.env.MicrosoftAppId); await context.adapter.continueConversationAsync( reference, async turnContext => { await turnContext.sendActivity(MessageFactory.text('This will be the first response to the new thread')); }); Expected: Actual : When I want to send a Reply to the message but it is sending as a new message. And I have to update that reply message that certain times. Can you please look into that? Also Is there a way to batch send or update messages to users in personal chat, otherwise data might be inconsistent for users.Solved2KViews0likes7Comments