Microsoft Teams bot

Does anyone know the easiest method to integrate a botpress bot into Microsoft Teams? I am not sure where to get started. Do I have to use the Converse API?

Thanks,

Jon

2 Likes

We’re currently working on the Microsoft Teams channel, ETA is 2 weeks!

2 Likes

Great to hear that. We are eagerly waiting for the microsoft teams integration.

Could you please detail a bit on how the integration would work? Would there be any azure services/resources needed for deploying the bot? Could the bot be added as a team member to a microsoft team? How does the user invoke the bot?
This would help us to understand the cost impact too.

Thanks!

@sylvain - Any updates on this integration? We are eagerly waiting for it.

Thanks.

Hi shahamit,

It’s in QA right now. Will be available in 12.1. Documentation on how to make it work will also be available with it. ETA is less than a week.

Regards,
JB

1 Like

Hi @jbperron - Any updates for the teams integration? We are waiting for it.

Hi,

It was released late last night!

Cheers,
Jb

2 Likes

Great news. Where can we find more details about the installation and configuration?
I checked the blog but didn’t find anything there yet.

Thanks.

@franklevasseur What is the status for the config documentation?

here it is:

hope it helps!

François

2 Likes

@franklevasseur, @jbperron - I tried following the developer guide but looks like the channel-teams.json is missing in the latest (12.1.1) version. This is required in step #3 in the guide.

Could you please share an update?

Thanks.

Just create the file at the correct location! It should work.

What should be the content of the file?

1 Like

You’re right, that is not very clear…

Try something like this:

{
  "enabled": true,
  "appId": "your app id",
  "appPassword": "your app pw",
  "tenantId": "this is optionnal"
}

@franklevasseur - I created the config file and the config folder. After adding an .env file with the EXTERNAL_URL property I was able to see the messaging endpoint on the console. After all configuration was successful I tried interacting with the bot on teams but it gives the below error on console.

It seems to be some permissions issue. Can someone throw some light on it?

Thanks.

Mod[channel-teams] Error while sending payload of type “typing” [Error, Authorization has been denied for this request.]
STACK TRACE
Error: Authorization has been denied for this request.
at new RestError (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__d8d34fa7fad0cfd158f9149a6bda232fece047d66b6a793f830659b16310983f\node_production_modules@azure\ms-rest-js\dist\msRest.node.js:1397:28)
at E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__d8d34fa7fad0cfd158f9149a6bda232fece047d66b6a793f830659b16310983f\node_production_modules@azure\ms-rest-js\dist\msRest.node.js:1849:37
at tryCatcher (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\promise.js:517:31)
at Promise._settlePromise (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\promise.js:574:18)
at Promise._settlePromise0 (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\promise.js:619:10)
at Promise._settlePromises (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\promise.js:699:18)
at _drainQueueStep (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\async.js:138:12)
at _drainQueue (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\async.js:131:9)
at Async._drainQueues (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:696:18)
at tryOnImmediate (timers.js:667:5)
at processImmediate (timers.js:649:5)
at process.topLevelDomainCallback (domain.js:121:23)
Mod[channel-teams] Error while sending payload of type “message” [Error, Authorization has been denied for this request.]
STACK TRACE
Error: Authorization has been denied for this request.
at new RestError (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__d8d34fa7fad0cfd158f9149a6bda232fece047d66b6a793f830659b16310983f\node_production_modules@azure\ms-rest-js\dist\msRest.node.js:1397:28)
at E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__d8d34fa7fad0cfd158f9149a6bda232fece047d66b6a793f830659b16310983f\node_production_modules@azure\ms-rest-js\dist\msRest.node.js:1849:37
at tryCatcher (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\promise.js:517:31)
at Promise._settlePromise (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\promise.js:574:18)
at Promise._settlePromise0 (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\promise.js:619:10)
at Promise._settlePromises (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\promise.js:699:18)
at _drainQueueStep (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\async.js:138:12)
at _drainQueue (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\async.js:131:9)
at Async._drainQueues (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (E:\Sundry\Projects\ChatBots\DevOps Bot\BotPress\botpress-v12_1_1-win-x64\modules.cache\module__84856df0cd02736cd86e596044128c2f298f9993d68c9a16e5ad5c4ce97c1948\node_production_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:696:18)
at tryOnImmediate (timers.js:667:5)
at processImmediate (timers.js:649:5)
at process.topLevelDomainCallback (domain.js:121:23)

Hi,

It is really hard to tell where your problem comes from. It’s fair to say you are not authorized to access microsoft’s api, but why?

When creating your azure “App registration”, did you check the box with the following display: "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)" ?

How did you generate your password? In your registration, did you go to “Certificates & secrets” and then have you clicked on “New client secret”. This secret is your app password.

As mentioned in the documentation, this module is still experimental. One thing you can do, is follow the actual microsoft documentation and try deploying one of their sample bots. Once your are able to chat with a dummy bot, then you can pass your app id and password to Botpress.

When creating your azure “App registration”, did you check the box with the following display: "Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)" ?

I have selected “Accounts in any organizational directory (Any Azure AD directory - Multitenant)” since I didn’t want to allow personal accounts.

How did you generate your password? In your registration, did you go to “Certificates & secrets” and then have you clicked on “New client secret”. This secret is your app password

Yes, that’s how I generated the password. In fact it was giving an error until I did set the app id, secret and the tenant id correctly. After configuring this and the EXTERNAL_URL correctly, the messaging endpoint started showing up.

From the error it seems that botpress is failing when making a microsoft graph api call (?) to teams. Is that true? Is it using client credentials oauth grant type internally?

Describing the code flow in a bit more detail would help to troubleshoot this further.

I really can’t reproduce your bug. Everything is working here.

Have you tried following the official microsoft documentation ? Try deploying any dummy bot. You’ll find much more support on the microsoft api from microsoft itself than from Botpress.

If you achieved deploying an MS Teams Bot succesfully and your Botpress bot is still not working, then I suggest you run Botpress from its raw sources with nodejs by cloning the repo. You’ll be able to put a breakpoint or few console logs in the channel-teams module and debug your way out of this.

If you find a solution to your problem, please give us more details on what went wrong or even open a PR. We’ll be glad to make the fix or write a note in the documentation.

François

Thanks for the suggestion. I tried the echo bot with ngrok on botframework emulator. The bot works well otherwise but fails with the same “401 unauthorized error” when I enter the app id and password. The detailed error from ngrok looks like
" Error: Unauthorized. Invalid AppId passed on token: "
I verified that the appid and client secret are correct from the bot framework portal. I am not sure what’s going wrong.
Since I am new to this, could you throw some light? - @franklevasseur