-
Notifications
You must be signed in to change notification settings - Fork 73
botbuilder-adapter-web (and botkit 4+) migration-related question #63
Description
I am in the process of migrating my bot app code (originally based on botkit-starter-web) onto botkit 4+ and botbuilder-adapter-web (+ watson_middleware 2+) and have a question after carefully reading the source for both the Botkit and WebAdapter classes. Specifically, I wonder how to properly use a custom Express instance (in a manner similar to how it was used in the botkit-starter-web code) and have it interact nicely with the new Web adapter. I see that there are parameters for passing in an Express instance in the botkit constructor, and also for passing its associated middlewares. However, I also see that botkit's 'http' property needs to be set before the adapter gets automatically initialized via a call to its 'init' method from within the botkit's constructor. Therefore my question: how to get the bot's 'http' property in place in a timely fashion to allow the creation of the websocket server, etc. that happens within the -automatic- call to the adapter's init method ? Or, alternatively, should I not worry about setting the botkit.http property if I'm using a custom Express instance? But if so, how do I get the adapter and this instance to properly interact and process correctly botkit's messages? I hope I"m making some sense with my questions.
Also in relation to the use of a custom Express instance, there's a sentence in the documentation which tells me there may be some hidden downsides of doing this which I wish the documentation explained more clearly: 'Note: only use your own Express if you absolutely must for some reason. Otherwise, use controller.webserver'. (this line is in https://botkit.ai/docs/v4/reference/core.html#BotkitConfiguration)
Thanks in advance for any help with these issues.