Debug msft teams bot channel conversation - c#

I have a bot that collects information in a private chat from User A about User B and then sends it to User B. I am collecting the information via Dialog and then formatting a HeroCard to be sent. I was using the Bot Emulator to test the private chat code, but I'm unable to test creating a new conversation () in the emulator without getting a 500 InternalServerError. When I deploy the code and integrate the bot into an existing Teams channel I receive 400 Bad Request responses.
Is there a tool to use that can help me debug creating a new conversation locally?

You need the user’s (User-B) unique ID and tenant ID to start 1:1 proactive conversation. Typically, these are obtained from a team context, either by fetching the team roster or when a user interacts with your bot in a channel.
Please check the sample code.

Related

The teams channel getting spammed with Bot intro message

I have added a bot to a Teams channel.
Each time a new user is added to the Teams channel the bot sends a welcome message inside the channel.
I want this message to be sent to the user personally and not to the whole channel.
You can send message to user on 1:1 using proactive message. When the user added to the team you will receive on member added activity there you can send a message to user personally. Please check this docs for more info and also check this sample

How to get access token and use it

I am working on creating bot for Microsoft teams in C#. I have a sample code (basic echo bot) that works fine in emulator. I created an app in teams app studio and entered my API end points in Bot section. I download the package and upload it as custom package in teams.
Now, when I add this app and try communicate with Bot, I get unauthorize error in API (using ngrok). I guess what’s going on here is that I don’t have the access token i.e. when someone install it, teams should give you access token, right?
What I don’t know is how teams will give me the access token and where in the process that access token will be used?
So basically, when someone clicks on “Add” button in teams app store, how the access token are passed.
#update
Note:-I have done the app registration as well.
So i did bot channel registration in Azure and added my ngrok end points. I copied the "MicrosoftAppId" and "MicrosoftAppPassword" in appsettings file. It is working fine in emulator as well as "test on web chat" in Azure bot management portal. I also connected it to Teams channel from portal itself. when i navigate to teams from the channel link, my bot is working as expected.
After that i opened app studio and entered all the details. In Bot section, i selected existing bot id and entered my MicrosoftAppId from azure and it worked.
what I still don't understand is, when someone install the app, teams should be sending some information to my end point, right?
Without access to your code it is hard/impossible to determine the cause of your issue.
I suggest instead you take a fresh start by using one of the Teams bot examples that are shared :
57.teams-conversation-bot
if you do require authentication in your bot:
Authentication flow for bots - Teams | Microsoft Docs
46.teams-auth
52.teams-messaging-extensions-search-auth-config
pleanty other teams examples as well in that repo:
50.teams-messaging-extensions-search
51.teams-messaging-extensions-action
53.teams-messaging-extensions-action-preview
54.teams-task-module
55.teams-link-unfurling
56.teams-file-upload
57.teams-conversation-bot
58.teams-start-new-thread-in-channel

How to start 1:1 conversation with user by sending OAuthPrompt

I'm using Bot Framework v4 and c# to build a teams bot that signs in user when added to channel.
My use case, is that each time a new user is added to the channel, I want to send him an OAuthPrompt in 1:1 in order to sign him in.
The samples provided for proactive message shows only how to send a simple message, and can't find the right resources to solve this problem.

Microsoft Bot Framework and Slack Direct Messaging - Bots Cannot Message Users in External Teams?

Following this post, Microsoft Botframework: Direct Conversation with Bot Channel, I implemented this code into my own bot, getting the error "Bots Cannot Message Users in External Teams". What does this mean and is there a workaround?
Ok, so here's what I did. I went back through Slack and resaved all the settings, and then it worked!. Also, make sure the workspace IDs match for your bot and who you're sending the message to.

3 different channels in the same conversation botframework

I'm trying to do a C# MVC WebApplication for human-hybrid bots support customers, so I can't create a conversation between 3 different channels.
Example:
1-) An user start a chat with my bot in facebook
2-) When the bot receive the activity, he adds a new guy in conversation (directline, that's I have conversationId).
3-) The facebook user now, is chatting with other 2 users (bot and directline User).
Is the correct logic ?
I'm trying to create this group conversation but I'm getting error 500.
This is a common scenario that I've seen addressed by a number of users in the following manner:
Build your customer support interface (CSI) (i.e. the side used by your customer support reps) using Direct Line
Your bot pipes through the all the user messages to the CSI which stores all the conversations. Reps can see a list of all the users interacting with the bot and the history of each of those conversations.
When escalation to a human is needed, the bot flags one of the conversations needing attention
Your bot then brokers conversations between the accounts (i.e. Facebook End User <-> Your Bot <-> CSI). Essentially the customer support rep is creating a response, which is being posted by the bot back to the end user
This means there's no need to add an additional person to the conversation. (Facebook currently only allow 1-on-1 conversations with bots).

Categories