Authorization for Microsoft App ID failed with status code Forbidden
Hello!
I have built a bot that works great in Slack, Skype, Facebooks, etc.. The name of the bot is meelo Now I am trying to send a proactive message to the Slack channel and I get the following error "Authorization for Microsoft App ID xxxxxxx failed with status code Forbidden"
Here is the code. Am I doing something wrong?
class Program { static void Main(string[] args) { try { string appdId = ConfigurationManager.AppSettings["MicrosoftAppId"]; string appPassword = ConfigurationManager.AppSettings["MicrosoftAppPassword"]; string baseUri = ConfigurationManager.AppSettings["ConnectorClientBaseUri"];
var client = new ConnectorClient(new Uri(baseUri), appdId, appPassword);
//https://slack.botframework.com
Activity a = new Activity()
{
Type = ActivityTypes.Message,
ChannelId = "slack",
From = new ChannelAccount()
{
Id = "xxxxxxx:T2CUWNSAY",
Name = "meelo"
},
Recipient = new ChannelAccount()
{
Id = "xx:xxxxx",
Name = "tredkar"
},
ServiceUrl = "https://slack.botframework.com",
Text = "Look at this!"
};
var c = client.Conversations.CreateDirectConversation(
new ChannelAccount()
{
Id = "xxxx",
Name = "meelo"
},
new ChannelAccount()
{
Id = "xxxx:xxxxx",
Name = "xxxx"
}, a);
@dynamicdeploy MicrosoftAppCredentials only sets the JwtToken of the bot for the post requests to trusted host names. For regular incoming messages to bot, BotAuthenticator adds the service urls to the trusted set if the incoming request to bot is authenticated.
For proactive messages, your implementation needs to add the service url to the set of trusted host names using the TrustServiceUrl, if the call to connector happens in a process that haven't seen the incoming request. For example, the ResumeAsync(...) implementation shows how bot builder trusts the service url if resumption context has the IsTrustedServiceUrl flag set to true: https://github.com/Microsoft/BotBuilder/blob/db2b8f860a3d8f7744a378930f93c4b0baa97978/CSharp/Library/Microsoft.Bot.Builder/ConnectorEx/LocaleFinder.cs#L46
All links are dead ...
Please update the links :-1:
links updated!
@J4S0Nc You are commenting on a closed issue.
If you have a question or problem, please open a new issue.