Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

Commit ecce1b0

Browse files
mdrichardsonEric Dahlvang
authored andcommitted
add notes about TrustServiceUrl (#2044)
* add notes about TrustServiceUrl * added proactive docs to Proactive Teams sample
1 parent 8c1e8ed commit ecce1b0

File tree

8 files changed

+24
-0
lines changed

8 files changed

+24
-0
lines changed

samples/csharp_dotnetcore/16.proactive-messages/Controllers/NotifyController.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public async Task<IActionResult> Get()
5555

5656
private async Task BotCallback(ITurnContext turnContext, CancellationToken cancellationToken)
5757
{
58+
// If you encounter permission-related errors when sending this message, see
59+
// https://aka.ms/BotTrustServiceUrl
5860
await turnContext.SendActivityAsync("proactive hello");
5961
}
6062
}

samples/csharp_dotnetcore/16.proactive-messages/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ In order to send a proactive message using Bot Framework, the bot must first cap
8686
8787
To send proactive messages, acquire a conversation reference, then use `adapter.continueConversation()` to create a TurnContext object that will allow the bot to deliver the new outgoing message.
8888
89+
### Avoiding Permission-Related Errors
90+
91+
You may encounter permission-related errors when sending a proactive message. This can often be mitigated by using `MicrosoftAppCredentials.TrustServiceUrl()`. See [the documentation](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-proactive-message?view=azure-bot-service-4.0&tabs=csharp#avoiding-401-unauthorized-errors) for more information.
92+
8993
## Deploy this bot to Azure
9094
9195
To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions.

samples/csharp_dotnetcore/57.teams-conversation-bot/Bots/TeamsConversationBot.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ private async Task DeleteCardActivityAsync(ITurnContext<IMessageActivity> turnCo
9191
await turnContext.DeleteActivityAsync(turnContext.Activity.ReplyToId, cancellationToken);
9292
}
9393

94+
// If you encounter permission-related errors when sending this message, see
95+
// https://aka.ms/BotTrustServiceUrl
9496
private async Task MessageAllMembersAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
9597
{
9698
var teamsChannelId = turnContext.Activity.TeamsGetChannelId();

samples/csharp_dotnetcore/57.teams-conversation-bot/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ You can interact with this bot by sending it a message, or selecting a command f
6464
6565
You can select an option from the command list by typing ```@TeamsConversationBot``` into the compose message area and ```What can I do?``` text above the compose area.
6666
67+
### Avoiding Permission-Related Errors
68+
69+
You may encounter permission-related errors when sending a proactive message. This can often be mitigated by using `MicrosoftAppCredentials.TrustServiceUrl()`. See [the documentation](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-proactive-message?view=azure-bot-service-4.0&tabs=csharp#avoiding-401-unauthorized-errors) for more information.
70+
6771
## Deploy the bot to Azure
6872
6973
To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions.

samples/javascript_nodejs/16.proactive-messages/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ In order to send a proactive message using Bot Framework, the bot must first cap
8686
8787
To send proactive messages, acquire a conversation reference, then use `adapter.continueConversation()` to create a TurnContext object that will allow the bot to deliver the new outgoing message.
8888
89+
### Avoiding Permission-Related Errors
90+
91+
You may encounter permission-related errors when sending a proactive message. This can often be mitigated by using `MicrosoftAppCredentials.trustServiceUrl()`. See [the documentation](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-proactive-message?view=azure-bot-service-4.0&tabs=javascript#avoiding-401-unauthorized-errors) for more information.
92+
8993
## Deploy this bot to Azure
9094
9195
To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions.

samples/javascript_nodejs/16.proactive-messages/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ server.post('/api/messages', (req, res) => {
6969
server.get('/api/notify', async (req, res) => {
7070
for (const conversationReference of Object.values(conversationReferences)) {
7171
await adapter.continueConversation(conversationReference, async turnContext => {
72+
// If you encounter permission-related errors when sending this message, see
73+
// https://aka.ms/BotTrustServiceUrl
7274
await turnContext.sendActivity('proactive hello');
7375
});
7476
}

samples/javascript_nodejs/57.teams-conversation-bot/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ You can interact with this bot by sending it a message, or selecting a command f
7171
7272
You can select an option from the command list by typing ```@TeamsConversationBot``` into the compose message area and ```What can I do?``` text above the compose area.
7373
74+
### Avoiding Permission-Related Errors
75+
76+
You may encounter permission-related errors when sending a proactive message. This can often be mitigated by using `MicrosoftAppCredentials.trustServiceUrl()`. See [the documentation](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-howto-proactive-message?view=azure-bot-service-4.0&tabs=javascript#avoiding-401-unauthorized-errors) for more information.
77+
7478
## Deploy the bot to Azure
7579
7680
To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions.

samples/javascript_nodejs/57.teams-conversation-bot/bots/teamsConversationBot.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ class TeamsConversationBot extends TeamsActivityHandler {
112112
await context.deleteActivity(context.activity.replyToId);
113113
}
114114

115+
// If you encounter permission-related errors when sending this message, see
116+
// https://aka.ms/BotTrustServiceUrl
115117
async messageAllMembersAsync(context) {
116118
const members = await TeamsInfo.getMembers(context);
117119

0 commit comments

Comments
 (0)