botkit: Webex Teams startPrivateConversation error: TypeError: Cannot read property 'id' of undefined
What are you trying to achieve or the steps to reproduce?
In Webex Teams, after a group chat message, I am trying to initiate a private conversation with the user that initiated the chat using await bot.startPrivateConversation(message.user)
What was the result you received?
On doing this, I receive the following error:
TypeError: Cannot read property 'id' of undefined
It is this line in conversationState.js that is throwing the error:
const conversationId: string = Object.keys(activity.conversation).sort().map((key) => activity.conversation[key]).filter((val) => val !== '' && val !== null && typeof val !== 'undefined').join('-') + '-' + activity.from.id;
This seems to be because activity.conversation essentially just contains { id: 'temporary-value' } and this.changeContext is returning an empty object.
And in botworker.js, the BotWorker.changeContext function never gets past this line:
const dialogContext = yield this._controller.dialogSet.createContext(turnContext);
What did you expect?
I expected a direct conversation with the user.
Context:
- Botkit version: 4.6.2
- Messaging Platform: Webex Teams
- Node version: v10.16.0
- Os: macOS Catalina 10.15.2
- Any other relevant information:
It seems this may be a known issue because the documentation for startPrivateConversation says:
Change the context of the next message Due to a quirk in the Webex API, we can’t know the address of the DM until after sending the first message. As a result, the internal tracking for this conversation can’t be persisted properly. USE WITH CAUTION while we try to sort this out.
This seems to imply that it should work at some level?
Thanks.
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 2
- Comments: 16 (3 by maintainers)
@darrenparkinson what do you think of the above proposed solution, that the startPrivateConversation and related features take a
first messageparameter that is used to create the conversation ID?