watson-developer-cloud / botkit-middleware

A middleware to connect Watson Conversation Service to different chat channels using Botkit
https://www.npmjs.com/package/botkit-middleware-watson
Apache License 2.0
206 stars 254 forks source link

Feature request: dynamic workspace_id parameter #120

Closed Naktibalda closed 6 years ago

Naktibalda commented 6 years ago

I am building a demo project where I need to allow selection of workspace before starting dialog.

Currently watson middleware takes workspace_id as a constructor parameter, but I need to set it on per-session basis. message method of ConversationV1 in node-sdk accepts workspace_id as a parameter, so it shouldn't be a problem.

I see 2 ways to implement it: 1) add workspace_id property to each message and copy it to payload.
2) check if context.workpace_id exists and assign it to payload (setting workspace_id is out of scope for this library, but I can provide an example).

I think that using context property fits my use case better but per-message workspace_id could be useful too.

@germanattanasio Which way do you prefer? I could even implement both if you think that it is a good idea.