简体   繁体   中英

How to integrate MS Bot with Webex teams using botbulilder webex adapter using node js

I am trying to integrate MS Bot developed in node js with webex teams using botbuilder webex adapter as follows

//creating webex adapter for bot channel
const adapter = new WebexAdapter({
access_token: process.env.ACCESS_TOKEN,
public_address: process.env.PUBLIC_ADDRESS,
secret: process.env.SECRET });

when try to run I am getting this warning message Need some solution for this.

You are getting this error because the signature in the headings is not matching your secret hash. Here is the relevant part of the code which is throwing this error.

if (this.options.secret) {
   const signature = req.headers['x-spark-signature'];
   const hash = crypto.createHmac('sha1', this.options.secret).update(JSON.stringify(payload)).digest('hex');
   if (signature !== hash) {
      console.warn('WARNING: Webhook received message with invalid signature. Potential malicious behavior!');
      return false;
   }
}

You need to check that you have the correct signature in the request header and that you have set the correct secret in you bot options.

Reference on Github: https://github.com/howdyai/botkit/blob/master/packages/botbuilder-adapter-webex/src/webex_adapter.ts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM