How to hide Message extension bot "what can i do?" text - botframework

I have observed that, in my message extension bot when I open one-to-one chat with bot, at the top of my chat bar it asks "What can i do?". But when I try to click nothing happens.
Is there any way I can hide that text as its miss leading.
I have tried to update the manifest but it seems its related to some settings.

"What can i do" lists out a set of bot commands to get started with using your bot. You could remove it by removing the commands in the "bots" section from your app manifest.

Do you want the user to be able to interact with the bot at all? If so, do you have any commands in the "commandLists" in your manifest? I actually think this is one of the best features of bots in Teams, if you're creating a normal chat bot, because it gives the user some immediate options, saves them typing, and makes it easier than using LUIS even to check for input.
However, if you don't want any interaction with your bot, then you shouldn't have a "bot" section in your manifest at all. For an app with a message extension only, you need only the "composeExtensions", and don't actually need the "bot" section at all. In this case, the user won't have any chance to 1-1, but that's fine.
To see this, have a look at a sample manifest file:
{
"$schema": "https://developer.microsoft.com/...",
...
"bots": [], <- leave this empty, it is only if you want you user to CHAT with the bot
...
"composeExtensions": [
"botId": Here is where your BotId goes, JUST to handle message extension commands
]
}

Related

How to add the add reaction button to a message with discord.py?

I want the members of my discord server to be able to react to a bot message with any emoji (using the winking smiling emoji with a plus sign). I have been looking for add reaction option in the discord.py documentation but I can't seem to find it. Please help me with this, it will be a great help.
Adding reactions isn't a permission given on a per-message basis, it is set in the channel settings as "Add reactions". It's not something you should want to change automatically with your bot, though technically you could with set_permissions in a guild channel, this will change the settings for the whole channel, and thus all the messages.

How can I turn my bot into a MS Teams app

I made a normal bot by using Microsoft Bot Framework and has deployed it to the Azure portal.
How can I possibly make it a Teams app other than channeling to Teams, for example, make it a Teams app package.
I checked some sample code on Github and noticed that general bots are a bit different from Teams bots, for example, general bots extend ActivityHandler but Teams bots extend TeamsActivityHandler. May I ask how can I turn my bot into a Teams app? Do I need to alter the code of the bot I made a lot?
Thanks
With a few exceptions, you don't really need to make changes to your bot code to deploy to Teams channel. However, I do think there are a few things you should be aware of and consider in your development. First of all, I'm going to assume you have or know how to turn on the channel from the Bot Service. Once you have done that, you can test your bot in Teams without even creating a Teams app by pasting the Microsoft App ID into the chat To: field (obviously it's not recommended to share this ID for general testing).
The main change you probably need is to remove mentions. These will mess with QnA Maker and/or LUIS as they are included in the query string. I have been doing this as the first step in the onMessage handler. My current bots use regex for this, e.g.
if (context._activity.text) ( // Make sure there is activity text before trying to replace
context._activity.text = context._activity.text.replace(/(#|<at>)((Bot Name)|(Teams App Manifest Name))(<\/at>)? ?/g, '');
}
However, I have also seen that the TurnContext object can do this via TurnContext.removeRecipientMention(context.activity); I've not actually tried that myself, though. If it works it would be very helpful in case you find yourself changing bot names as I have done in the past...
The other main change I made to my bots was creating Teams-specific adaptive cards with menu buttons. By default, Action.Submit will work for web channels but NOT Teams channel. A typical action would look like
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Get Order Status",
"data": "Get Order Status"
}
]
}
But Teams can't handle this and will error out on button click (at least when using standard Activity handler, not sure if it is the same if using TeamsActivityHandler.) Instead, you should check the channel before displaying cards with Action.Submit actions and display an alternative card instead. For example
if (context.activity.channelId == 'msteams') {
var welcomeCard = CardHelper.GetMenuCardTeams(welcomeMessage,'Y','Y');
} else {
var welcomeCard = CardHelper.GetMenuCard(welcomeMessage,'Y','Y');
}
And then your actions for Teams instead look like
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Get Order Status",
"data": {
"msteams": {
"type": "imBack",
"value": "Get Order Status"
}
}
}
]
}
I've tried combining these and it doesn't work well. You can add something to your handler to make Teams cards work in web, but the text will not be inserted into the chat like a typical button and it will instead be essentially like a backchannel event. I like this method much better.
Other than that you should be able to run your bot as-is, except for attachments as noted in your separate question. I have not gotten that to work and I believe it may be related to not using TeamsActivityHandler but I'm not sure.
Hopefully this helps. Go ahead and give it a try and you can create a new issue with any specific problems you face once the bot is operating in Teams.

Is there a channel setting to ask for confirmation if a member does #here?

Is there a way to make Slack ask for confirmation if a user makes a #here mention in the channel? I heard Slack does ask for confirmation for #channel mentions.
There won't be a built-in feature to configure this but we could build a custom app to mimic what you requesting. When someone posts a message, we can modify the #here to _here and suppress it. Then, our custom app should prompt whether they would like to really notify everyone who is online now. Upon their confirmation, we can modify _here to #here.
If modifying messages did not work, we could delete and repost after user's confirmation.

Update the about text of a message extension bot

How to update the text which appears on the hover of the message extension bot in Microsoft Teams using bot framework v3.
The only part you can change directly is the description in the top. The "permissions" section you've highlighted you can't change explicitly, as they're based on what your Teams app contains. For instance, if you app contains a bot, then by definition it will be able to "receive messages and data that I provide to it". Things like your bot scope will also influence this - what I mean is if you bot is ONLY a personal, 1-1 bot, then you wouldn't have "access this team's information", because it doesn't apply to a 1-1 bot. In contrast, if you've selected that your app contains a bot, and the bot can be used in a Team channel, then it would need that permission.
Also relevant are the other permissions you explicitly request for your app. In App Studio, these would be on the "Domains and permissions page" under "Device permissions".

Delete interactive message (command response) just with Slack Commands API

So I'm building a slack app in Node that responds to some user commands. It usually responds with an interactive message that has some attachments and buttons.
For certain buttons, I return different types of texts or other attachments, but I also want to have a "Cancel" button that would basically cancel the current command - delete it from the user's chat.
The thing is that I want to do it without having to request the chat:write:user scope or without having to create a bot.
By asking for the chat:write:user scope I can basically remove any message the user created, but it asks for that scope when installing the app and gives my app permission to post on behalf of the user, which most find uncomfortable.
By creating a bot I could achieve this, but again it asks for permission to add a bot to the channel and I don't want this.
What I've tried
Use chat.delete method, but I get { ok: false, error: 'missing_scope', needed: 'chat:write:user', provided: 'identify,commands' } from Slack, even when I try with as_user set to false.
Respond with an empty message to the command, like res.send(), or res.send({ text: null }), or res.send({ attachments: null }), etc.
When you reply to a user command on Slack it overrides by default the previous content. I just want to override with nothing, basically removing the original response. When I try this however, it doesn't do anything, unless I provide some content.
I'm pretty sure #2 is the way to go and I feel I'm close and it's something pretty simple but out of my sight.
Working example of what I want
I know it can be done because the GIF Keyboard app for slack does this. When searching for Gifs, they have a "cancel" button at the bottom that just removes the current command/message. Furthermore, they only ask for the Commands scope.
You are on the right track. Option #2 works, so no need to request scopes to delete a message.
Just send the following response back to Slack and the last (ephemeral) message from your app will be deleted:
{
"response_type": "ephemeral",
"replace_original": true,
"delete_original": true,
"text": ""
}

Resources