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

Webex Teams startPrivateConversation error: TypeError: Cannot read property 'id' of undefined #1913

Open
darrenparkinson opened this issue Feb 10, 2020 · 16 comments
Assignees

Comments

@darrenparkinson
Copy link
Contributor

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.

@dstaudt
Copy link

dstaudt commented Mar 7, 2020

Seeing the same issue. Perhaps an approach could be to go ahead and accept a required message parameter in startPrivateConversation (as well as startConversationInRoom). The function could then go ahead and send the message, await the response, and extract the roomId/from etc. so that context creation works correctly...

@benbrown
Copy link
Contributor

@darrenparkinson what do you think of the above proposed solution, that the startPrivateConversation and related features take a first message parameter that is used to create the conversation ID?

@benbrown benbrown added this to the 4.9 milestone Mar 17, 2020
@stale
Copy link

stale bot commented May 16, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 16, 2020
@benbrown
Copy link
Contributor

not stale

@stale stale bot removed the stale label May 18, 2020
@gerice92
Copy link

Is this issue still open? i'm having exactly the same issue in botkit for webexteams.

@benbrown benbrown self-assigned this Aug 25, 2020
@benbrown benbrown removed this from the 4.9 milestone Aug 25, 2020
@stale
Copy link

stale bot commented Oct 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 25, 2020
@dstaudt
Copy link

dstaudt commented Oct 30, 2020

Issue still exists and developers are still running into it...humbly bumped.

@stale stale bot removed the stale label Oct 30, 2020
@benbrown
Copy link
Contributor

hey @dstaudt thanks for the bump.

I think we should go ahead and implement your suggested fix - require a message to begin the conversation.

I can do this for the next release.

@benbrown benbrown added this to the 4.11 milestone Oct 30, 2020
@dstaudt
Copy link

dstaudt commented Oct 30, 2020

Sounds good, happy to help with testing/validation if useful.

@stale
Copy link

stale bot commented Jan 10, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 10, 2021
@dstaudt
Copy link

dstaudt commented Jan 11, 2021

Bump to keep-alive, in hopes of a fix in 4.11

@stale stale bot removed the stale label Jan 11, 2021
@stale
Copy link

stale bot commented Jun 11, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 11, 2021
@dstaudt
Copy link

dstaudt commented Jun 14, 2021

Still present, bump in hopes of a fix

@stale stale bot removed the stale label Jun 14, 2021
@seansbox
Copy link

Can anyone share a workaround for the time being?

@jcalve
Copy link

jcalve commented Dec 15, 2021

@seansbox this workaround works for me, replace toPersonEmail with roomId for room messages.

let bot = await controller.spawn();
let message = "The message";
let user_email = "example@mail.com";

bot.api.messages
   .create({  // This already sends the message
       toPersonEmail: user_email,
       markdown: message,
   })
   .then((message) => maybe_do_something_after(message))

@benbrown benbrown removed this from the 4.11 milestone Mar 25, 2022
@derchrisuk
Copy link

What is the current status on this?

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

No branches or pull requests

7 participants