botkit
botkit copied to clipboard
Add Promise to botbuilder-adapter-webex both registerWebhookSubscription functions
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.
Promisifying should resolve the issue of application breaking on wrong token case
Thanks for the suggestion. Looks like it will solve the issue.
The above suggestion is appreciated. It look like it will be the solution to the issue.
The solution mentioned above seems to resolve the issue.
It seems like this solution will solve the issue. Appreciated.
The solution mentioned above seems to resolve the issue.Thanks for the suggestion.
Thanks for the suggestion. Looks like it will solve the issue.
Seems like this solution will resolve the issue, Thanks for the suggestion.
Thanks for the suggestion. Looks like it will solve the issue.
I think @punithkrishnamurthy is doing right thing can we get this merged?
facing similar issue while using this package. Please suggest some solution.