Creating a Deep Link to Tab from Notification in Activity Feed - microsoft-teams

I am developing a MS Team app which has a Tab and a Notification only Bot.
How can i add a deep link to my tab when the user clicks on the Notification from the Activity Feed.
Sending the notification like below.
const activity = {
attachments: [card],
text: 'Notification Text',
summary: 'Notification Summary',
channelData: {
notification: {
alert: true
}
}
};
await turnContext.sendActivity(activity);

The slighly tricky part is figuring out the syntax for the deeplink, it's a little confusing the first time you do it, but have a look at the docs for Create Deep Links. Once you have the link url itself, then you can send it to the user in the notification, as a regular message, or a card (e.g. Adaptive Card) or similar.
Some Deep Link parts that can be tricky:
the "App id" is the TEAMS app id (from your Teams Manifest, or from App Studio), NOT the "Microsoft App Id" from the bot itself
The "entity ID" is the "entity id" you registered for your Tab in the Teams manifest (or in App Studio if you used that)

Related

justInTimeInstall for a Messaging Extension app not working on mobile (iOS/Android) Teams client

Working on a Messaging Extension app for Teams that opens a Task Module in a Teams Meeting. This app is installed from the "Built for your org" section of the Teams store after being loaded into a Tenant by a Teams Admin. Any tenant user who has the app installed can select the messaging extension from the … menu in a Teams Meeting to initialize the Task Module.
Before initializing the Task Module, the app's bot must be added to the meeting chat so an "Add app" button is presented after selecting the messaging extension. This button sends through a payload with the justInTimeInstall value set to true. When a new Teams user who has never used the messaging extension before tries to tap on this Add app button on a mobile device, the button either does nothing and the user is returned to the chat (iOS) or an error page with a retry button is presented and the retry button keeps presenting the same error page (Android).
When examining a network trace of this button press, a 502 code is being returned with the following JSON:
{
"errorCode": 1008,
"message": "<BotError>Bot returned unsuccessful status code Forbidden",
"standardizedError": {
"errorCode": 1008,
"errorSubCode": 1,
"errorDescription": "<BotError>Bot returned unsuccessful status code Forbidden"
}
}
This combined with some other logging makes it seem like the response isn't even getting to the app's server. This is only a problem on mobile for a Teams user who hasn't used this messaging extension app. If the same user adds the app to the meeting from desktop/web, then they can come back on mobile and the "add app" button will work in any meeting from that point forward.
Is this a known issue or is there something that I might be missing here that's preventing the app from being added for new users on mobile?

Display Additional Text in Teams Client Toast for incoming message that contains an Adaptive Card?

We have a Teams bot that sends messages containing adaptive cards to end users (via the Bot Framework). When the chat window is not in focus, the Teams client will show the incoming message in a Toast/Popup that appears in the bottom right of the screen. However when the message contains just a card, the toast is nondescript and there is no hint to the user as to what the "Sent a card" maybe all about. So all card message toasts appear to be the same. See image
Is it possible to display a text message alongside the "Sent a card" in Toast so the user can decide whether to immediately interact with the message or ignore it. Any other visual cues we can provide that would appear in the Toast?
You have to set a summary when sending cards via Bot Framework.
Like this:
var response = MessageFactory.Text(string.Empty);
response.Attachments.Add(cardAttachment);
response.Summary = "showing custom greeeting from the Bot - rather than a card";
await turnContext.SendActivityAsync(response, cancellationToken);
The summary is shown in the notification instead of "sent a card"
This was implemented quite some time ago.

How to create link message in "Activity" and in "Chat" which navigates to the Side rail personal tab in MS Teams?

Is it possible to send a notification message to users to navigate to the Personal Tab app in Side rail from the "Activity" or "Chat" window in MS teams?
The notification message in Activity and Chat should have a link that would navigate to the New Personal Tab installed.
Yes, you can do this by sending a Deep Link to your app's Personal tab. See more about this at Create Deep Links.
To actually send the message you have a few options, including:
Create a Bot
Use an incoming Webhook
Use the Microsoft Graph
Use Power Automate (Flow) (there's an app in Teams called the "Flow Bot" which enables you to send messages from Flows directly to a user.

MS Teams Messaging Extension submitTask failing with "v3 agent not found" error

I'm creating my first Microsoft Teams extension. For now I'm just trying to get the basic plumbing for a messaging extension working. I'm trying to build an extension which will allow a user to search for content in my service and then return a card into their compose window in personal and Teams chats.
I've tried to follow the basic guide ( https://learn.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/how-to/create-messaging-extension ) for creating a messaging extension using App Studio. I've setup a bot as it describes, and I have built a dummy echobot endpoint for the bot (using Ruby). I am able to "chat" with my bot directly in the Teams client and it is able to respond.
My messaging extension defines an action based command with a taskInfo with a web view URL to render and a fetchTask set to false. I've written a basic static HTML page for this and included the teams-js library. The web view loads and the teams-js library initialization callback is called. I have a submit button which calls microsoftTeams.tasks.submitTask which as I understand it, should be calling my bot with a "composeExtension/submitAction" message to which I would respond with the card. (Based on https://learn.microsoft.com/en-us/microsoftteams/platform/messaging-extensions/how-to/action-commands/respond-to-task-module-submit?tabs=json )
I've tried installing my extension in Teams through the "Upload a custom app" option both as a "for me and my teams" and "for " but still have the following issues.
When I open my extension in the Teams client from the compose area and click this submit button in my iframe content, the submit I get a "Unable to reach app. Please try again" error displayed. In the dev console, I can see that the response to the "invoke" http post is {"errorCode":404,"message":"V3 agent not found."}
No traffic is actually sent to my bot during any of this process.
I saw this older post - Compose extension is throwing error : V3 agent not found . The https://dev.botframework.com/bots/ it refers to seems to be outdated, but in the Azure "Bot Channels Registration" console, I have gone to Channels and added "Microsoft Teams" (which I believe is the new equivalent).
Has anyone seen this happen and figured out what was going on? Much thanks!
Here is sample code for composeExtension/submitAction for Bot SDK V3. Make sure you pass the bot id and command text in taskInfo object.
case "composeExtension/submitAction":
string commandid = JsonConvert.DeserializeObject<Models.TaskModuleSubmitData<string>>(activityValue).commandId;
taskInfo = GetTaskInfo(commandid);
taskEnvelope = new Models.TaskEnvelope
{
Task = new Models.Task()
{
Type = Models.TaskType.Continue,
TaskInfo = taskInfo
}
};
return Request.CreateResponse(HttpStatusCode.OK, taskEnvelope);
Hilton had the right answer.
I had grabbed the Subscription ID from the Bot Channels Registration page instead of the App ID from the Azure Active Directory -> Apps Registration page and used that in the messaging extension manifest as the "botId" in the composeExtensions array. After fixing that I'm now getting messages submitted to my bot backend.

Cards and Choices not displayed in Skype for business (Bot Framework)

I recently add the skype for business channel to my bot, however Choices prompts and Hero Cards are not displayed in the message
intents.matches(/^test/, [
function (session) {
const leaves = ['Holiday', 'Medical', 'Meeting', 'Seminar'];
builder.Prompts.choice(session, 'Please select a leave request', leaves, { listStyle: builder.ListStyle.button });
},
function (session, args) {
session.endDialog(`You are taking a ${args.response.entity} leave`);
}
]);
The Skype for Business channel for Bot Framework is currently under Developer Preview.
Per the official documentation:
Cards and buttons : Skype for Business does not support cards and buttons in the Developer Preview. For the Developer Preview, cards and
buttons are not shown to the user if they are sent by a bot. Cards and
buttons fallback to text support will be added soon.

Resources