Skip to content

Commit

Permalink
add notes about TrustServiceUrl (#2044)
Browse files Browse the repository at this point in the history
* add notes about TrustServiceUrl

* added proactive docs to Proactive Teams sample
  • Loading branch information
mdrichardson authored and Eric Dahlvang committed Dec 20, 2019
1 parent 8c1e8ed commit ecce1b0
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public async Task<IActionResult> Get()

private async Task BotCallback(ITurnContext turnContext, CancellationToken cancellationToken)
{
// If you encounter permission-related errors when sending this message, see
// https://aka.ms/BotTrustServiceUrl
await turnContext.SendActivityAsync("proactive hello");
}
}
Expand Down
4 changes: 4 additions & 0 deletions samples/csharp_dotnetcore/16.proactive-messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ In order to send a proactive message using Bot Framework, the bot must first cap
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.
### Avoiding Permission-Related Errors
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.
## Deploy this bot to Azure
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ private async Task DeleteCardActivityAsync(ITurnContext<IMessageActivity> turnCo
await turnContext.DeleteActivityAsync(turnContext.Activity.ReplyToId, cancellationToken);
}

// If you encounter permission-related errors when sending this message, see
// https://aka.ms/BotTrustServiceUrl
private async Task MessageAllMembersAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
{
var teamsChannelId = turnContext.Activity.TeamsGetChannelId();
Expand Down
4 changes: 4 additions & 0 deletions samples/csharp_dotnetcore/57.teams-conversation-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ You can interact with this bot by sending it a message, or selecting a command f
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.
### Avoiding Permission-Related Errors
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.
## Deploy the bot to Azure
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.
Expand Down
4 changes: 4 additions & 0 deletions samples/javascript_nodejs/16.proactive-messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ In order to send a proactive message using Bot Framework, the bot must first cap
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.
### Avoiding Permission-Related Errors
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.
## Deploy this bot to Azure
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.
Expand Down
2 changes: 2 additions & 0 deletions samples/javascript_nodejs/16.proactive-messages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ server.post('/api/messages', (req, res) => {
server.get('/api/notify', async (req, res) => {
for (const conversationReference of Object.values(conversationReferences)) {
await adapter.continueConversation(conversationReference, async turnContext => {
// If you encounter permission-related errors when sending this message, see
// https://aka.ms/BotTrustServiceUrl
await turnContext.sendActivity('proactive hello');
});
}
Expand Down
4 changes: 4 additions & 0 deletions samples/javascript_nodejs/57.teams-conversation-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ You can interact with this bot by sending it a message, or selecting a command f
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.
### Avoiding Permission-Related Errors
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.
## Deploy the bot to Azure
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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class TeamsConversationBot extends TeamsActivityHandler {
await context.deleteActivity(context.activity.replyToId);
}

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

Expand Down

0 comments on commit ecce1b0

Please sign in to comment.