Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Add Promise to botbuilder-adapter-webex both registerWebhookSubscription functions #2218

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

punithk
Copy link

@punithk punithk commented May 20, 2022

This is a fix for issue 2217.

The solution wraps the function with promise such that rejects are present and any thrown error can not be easily caught and handled by the user and should not affect existing bots.

Now developers can handle wrong access tokens this way without crashing during webhook subscription:

const adapter = new WebexAdapter({
     access_token: process.env.ACCESS_TOKEN, // access token from https://developer.webex.com
     public_address: process.env.PUBLIC_ADDRESS,  // public url of this app https://myapp.com/
     secret: process.env.SECRET // webhook validation secret - you can define this yourself
});

adapter.registerWebhookSubscription('/api/messages')
     .then()
     .catch(err => {    // <- this would fix the issue
            // Handle the error as per needs
     });

The changes should fix the issue and be backward compatible too.

@ghost
Copy link

ghost commented May 20, 2022

CLA assistant check
All CLA requirements met.

@Dayavats
Copy link

Promisifying should resolve the issue of application breaking on wrong token case

@Akanksha-270392
Copy link

Akanksha-270392 commented May 24, 2022

Thanks for the suggestion. Looks like it will solve the issue.

@VaniKaushik-2511
Copy link

VaniKaushik-2511 commented May 25, 2022

The above suggestion is appreciated. It look like it will be the solution to the issue.

@Maleeha456
Copy link

The solution mentioned above seems to resolve the issue.

@Sayak-Bhattacharjee
Copy link

It seems like this solution will solve the issue. Appreciated.

@Dhananjay220398
Copy link

The solution mentioned above seems to resolve the issue.Thanks for the suggestion.

@Adishjain58
Copy link

Thanks for the suggestion. Looks like it will solve the issue.

@Akash2695
Copy link

Seems like this solution will resolve the issue, Thanks for the suggestion.

@rashmi0403
Copy link

Thanks for the suggestion. Looks like it will solve the issue.

@Sakshi21197
Copy link

I think @PunithKrishnamurthy is doing right thing can we get this merged?

@Deekshashandilya
Copy link

facing similar issue while using this package. Please suggest some solution.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.