I have a Rasa bot in local environment and exposed it with ngrok and it fails to connect to Microsoft Teams channel.
I am using the endpoint “https://xxxxxx.ngrok.io/webhooks/botframework/webhook”
I have also created a Azure Active Directory app and provided the credentials in credentials.yml
Bot failed to get the token so I had to change the MICROSOFT_OAUTH2_PATH in botframework.py from
MICROSOFT_OAUTH2_PATH = “botframework.com/oauth2/v2.0/token”
to following
MICROSOFT_OAUTH2_PATH = “my-default-directory-id/oauth2/v2.0/token”
No I can get the token but I am getting the following error
2019-11-16 12:28:50 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_0_MemoizationPolicy
2019-11-16 12:28:50 DEBUG rasa.core.processor - Predicted next action 'action_listen' with confidence 1.00.
2019-11-16 12:28:50 DEBUG rasa.core.processor - Action 'action_listen' ended with events '[]'
2019-11-16 12:28:50 DEBUG rasa.core.lock_store - Deleted lock for conversation '29:1bdrGBPoUuSsfwaDEdPG8zaXweU5Iux9diwozFzVDIutP0Q73JpSUcq8FnjdHWCy45kkzzTlfUJ1YY2Yl2rKYjw'.
2019-11-16 12:31:05 DEBUG rasa.core.tracker_store - Recreating tracker for id '29:1bdrGBPoUuSsfwaDEdPG8zaXweU5Iux9diwozFzVDIutP0Q73JpSUcq8FnjdHWCy45kkzzTlfUJ1YY2Yl2rKYjw'
2019-11-16 12:31:05 DEBUG rasa.core.processor - Received user message 'hi' with intent '{'name': 'greet', 'confidence': 0.9369716644287109}' and entities '[]'
2019-11-16 12:31:05 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 6 events
2019-11-16 12:31:05 DEBUG rasa.core.policies.memoization - Current tracker state [None, {}, {'prev_action_listen': 1.0, 'intent_greet': 1.0}, {'prev_utter_greet': 1.0, 'intent_greet': 1.0}, {'prev_action_listen': 1.0, 'intent_greet': 1.0}]
2019-11-16 12:31:05 DEBUG rasa.core.policies.memoization - There is no memorised next action
2019-11-16 12:31:05 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_1_KerasPolicy
2019-11-16 12:31:05 DEBUG rasa.core.processor - Predicted next action 'utter_happy' with confidence 0.33.
2019-11-16 12:31:05 DEBUG rasa.core.processor - Action 'utter_happy' ended with events '['BotUttered(text: Great, carry on!, data: {"elements": null, "quick_replies": null, "buttons": null, "attachment": null, "image": null, "custom": null}, metadata: {})']'
2019-11-16 12:31:05 ERROR rasa.core.channels.botframework - Error trying to send botframework messge. Response: {"message":"Authorization has been denied for this request."}
2019-11-16 12:31:05 DEBUG rasa.core.policies.memoization - Current tracker state [{}, {'prev_action_listen': 1.0, 'intent_greet': 1.0}, {'prev_utter_greet': 1.0, 'intent_greet': 1.0}, {'prev_action_listen': 1.0, 'intent_greet': 1.0}, {'intent_greet': 1.0, 'prev_utter_happy': 1.0}]
2019-11-16 12:31:05 DEBUG rasa.core.policies.memoization - There is no memorised next action
2019-11-16 12:31:05 DEBUG rasa.core.policies.mapping_policy - There is no mapped action for the predicted intent, 'greet'.
I can see that the message is receiving and intent detection is done but it fails to send the reply. I have logged the post_message_uri, headers and message_data
2019-11-16 12:31:05 INFO rasa.core.channels.botframework - https://smba.trafficmanager.net/apac/v3/conversations/a:1znrD__jLTjxqUtCjNOnh14ogzQHXRnP-BuDrJ4Lk_FwUY7r-JiFBlPU6gnbw61cEK7GP-hwO3xewIbHMQZf1CHSkCXqcWhZkXnSKaKdTwPg3pMQuuTEO0B7Kjyuv-1Tj/activities
2019-11-16 12:31:05 INFO rasa.core.channels.botframework - {'content-type': 'application/json', 'Authorization': 'Bearer eyxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'}
2019-11-16 12:31:05 INFO rasa.core.channels.botframework - {'type': 'message', 'recipient': {'id': '29:1bdrGxxxxxxxxxxxxxxxxxxxxxx'}, 'from': {'id': '28:2087cxxxxxxxxxxxx', 'name': 'RasaTest'}, 'channelData': {'notification': {'alert': 'true'}}, 'text': 'Great, carry on!'}
I have added following permissions to my Azure Active Directory app
Delegated Permissions
- User.Read
- User.ReadAll
- User.ReadBasic.All
- User.ReadWrite.All
- openid
- profile
Application Permissions
- User.ReadAll
- User.ReadWrite.All
All the permissions have been granted admin consent but still it says Error trying to send botframework messge. Response: {“message”:“Authorization has been denied for this request.”}
How can I solve this?