How do I get notifications when a bot sends a message in Teams? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How do I get started with Node.jsHow to decide when to use Node.js?Using Custom API bot can't post action card in Microsoft Teams channel using Bot frameworkHow can I get my bot to post a message to a Microsoft Teams channel?Microsoft Teams - Deeplink to bot tabMS Teams - Don't show notification of specific message in the activity feedMicrosoft Bot Framework - Adaptive card version not supported in Teams and Skype for BusinessProactively send message to a Team chat in Microsoft Teams using Microsoft Bot Framework V4Unable to send pdf file from bot to user in ms teamsCannot send attachment to MS Teams app bot in a channel
As Singapore Airlines (Krisflyer) Gold, can I bring my family into the lounge on a domestic Virgin Australia flight?
How to report t statistic from R
One-one communication
How do living politicians protect their readily obtainable signatures from misuse?
Why are my pictures showing a dark band on one edge?
Sum letters are not two different
How could we fake a moon landing now?
How often does castling occur in grandmaster games?
Is CEO the "profession" with the most psychopaths?
macOS: Name for app shortcut screen found by pinching with thumb and three fingers
What do you call the main part of a joke?
An adverb for when you're not exaggerating
How can I set the aperture on my DSLR when it's attached to a telescope instead of a lens?
What does 丫 mean? 丫是什么意思?
What are the discoveries that have been possible with the rejection of positivism?
Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?
How long can equipment go unused before powering up runs the risk of damage?
Trademark violation for app?
How would a mousetrap for use in space work?
Deconstruction is ambiguous
How to compare two different files line by line in unix?
How many morphisms from 1 to 1+1 can there be?
Is there hard evidence that the grant peer review system performs significantly better than random?
Has negative voting ever been officially implemented in elections, or seriously proposed, or even studied?
How do I get notifications when a bot sends a message in Teams?
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How do I get started with Node.jsHow to decide when to use Node.js?Using Custom API bot can't post action card in Microsoft Teams channel using Bot frameworkHow can I get my bot to post a message to a Microsoft Teams channel?Microsoft Teams - Deeplink to bot tabMS Teams - Don't show notification of specific message in the activity feedMicrosoft Bot Framework - Adaptive card version not supported in Teams and Skype for BusinessProactively send message to a Team chat in Microsoft Teams using Microsoft Bot Framework V4Unable to send pdf file from bot to user in ms teamsCannot send attachment to MS Teams app bot in a channel
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I developed a bot for Microsoft Teams using the Microsoft Bot Framework v4 Nodejs SDK (botbuilder-sdk for nodejs). We have implemented the bot in such a way that, when we receive data using a REST API call from one of our CRMs, the data is posted to the channels on Microsoft Teams. However, when I do that, we do not receive a notification on the devices. Has anyone faced such an issue?
I am saving the context state initially. Everytime we receive data from a CRM, I am incrementing the activity id of the message (to send it as a new message and not a reply) and sending it to Microsoft Teams using context.sendActivity().
When we receive that adaptive card, we do not receive a notification in the activity feed or on any of the devices.
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
node.js notifications botframework microsoft-teams azure-bot-service
add a comment |
I developed a bot for Microsoft Teams using the Microsoft Bot Framework v4 Nodejs SDK (botbuilder-sdk for nodejs). We have implemented the bot in such a way that, when we receive data using a REST API call from one of our CRMs, the data is posted to the channels on Microsoft Teams. However, when I do that, we do not receive a notification on the devices. Has anyone faced such an issue?
I am saving the context state initially. Everytime we receive data from a CRM, I am incrementing the activity id of the message (to send it as a new message and not a reply) and sending it to Microsoft Teams using context.sendActivity().
When we receive that adaptive card, we do not receive a notification in the activity feed or on any of the devices.
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
node.js notifications botframework microsoft-teams azure-bot-service
In the Teams app, you can access the settings by tapping the three lines in the upper left corner. From there you can access the Teams notification settings and from the Teams notification settings you can access device-level settings. You might try changing some of those to see if you start getting notifications. Also try having the bot use @ mentions in its messages.
– Kyle Delaney
Feb 20 at 0:36
@KyleDelaney I have all the notifications turned on for my Teams app. Yet, it doesn’t work
– Pratik Mathur
Feb 20 at 19:07
Did you try having the bot @ mention the team? support.office.com/en-us/article/…
– Kyle Delaney
Mar 6 at 19:39
add a comment |
I developed a bot for Microsoft Teams using the Microsoft Bot Framework v4 Nodejs SDK (botbuilder-sdk for nodejs). We have implemented the bot in such a way that, when we receive data using a REST API call from one of our CRMs, the data is posted to the channels on Microsoft Teams. However, when I do that, we do not receive a notification on the devices. Has anyone faced such an issue?
I am saving the context state initially. Everytime we receive data from a CRM, I am incrementing the activity id of the message (to send it as a new message and not a reply) and sending it to Microsoft Teams using context.sendActivity().
When we receive that adaptive card, we do not receive a notification in the activity feed or on any of the devices.
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
node.js notifications botframework microsoft-teams azure-bot-service
I developed a bot for Microsoft Teams using the Microsoft Bot Framework v4 Nodejs SDK (botbuilder-sdk for nodejs). We have implemented the bot in such a way that, when we receive data using a REST API call from one of our CRMs, the data is posted to the channels on Microsoft Teams. However, when I do that, we do not receive a notification on the devices. Has anyone faced such an issue?
I am saving the context state initially. Everytime we receive data from a CRM, I am incrementing the activity id of the message (to send it as a new message and not a reply) and sending it to Microsoft Teams using context.sendActivity().
When we receive that adaptive card, we do not receive a notification in the activity feed or on any of the devices.
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
node.js notifications botframework microsoft-teams azure-bot-service
node.js notifications botframework microsoft-teams azure-bot-service
edited Mar 11 at 14:39
Pratik Mathur
asked Feb 19 at 15:46
Pratik MathurPratik Mathur
175
175
In the Teams app, you can access the settings by tapping the three lines in the upper left corner. From there you can access the Teams notification settings and from the Teams notification settings you can access device-level settings. You might try changing some of those to see if you start getting notifications. Also try having the bot use @ mentions in its messages.
– Kyle Delaney
Feb 20 at 0:36
@KyleDelaney I have all the notifications turned on for my Teams app. Yet, it doesn’t work
– Pratik Mathur
Feb 20 at 19:07
Did you try having the bot @ mention the team? support.office.com/en-us/article/…
– Kyle Delaney
Mar 6 at 19:39
add a comment |
In the Teams app, you can access the settings by tapping the three lines in the upper left corner. From there you can access the Teams notification settings and from the Teams notification settings you can access device-level settings. You might try changing some of those to see if you start getting notifications. Also try having the bot use @ mentions in its messages.
– Kyle Delaney
Feb 20 at 0:36
@KyleDelaney I have all the notifications turned on for my Teams app. Yet, it doesn’t work
– Pratik Mathur
Feb 20 at 19:07
Did you try having the bot @ mention the team? support.office.com/en-us/article/…
– Kyle Delaney
Mar 6 at 19:39
In the Teams app, you can access the settings by tapping the three lines in the upper left corner. From there you can access the Teams notification settings and from the Teams notification settings you can access device-level settings. You might try changing some of those to see if you start getting notifications. Also try having the bot use @ mentions in its messages.
– Kyle Delaney
Feb 20 at 0:36
In the Teams app, you can access the settings by tapping the three lines in the upper left corner. From there you can access the Teams notification settings and from the Teams notification settings you can access device-level settings. You might try changing some of those to see if you start getting notifications. Also try having the bot use @ mentions in its messages.
– Kyle Delaney
Feb 20 at 0:36
@KyleDelaney I have all the notifications turned on for my Teams app. Yet, it doesn’t work
– Pratik Mathur
Feb 20 at 19:07
@KyleDelaney I have all the notifications turned on for my Teams app. Yet, it doesn’t work
– Pratik Mathur
Feb 20 at 19:07
Did you try having the bot @ mention the team? support.office.com/en-us/article/…
– Kyle Delaney
Mar 6 at 19:39
Did you try having the bot @ mention the team? support.office.com/en-us/article/…
– Kyle Delaney
Mar 6 at 19:39
add a comment |
2 Answers
2
active
oldest
votes
Edit: OP and I have exchanged a few emails to get this answered. This answer, as a whole, is good information for accomplishing Teams Proactive messaging, in general, but the main answer is in the last section, Simplified Code.
This is a long answer that covers many areas, simply because I'm not 100% sure I know what kind of notification you aren't receiving.
Troubleshooting
Troubleshooting Guide- Pay special attention to the many areas where notifications need to be enabled
- In particular, the user may need to "Follow" and/or "Favorite" the channel to receive notifications from it
- Pay special attention to the many areas where notifications need to be enabled
- If a user has the desktop app open, they will receive the notification there and will not receive one on their phone unless they have been inactive on the desktop app for 3+ minutes. Otherwise, it's likely a bug in Teams.
Chat Notifications
If you've followed the Troubleshooting Guide linked above, your users should receive chat notifications. If not, you can try updating your MS Teams desktop or mobile client. As @KyleDelaney mentioned, it may be helpful to @
mention users and/or channels
Activity Feed Notifications
You can also create Activity Feed Notifications. The gist of it is that you need to:
- Include
text
andsummary
in the message - Include
channelData
that setsnotifications.alert
to true
This code will accomplish that:
const msg = MessageFactory.text('my message');
msg.summary = 'my summary';
msg.channelData =
notification:
alert: true,
,
;
return await dc.context.sendActivity(msg);
Result:
Note: If your bot only creates notifications and doesn't have conversations, you may benefit from creating a notifications-only bot.
Full Implementation Code
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
await turnContext.sendActivity(activity);
Result:
Using the Teams Extension
There's a Teams Extension for BobBuilder V4 that's currently in Beta, but seems to accomplish what you need. I believe the reason you weren't getting notifications while using the above is because your bot is creating a new reply chain in the channel and not replying directly to a user. I believe you can do all of this without the extension (by manually editing activity/context properties), but the extension should make it easier.
Here's the code I used to get working notifications within a channel:
In index.js
(or app.js
):
import * as teams from 'botbuilder-teams';
[...]
// Change existing to use "new teams.TeamsAdapter..."
const adapter = new teams.TeamsAdapter( process.env.microsoftAppID,
appPassword: endpointConfig.appPassword );
Wherever you're sending the message:
import * as teams from 'botbuilder-teams';
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
const adapter = context.adapter as teams.TeamsAdapter;
await adapter.createReplyChain(context, [activity]);
Simplified Code
OP and I have emailed back and forth a bit and the key issue is that he needed to add the trustServiceUrl
code from below. Normally, this manifests itself with a 500 error, but in this case, it appears to not create notifications.. After significant testing, here's all you really have to do to send different notifications to different channels. It basically amounts to setting a couple of properties of turncontext.activity and trusting the serviceUrl. No touching activity ID or using the Teams Extension at all. My code below is how I sent messages from Emulator that could then send cards to different Teams channels:
public onTurn = async (turnContext: TurnContext) => {
const dc = await this.dialogs.createContext(turnContext);
const dialogResult = await dc.continueDialog();
// Route message from Emulator to Teams Channel - I can send "1", "2", or "3" in emulator and bot will create message for Channel
let teamsChannel;
switch (turnContext.activity.text)
// You can get teamsChannel IDs from turnContext.activity.channelData.channel.id
case '1':
teamsChannel = '19:8d60061c3d104exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '2':
teamsChannel = '19:0e477430ebad4exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '3':
teamsChannel = '19:55c1c5fb0d304exxxxxxxxxxxxxxxxx0@thread.skype';
break;
default:
break;
if (teamsChannel)
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
summary: 'my summary',
text: 'Test Card',
;
const serviceUrl = 'https://smba.trafficmanager.net/amer/';
turnContext.activity.conversation.id = teamsChannel;
turnContext.activity.serviceUrl = serviceUrl;
// This ensures that your bot can send to Teams
MicrosoftAppCredentials.trustServiceUrl(serviceUrl);
await turnContext.sendActivity(activity);
else
[...Normal onTurn Code...]
await this.conversationState.saveChanges(turnContext);
Note: To receive notifications, you and your users must follow the channel.
Can we do this in v4 using NodeJS?
– Pratik Mathur
Mar 7 at 19:46
Yes. The code above is in Node and V4. I tested all of this and all notifications worked.
– mdrichardson - MSFT
Mar 7 at 19:56
I tried to implement this to send a message.Still doesn't work
– Pratik Mathur
Mar 8 at 20:37
Can you edit/update your question with additional details? What exactly isn't working? Can you share applicable images? What is the relevant code that you're using? As you can see in my image, I got it working just fine, so it's definitely possible. I just can't help without further details.
– mdrichardson - MSFT
Mar 8 at 20:47
I've made the change to the question.
– Pratik Mathur
Mar 8 at 21:00
|
show 2 more comments
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
Interesting. I'll look into this today. For the sake of trying to replicate this, what Teams Client are you using (Desktop/Web/Mobile)? Is your bot hosted on Azure? How much time passes between receiving "TMS Bot Started" and "New Lead" messages? Do you close the client between messages or leave it open? Do you switch chat channels between messages? Also, you may want to delete this "answer" and add it as an edit to your question.
– mdrichardson - MSFT
Mar 11 at 14:31
Thank you for your help. I am using the Teams Desktop client, hosted on Azure using the Bot Registration. We do not have a fixed time between the messages. However, during the testing phase, you can say probably 5-10 seconds. We have multiple channels running the same bot. Depending on the data, we post the message to the right channel.
– Pratik Mathur
Mar 11 at 14:38
I see that this is happening when I manually increment the activity id of the context object ( to send the Adaptive Card). When the activity id is automatically generated, I do receive the notification. So I think it's something that I'm probably not running it through the Middleware the correct way.
– Pratik Mathur
Mar 11 at 17:47
That would be my guess. I came across this teams extension and am trying to get it working, now. You may find it helpful
– mdrichardson - MSFT
Mar 11 at 17:56
I've updated my answer with a way you can use the Teams Extension. If you're still having issues, it's likely like you said--an issue with your middleware and manually updating the activity id.
– mdrichardson - MSFT
Mar 11 at 20:06
|
show 2 more comments
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54770102%2fhow-do-i-get-notifications-when-a-bot-sends-a-message-in-teams%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Edit: OP and I have exchanged a few emails to get this answered. This answer, as a whole, is good information for accomplishing Teams Proactive messaging, in general, but the main answer is in the last section, Simplified Code.
This is a long answer that covers many areas, simply because I'm not 100% sure I know what kind of notification you aren't receiving.
Troubleshooting
Troubleshooting Guide- Pay special attention to the many areas where notifications need to be enabled
- In particular, the user may need to "Follow" and/or "Favorite" the channel to receive notifications from it
- Pay special attention to the many areas where notifications need to be enabled
- If a user has the desktop app open, they will receive the notification there and will not receive one on their phone unless they have been inactive on the desktop app for 3+ minutes. Otherwise, it's likely a bug in Teams.
Chat Notifications
If you've followed the Troubleshooting Guide linked above, your users should receive chat notifications. If not, you can try updating your MS Teams desktop or mobile client. As @KyleDelaney mentioned, it may be helpful to @
mention users and/or channels
Activity Feed Notifications
You can also create Activity Feed Notifications. The gist of it is that you need to:
- Include
text
andsummary
in the message - Include
channelData
that setsnotifications.alert
to true
This code will accomplish that:
const msg = MessageFactory.text('my message');
msg.summary = 'my summary';
msg.channelData =
notification:
alert: true,
,
;
return await dc.context.sendActivity(msg);
Result:
Note: If your bot only creates notifications and doesn't have conversations, you may benefit from creating a notifications-only bot.
Full Implementation Code
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
await turnContext.sendActivity(activity);
Result:
Using the Teams Extension
There's a Teams Extension for BobBuilder V4 that's currently in Beta, but seems to accomplish what you need. I believe the reason you weren't getting notifications while using the above is because your bot is creating a new reply chain in the channel and not replying directly to a user. I believe you can do all of this without the extension (by manually editing activity/context properties), but the extension should make it easier.
Here's the code I used to get working notifications within a channel:
In index.js
(or app.js
):
import * as teams from 'botbuilder-teams';
[...]
// Change existing to use "new teams.TeamsAdapter..."
const adapter = new teams.TeamsAdapter( process.env.microsoftAppID,
appPassword: endpointConfig.appPassword );
Wherever you're sending the message:
import * as teams from 'botbuilder-teams';
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
const adapter = context.adapter as teams.TeamsAdapter;
await adapter.createReplyChain(context, [activity]);
Simplified Code
OP and I have emailed back and forth a bit and the key issue is that he needed to add the trustServiceUrl
code from below. Normally, this manifests itself with a 500 error, but in this case, it appears to not create notifications.. After significant testing, here's all you really have to do to send different notifications to different channels. It basically amounts to setting a couple of properties of turncontext.activity and trusting the serviceUrl. No touching activity ID or using the Teams Extension at all. My code below is how I sent messages from Emulator that could then send cards to different Teams channels:
public onTurn = async (turnContext: TurnContext) => {
const dc = await this.dialogs.createContext(turnContext);
const dialogResult = await dc.continueDialog();
// Route message from Emulator to Teams Channel - I can send "1", "2", or "3" in emulator and bot will create message for Channel
let teamsChannel;
switch (turnContext.activity.text)
// You can get teamsChannel IDs from turnContext.activity.channelData.channel.id
case '1':
teamsChannel = '19:8d60061c3d104exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '2':
teamsChannel = '19:0e477430ebad4exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '3':
teamsChannel = '19:55c1c5fb0d304exxxxxxxxxxxxxxxxx0@thread.skype';
break;
default:
break;
if (teamsChannel)
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
summary: 'my summary',
text: 'Test Card',
;
const serviceUrl = 'https://smba.trafficmanager.net/amer/';
turnContext.activity.conversation.id = teamsChannel;
turnContext.activity.serviceUrl = serviceUrl;
// This ensures that your bot can send to Teams
MicrosoftAppCredentials.trustServiceUrl(serviceUrl);
await turnContext.sendActivity(activity);
else
[...Normal onTurn Code...]
await this.conversationState.saveChanges(turnContext);
Note: To receive notifications, you and your users must follow the channel.
Can we do this in v4 using NodeJS?
– Pratik Mathur
Mar 7 at 19:46
Yes. The code above is in Node and V4. I tested all of this and all notifications worked.
– mdrichardson - MSFT
Mar 7 at 19:56
I tried to implement this to send a message.Still doesn't work
– Pratik Mathur
Mar 8 at 20:37
Can you edit/update your question with additional details? What exactly isn't working? Can you share applicable images? What is the relevant code that you're using? As you can see in my image, I got it working just fine, so it's definitely possible. I just can't help without further details.
– mdrichardson - MSFT
Mar 8 at 20:47
I've made the change to the question.
– Pratik Mathur
Mar 8 at 21:00
|
show 2 more comments
Edit: OP and I have exchanged a few emails to get this answered. This answer, as a whole, is good information for accomplishing Teams Proactive messaging, in general, but the main answer is in the last section, Simplified Code.
This is a long answer that covers many areas, simply because I'm not 100% sure I know what kind of notification you aren't receiving.
Troubleshooting
Troubleshooting Guide- Pay special attention to the many areas where notifications need to be enabled
- In particular, the user may need to "Follow" and/or "Favorite" the channel to receive notifications from it
- Pay special attention to the many areas where notifications need to be enabled
- If a user has the desktop app open, they will receive the notification there and will not receive one on their phone unless they have been inactive on the desktop app for 3+ minutes. Otherwise, it's likely a bug in Teams.
Chat Notifications
If you've followed the Troubleshooting Guide linked above, your users should receive chat notifications. If not, you can try updating your MS Teams desktop or mobile client. As @KyleDelaney mentioned, it may be helpful to @
mention users and/or channels
Activity Feed Notifications
You can also create Activity Feed Notifications. The gist of it is that you need to:
- Include
text
andsummary
in the message - Include
channelData
that setsnotifications.alert
to true
This code will accomplish that:
const msg = MessageFactory.text('my message');
msg.summary = 'my summary';
msg.channelData =
notification:
alert: true,
,
;
return await dc.context.sendActivity(msg);
Result:
Note: If your bot only creates notifications and doesn't have conversations, you may benefit from creating a notifications-only bot.
Full Implementation Code
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
await turnContext.sendActivity(activity);
Result:
Using the Teams Extension
There's a Teams Extension for BobBuilder V4 that's currently in Beta, but seems to accomplish what you need. I believe the reason you weren't getting notifications while using the above is because your bot is creating a new reply chain in the channel and not replying directly to a user. I believe you can do all of this without the extension (by manually editing activity/context properties), but the extension should make it easier.
Here's the code I used to get working notifications within a channel:
In index.js
(or app.js
):
import * as teams from 'botbuilder-teams';
[...]
// Change existing to use "new teams.TeamsAdapter..."
const adapter = new teams.TeamsAdapter( process.env.microsoftAppID,
appPassword: endpointConfig.appPassword );
Wherever you're sending the message:
import * as teams from 'botbuilder-teams';
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
const adapter = context.adapter as teams.TeamsAdapter;
await adapter.createReplyChain(context, [activity]);
Simplified Code
OP and I have emailed back and forth a bit and the key issue is that he needed to add the trustServiceUrl
code from below. Normally, this manifests itself with a 500 error, but in this case, it appears to not create notifications.. After significant testing, here's all you really have to do to send different notifications to different channels. It basically amounts to setting a couple of properties of turncontext.activity and trusting the serviceUrl. No touching activity ID or using the Teams Extension at all. My code below is how I sent messages from Emulator that could then send cards to different Teams channels:
public onTurn = async (turnContext: TurnContext) => {
const dc = await this.dialogs.createContext(turnContext);
const dialogResult = await dc.continueDialog();
// Route message from Emulator to Teams Channel - I can send "1", "2", or "3" in emulator and bot will create message for Channel
let teamsChannel;
switch (turnContext.activity.text)
// You can get teamsChannel IDs from turnContext.activity.channelData.channel.id
case '1':
teamsChannel = '19:8d60061c3d104exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '2':
teamsChannel = '19:0e477430ebad4exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '3':
teamsChannel = '19:55c1c5fb0d304exxxxxxxxxxxxxxxxx0@thread.skype';
break;
default:
break;
if (teamsChannel)
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
summary: 'my summary',
text: 'Test Card',
;
const serviceUrl = 'https://smba.trafficmanager.net/amer/';
turnContext.activity.conversation.id = teamsChannel;
turnContext.activity.serviceUrl = serviceUrl;
// This ensures that your bot can send to Teams
MicrosoftAppCredentials.trustServiceUrl(serviceUrl);
await turnContext.sendActivity(activity);
else
[...Normal onTurn Code...]
await this.conversationState.saveChanges(turnContext);
Note: To receive notifications, you and your users must follow the channel.
Can we do this in v4 using NodeJS?
– Pratik Mathur
Mar 7 at 19:46
Yes. The code above is in Node and V4. I tested all of this and all notifications worked.
– mdrichardson - MSFT
Mar 7 at 19:56
I tried to implement this to send a message.Still doesn't work
– Pratik Mathur
Mar 8 at 20:37
Can you edit/update your question with additional details? What exactly isn't working? Can you share applicable images? What is the relevant code that you're using? As you can see in my image, I got it working just fine, so it's definitely possible. I just can't help without further details.
– mdrichardson - MSFT
Mar 8 at 20:47
I've made the change to the question.
– Pratik Mathur
Mar 8 at 21:00
|
show 2 more comments
Edit: OP and I have exchanged a few emails to get this answered. This answer, as a whole, is good information for accomplishing Teams Proactive messaging, in general, but the main answer is in the last section, Simplified Code.
This is a long answer that covers many areas, simply because I'm not 100% sure I know what kind of notification you aren't receiving.
Troubleshooting
Troubleshooting Guide- Pay special attention to the many areas where notifications need to be enabled
- In particular, the user may need to "Follow" and/or "Favorite" the channel to receive notifications from it
- Pay special attention to the many areas where notifications need to be enabled
- If a user has the desktop app open, they will receive the notification there and will not receive one on their phone unless they have been inactive on the desktop app for 3+ minutes. Otherwise, it's likely a bug in Teams.
Chat Notifications
If you've followed the Troubleshooting Guide linked above, your users should receive chat notifications. If not, you can try updating your MS Teams desktop or mobile client. As @KyleDelaney mentioned, it may be helpful to @
mention users and/or channels
Activity Feed Notifications
You can also create Activity Feed Notifications. The gist of it is that you need to:
- Include
text
andsummary
in the message - Include
channelData
that setsnotifications.alert
to true
This code will accomplish that:
const msg = MessageFactory.text('my message');
msg.summary = 'my summary';
msg.channelData =
notification:
alert: true,
,
;
return await dc.context.sendActivity(msg);
Result:
Note: If your bot only creates notifications and doesn't have conversations, you may benefit from creating a notifications-only bot.
Full Implementation Code
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
await turnContext.sendActivity(activity);
Result:
Using the Teams Extension
There's a Teams Extension for BobBuilder V4 that's currently in Beta, but seems to accomplish what you need. I believe the reason you weren't getting notifications while using the above is because your bot is creating a new reply chain in the channel and not replying directly to a user. I believe you can do all of this without the extension (by manually editing activity/context properties), but the extension should make it easier.
Here's the code I used to get working notifications within a channel:
In index.js
(or app.js
):
import * as teams from 'botbuilder-teams';
[...]
// Change existing to use "new teams.TeamsAdapter..."
const adapter = new teams.TeamsAdapter( process.env.microsoftAppID,
appPassword: endpointConfig.appPassword );
Wherever you're sending the message:
import * as teams from 'botbuilder-teams';
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
const adapter = context.adapter as teams.TeamsAdapter;
await adapter.createReplyChain(context, [activity]);
Simplified Code
OP and I have emailed back and forth a bit and the key issue is that he needed to add the trustServiceUrl
code from below. Normally, this manifests itself with a 500 error, but in this case, it appears to not create notifications.. After significant testing, here's all you really have to do to send different notifications to different channels. It basically amounts to setting a couple of properties of turncontext.activity and trusting the serviceUrl. No touching activity ID or using the Teams Extension at all. My code below is how I sent messages from Emulator that could then send cards to different Teams channels:
public onTurn = async (turnContext: TurnContext) => {
const dc = await this.dialogs.createContext(turnContext);
const dialogResult = await dc.continueDialog();
// Route message from Emulator to Teams Channel - I can send "1", "2", or "3" in emulator and bot will create message for Channel
let teamsChannel;
switch (turnContext.activity.text)
// You can get teamsChannel IDs from turnContext.activity.channelData.channel.id
case '1':
teamsChannel = '19:8d60061c3d104exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '2':
teamsChannel = '19:0e477430ebad4exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '3':
teamsChannel = '19:55c1c5fb0d304exxxxxxxxxxxxxxxxx0@thread.skype';
break;
default:
break;
if (teamsChannel)
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
summary: 'my summary',
text: 'Test Card',
;
const serviceUrl = 'https://smba.trafficmanager.net/amer/';
turnContext.activity.conversation.id = teamsChannel;
turnContext.activity.serviceUrl = serviceUrl;
// This ensures that your bot can send to Teams
MicrosoftAppCredentials.trustServiceUrl(serviceUrl);
await turnContext.sendActivity(activity);
else
[...Normal onTurn Code...]
await this.conversationState.saveChanges(turnContext);
Note: To receive notifications, you and your users must follow the channel.
Edit: OP and I have exchanged a few emails to get this answered. This answer, as a whole, is good information for accomplishing Teams Proactive messaging, in general, but the main answer is in the last section, Simplified Code.
This is a long answer that covers many areas, simply because I'm not 100% sure I know what kind of notification you aren't receiving.
Troubleshooting
Troubleshooting Guide- Pay special attention to the many areas where notifications need to be enabled
- In particular, the user may need to "Follow" and/or "Favorite" the channel to receive notifications from it
- Pay special attention to the many areas where notifications need to be enabled
- If a user has the desktop app open, they will receive the notification there and will not receive one on their phone unless they have been inactive on the desktop app for 3+ minutes. Otherwise, it's likely a bug in Teams.
Chat Notifications
If you've followed the Troubleshooting Guide linked above, your users should receive chat notifications. If not, you can try updating your MS Teams desktop or mobile client. As @KyleDelaney mentioned, it may be helpful to @
mention users and/or channels
Activity Feed Notifications
You can also create Activity Feed Notifications. The gist of it is that you need to:
- Include
text
andsummary
in the message - Include
channelData
that setsnotifications.alert
to true
This code will accomplish that:
const msg = MessageFactory.text('my message');
msg.summary = 'my summary';
msg.channelData =
notification:
alert: true,
,
;
return await dc.context.sendActivity(msg);
Result:
Note: If your bot only creates notifications and doesn't have conversations, you may benefit from creating a notifications-only bot.
Full Implementation Code
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
await turnContext.sendActivity(activity);
Result:
Using the Teams Extension
There's a Teams Extension for BobBuilder V4 that's currently in Beta, but seems to accomplish what you need. I believe the reason you weren't getting notifications while using the above is because your bot is creating a new reply chain in the channel and not replying directly to a user. I believe you can do all of this without the extension (by manually editing activity/context properties), but the extension should make it easier.
Here's the code I used to get working notifications within a channel:
In index.js
(or app.js
):
import * as teams from 'botbuilder-teams';
[...]
// Change existing to use "new teams.TeamsAdapter..."
const adapter = new teams.TeamsAdapter( process.env.microsoftAppID,
appPassword: endpointConfig.appPassword );
Wherever you're sending the message:
import * as teams from 'botbuilder-teams';
import * as adaptiveCard from '../src/adaptiveCard.json';
...
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
text: 'Test Card',
summary: 'my summary',
channelData:
notification:
alert: true,
,
,
;
const adapter = context.adapter as teams.TeamsAdapter;
await adapter.createReplyChain(context, [activity]);
Simplified Code
OP and I have emailed back and forth a bit and the key issue is that he needed to add the trustServiceUrl
code from below. Normally, this manifests itself with a 500 error, but in this case, it appears to not create notifications.. After significant testing, here's all you really have to do to send different notifications to different channels. It basically amounts to setting a couple of properties of turncontext.activity and trusting the serviceUrl. No touching activity ID or using the Teams Extension at all. My code below is how I sent messages from Emulator that could then send cards to different Teams channels:
public onTurn = async (turnContext: TurnContext) => {
const dc = await this.dialogs.createContext(turnContext);
const dialogResult = await dc.continueDialog();
// Route message from Emulator to Teams Channel - I can send "1", "2", or "3" in emulator and bot will create message for Channel
let teamsChannel;
switch (turnContext.activity.text)
// You can get teamsChannel IDs from turnContext.activity.channelData.channel.id
case '1':
teamsChannel = '19:8d60061c3d104exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '2':
teamsChannel = '19:0e477430ebad4exxxxxxxxxxxxxxxxxx@thread.skype';
break;
case '3':
teamsChannel = '19:55c1c5fb0d304exxxxxxxxxxxxxxxxx0@thread.skype';
break;
default:
break;
if (teamsChannel)
const card = CardFactory.adaptiveCard(adaptiveCard);
const activity =
attachments: [card],
summary: 'my summary',
text: 'Test Card',
;
const serviceUrl = 'https://smba.trafficmanager.net/amer/';
turnContext.activity.conversation.id = teamsChannel;
turnContext.activity.serviceUrl = serviceUrl;
// This ensures that your bot can send to Teams
MicrosoftAppCredentials.trustServiceUrl(serviceUrl);
await turnContext.sendActivity(activity);
else
[...Normal onTurn Code...]
await this.conversationState.saveChanges(turnContext);
Note: To receive notifications, you and your users must follow the channel.
edited Mar 13 at 15:23
answered Mar 6 at 21:24
mdrichardson - MSFTmdrichardson - MSFT
1,4431112
1,4431112
Can we do this in v4 using NodeJS?
– Pratik Mathur
Mar 7 at 19:46
Yes. The code above is in Node and V4. I tested all of this and all notifications worked.
– mdrichardson - MSFT
Mar 7 at 19:56
I tried to implement this to send a message.Still doesn't work
– Pratik Mathur
Mar 8 at 20:37
Can you edit/update your question with additional details? What exactly isn't working? Can you share applicable images? What is the relevant code that you're using? As you can see in my image, I got it working just fine, so it's definitely possible. I just can't help without further details.
– mdrichardson - MSFT
Mar 8 at 20:47
I've made the change to the question.
– Pratik Mathur
Mar 8 at 21:00
|
show 2 more comments
Can we do this in v4 using NodeJS?
– Pratik Mathur
Mar 7 at 19:46
Yes. The code above is in Node and V4. I tested all of this and all notifications worked.
– mdrichardson - MSFT
Mar 7 at 19:56
I tried to implement this to send a message.Still doesn't work
– Pratik Mathur
Mar 8 at 20:37
Can you edit/update your question with additional details? What exactly isn't working? Can you share applicable images? What is the relevant code that you're using? As you can see in my image, I got it working just fine, so it's definitely possible. I just can't help without further details.
– mdrichardson - MSFT
Mar 8 at 20:47
I've made the change to the question.
– Pratik Mathur
Mar 8 at 21:00
Can we do this in v4 using NodeJS?
– Pratik Mathur
Mar 7 at 19:46
Can we do this in v4 using NodeJS?
– Pratik Mathur
Mar 7 at 19:46
Yes. The code above is in Node and V4. I tested all of this and all notifications worked.
– mdrichardson - MSFT
Mar 7 at 19:56
Yes. The code above is in Node and V4. I tested all of this and all notifications worked.
– mdrichardson - MSFT
Mar 7 at 19:56
I tried to implement this to send a message.Still doesn't work
– Pratik Mathur
Mar 8 at 20:37
I tried to implement this to send a message.Still doesn't work
– Pratik Mathur
Mar 8 at 20:37
Can you edit/update your question with additional details? What exactly isn't working? Can you share applicable images? What is the relevant code that you're using? As you can see in my image, I got it working just fine, so it's definitely possible. I just can't help without further details.
– mdrichardson - MSFT
Mar 8 at 20:47
Can you edit/update your question with additional details? What exactly isn't working? Can you share applicable images? What is the relevant code that you're using? As you can see in my image, I got it working just fine, so it's definitely possible. I just can't help without further details.
– mdrichardson - MSFT
Mar 8 at 20:47
I've made the change to the question.
– Pratik Mathur
Mar 8 at 21:00
I've made the change to the question.
– Pratik Mathur
Mar 8 at 21:00
|
show 2 more comments
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
Interesting. I'll look into this today. For the sake of trying to replicate this, what Teams Client are you using (Desktop/Web/Mobile)? Is your bot hosted on Azure? How much time passes between receiving "TMS Bot Started" and "New Lead" messages? Do you close the client between messages or leave it open? Do you switch chat channels between messages? Also, you may want to delete this "answer" and add it as an edit to your question.
– mdrichardson - MSFT
Mar 11 at 14:31
Thank you for your help. I am using the Teams Desktop client, hosted on Azure using the Bot Registration. We do not have a fixed time between the messages. However, during the testing phase, you can say probably 5-10 seconds. We have multiple channels running the same bot. Depending on the data, we post the message to the right channel.
– Pratik Mathur
Mar 11 at 14:38
I see that this is happening when I manually increment the activity id of the context object ( to send the Adaptive Card). When the activity id is automatically generated, I do receive the notification. So I think it's something that I'm probably not running it through the Middleware the correct way.
– Pratik Mathur
Mar 11 at 17:47
That would be my guess. I came across this teams extension and am trying to get it working, now. You may find it helpful
– mdrichardson - MSFT
Mar 11 at 17:56
I've updated my answer with a way you can use the Teams Extension. If you're still having issues, it's likely like you said--an issue with your middleware and manually updating the activity id.
– mdrichardson - MSFT
Mar 11 at 20:06
|
show 2 more comments
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
Interesting. I'll look into this today. For the sake of trying to replicate this, what Teams Client are you using (Desktop/Web/Mobile)? Is your bot hosted on Azure? How much time passes between receiving "TMS Bot Started" and "New Lead" messages? Do you close the client between messages or leave it open? Do you switch chat channels between messages? Also, you may want to delete this "answer" and add it as an edit to your question.
– mdrichardson - MSFT
Mar 11 at 14:31
Thank you for your help. I am using the Teams Desktop client, hosted on Azure using the Bot Registration. We do not have a fixed time between the messages. However, during the testing phase, you can say probably 5-10 seconds. We have multiple channels running the same bot. Depending on the data, we post the message to the right channel.
– Pratik Mathur
Mar 11 at 14:38
I see that this is happening when I manually increment the activity id of the context object ( to send the Adaptive Card). When the activity id is automatically generated, I do receive the notification. So I think it's something that I'm probably not running it through the Middleware the correct way.
– Pratik Mathur
Mar 11 at 17:47
That would be my guess. I came across this teams extension and am trying to get it working, now. You may find it helpful
– mdrichardson - MSFT
Mar 11 at 17:56
I've updated my answer with a way you can use the Teams Extension. If you're still having issues, it's likely like you said--an issue with your middleware and manually updating the activity id.
– mdrichardson - MSFT
Mar 11 at 20:06
|
show 2 more comments
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
I have gone through all the steps as you described above. I've also gone through the troubleshooting steps. However, it still doesn't give me a notification for the card. However, when I initiate a conversation with the bot, I get a notification when the bot responds.
https://i.stack.imgur.com/Bi4fc.png
https://i.stack.imgur.com/ab6uP.png
In this image, I get a notification when I get the TMS Bot started! message. However, I don't get a notification for the next two messages.
answered Mar 11 at 14:12
Pratik MathurPratik Mathur
175
175
Interesting. I'll look into this today. For the sake of trying to replicate this, what Teams Client are you using (Desktop/Web/Mobile)? Is your bot hosted on Azure? How much time passes between receiving "TMS Bot Started" and "New Lead" messages? Do you close the client between messages or leave it open? Do you switch chat channels between messages? Also, you may want to delete this "answer" and add it as an edit to your question.
– mdrichardson - MSFT
Mar 11 at 14:31
Thank you for your help. I am using the Teams Desktop client, hosted on Azure using the Bot Registration. We do not have a fixed time between the messages. However, during the testing phase, you can say probably 5-10 seconds. We have multiple channels running the same bot. Depending on the data, we post the message to the right channel.
– Pratik Mathur
Mar 11 at 14:38
I see that this is happening when I manually increment the activity id of the context object ( to send the Adaptive Card). When the activity id is automatically generated, I do receive the notification. So I think it's something that I'm probably not running it through the Middleware the correct way.
– Pratik Mathur
Mar 11 at 17:47
That would be my guess. I came across this teams extension and am trying to get it working, now. You may find it helpful
– mdrichardson - MSFT
Mar 11 at 17:56
I've updated my answer with a way you can use the Teams Extension. If you're still having issues, it's likely like you said--an issue with your middleware and manually updating the activity id.
– mdrichardson - MSFT
Mar 11 at 20:06
|
show 2 more comments
Interesting. I'll look into this today. For the sake of trying to replicate this, what Teams Client are you using (Desktop/Web/Mobile)? Is your bot hosted on Azure? How much time passes between receiving "TMS Bot Started" and "New Lead" messages? Do you close the client between messages or leave it open? Do you switch chat channels between messages? Also, you may want to delete this "answer" and add it as an edit to your question.
– mdrichardson - MSFT
Mar 11 at 14:31
Thank you for your help. I am using the Teams Desktop client, hosted on Azure using the Bot Registration. We do not have a fixed time between the messages. However, during the testing phase, you can say probably 5-10 seconds. We have multiple channels running the same bot. Depending on the data, we post the message to the right channel.
– Pratik Mathur
Mar 11 at 14:38
I see that this is happening when I manually increment the activity id of the context object ( to send the Adaptive Card). When the activity id is automatically generated, I do receive the notification. So I think it's something that I'm probably not running it through the Middleware the correct way.
– Pratik Mathur
Mar 11 at 17:47
That would be my guess. I came across this teams extension and am trying to get it working, now. You may find it helpful
– mdrichardson - MSFT
Mar 11 at 17:56
I've updated my answer with a way you can use the Teams Extension. If you're still having issues, it's likely like you said--an issue with your middleware and manually updating the activity id.
– mdrichardson - MSFT
Mar 11 at 20:06
Interesting. I'll look into this today. For the sake of trying to replicate this, what Teams Client are you using (Desktop/Web/Mobile)? Is your bot hosted on Azure? How much time passes between receiving "TMS Bot Started" and "New Lead" messages? Do you close the client between messages or leave it open? Do you switch chat channels between messages? Also, you may want to delete this "answer" and add it as an edit to your question.
– mdrichardson - MSFT
Mar 11 at 14:31
Interesting. I'll look into this today. For the sake of trying to replicate this, what Teams Client are you using (Desktop/Web/Mobile)? Is your bot hosted on Azure? How much time passes between receiving "TMS Bot Started" and "New Lead" messages? Do you close the client between messages or leave it open? Do you switch chat channels between messages? Also, you may want to delete this "answer" and add it as an edit to your question.
– mdrichardson - MSFT
Mar 11 at 14:31
Thank you for your help. I am using the Teams Desktop client, hosted on Azure using the Bot Registration. We do not have a fixed time between the messages. However, during the testing phase, you can say probably 5-10 seconds. We have multiple channels running the same bot. Depending on the data, we post the message to the right channel.
– Pratik Mathur
Mar 11 at 14:38
Thank you for your help. I am using the Teams Desktop client, hosted on Azure using the Bot Registration. We do not have a fixed time between the messages. However, during the testing phase, you can say probably 5-10 seconds. We have multiple channels running the same bot. Depending on the data, we post the message to the right channel.
– Pratik Mathur
Mar 11 at 14:38
I see that this is happening when I manually increment the activity id of the context object ( to send the Adaptive Card). When the activity id is automatically generated, I do receive the notification. So I think it's something that I'm probably not running it through the Middleware the correct way.
– Pratik Mathur
Mar 11 at 17:47
I see that this is happening when I manually increment the activity id of the context object ( to send the Adaptive Card). When the activity id is automatically generated, I do receive the notification. So I think it's something that I'm probably not running it through the Middleware the correct way.
– Pratik Mathur
Mar 11 at 17:47
That would be my guess. I came across this teams extension and am trying to get it working, now. You may find it helpful
– mdrichardson - MSFT
Mar 11 at 17:56
That would be my guess. I came across this teams extension and am trying to get it working, now. You may find it helpful
– mdrichardson - MSFT
Mar 11 at 17:56
I've updated my answer with a way you can use the Teams Extension. If you're still having issues, it's likely like you said--an issue with your middleware and manually updating the activity id.
– mdrichardson - MSFT
Mar 11 at 20:06
I've updated my answer with a way you can use the Teams Extension. If you're still having issues, it's likely like you said--an issue with your middleware and manually updating the activity id.
– mdrichardson - MSFT
Mar 11 at 20:06
|
show 2 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54770102%2fhow-do-i-get-notifications-when-a-bot-sends-a-message-in-teams%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In the Teams app, you can access the settings by tapping the three lines in the upper left corner. From there you can access the Teams notification settings and from the Teams notification settings you can access device-level settings. You might try changing some of those to see if you start getting notifications. Also try having the bot use @ mentions in its messages.
– Kyle Delaney
Feb 20 at 0:36
@KyleDelaney I have all the notifications turned on for my Teams app. Yet, it doesn’t work
– Pratik Mathur
Feb 20 at 19:07
Did you try having the bot @ mention the team? support.office.com/en-us/article/…
– Kyle Delaney
Mar 6 at 19:39