question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Resume conversation

See original GitHub issue

Per https://github.com/Microsoft/BotFramework-WebChat/issues/353, it would be useful to resume a conversation in progress. Let’s talk about how this could happen.

First of all we’d need the conversationId of the previous conversation. @dandriscoll can we depend on this remaining valid?

Instead of calling /conversation we call /conversations/{conversationId}, which would give us a current streamUrl. I guess if this call fails we know the conversationId is no longer valid.

We could also optionally supply a watermark. If we don’t we’d get all the cached messages Direct Line might still be holding, which would sometimes be desirable.

Then business would resume as normal.

From an API perspective we’d just need to add conversationId?: string and watermark?: string to DirectLineOptions.

You might ask, how do we get the conversationId/watermark from the previous conversation? Well it’s inside the DirectLine object. So the hosting page could create a DirectLine object, e.g.

const dl = new DirectLine({
    secret: your_direct_line_secret // or token: your_direct_line_token
});

and then save dl.conversationId and dl.watermark to a cookie, or local storage, or its server, etc. Then when reconstituting it, it would do:

const dl = new DirectLine({
    secret: your_direct_line_secret, // or token: your_direct_line_token
    conversationId: from_previous_conversation,
    watermark: from_previous_converation
})

Am I missing anything?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:7
  • Comments:40 (15 by maintainers)

github_iconTop GitHub Comments

2reactions
baki32commented, Jun 27, 2018

You can get it from directline object

var **directLine** = new DirectLine({
    secret: /* put your Direct Line secret here */,
    token: /* or put your Direct Line token here (supply secret OR token, not both) */,
    domain: /* optional: if you are not using the default Direct Line endpoint, e.g. if you are using a region-specific endpoint, put its full URL here */
    webSocket: /* optional: false if you want to use polling GET to receive messages. Defaults to true (use WebSocket). */,
    pollingInterval: /* optional: set polling interval in milliseconds. Default to 1000 */,
});

You then pass it to webchat

BotChat.App({
    botConnection: **directLine**,
    user: user
    ...
}, document.getElementById("BotChatGoesHere"));

and then when connection is established

**directLine**.connectionStatus$
.subscribe(connectionStatus => {
    switch(connectionStatus) {
        case 2:{
             //conversationId
             var id = **directLine**.conversationId
        }       
});

1reaction
baki32commented, Oct 17, 2018

That code is used when initializing webchat object in HTML refer to : Advanced Web Chat chapter here https://github.com/Microsoft/BotFramework-WebChat/blob/master/README.md

Sent from my Windows 10 device


From: Kostas Setzas notifications@github.com Sent: Wednesday, October 17, 2018 5:03:20 PM To: Microsoft/BotFramework-DirectLineJS Cc: baki32; Mention Subject: Re: [Microsoft/BotFramework-DirectLineJS] Resume conversation (#9)

@baki32https://github.com/baki32 @sevetseh28https://github.com/sevetseh28 I still cannot get it. Do you put the lines above into the same script?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Microsoft/BotFramework-DirectLineJS/issues/9#issuecomment-430665177, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVyIloHj_Q5a7GEVh4WHFsr-4s65oGx5ks5ul0aegaJpZM4MPwXk.

Read more comments on GitHub >

github_iconTop Results From Across the Web

resume the conversation | English examples in context - Ludwig
High quality example sentences with “resume the conversation” in context from reliable sources - Ludwig is the linguistic search engine that helps you...
Read more >
40 Top Conversation Starters for Job & Networking Events
Using these topics and questions will pave the way for developing more meaningful relationships. Create Your Resume. Why Conversation Starters Are Important.
Read more >
Taking a Conversational Approach to Writing Your Resume
To mimic this in your resume, review a conversation like this in your mind, and then jot down ideas you might share as...
Read more >
we can resume the conversation definition - Reverso Dictionary
1 to begin again or go on with (something adjourned or interrupted) · 2 tr to occupy again, take back, or recover to...
Read more >
What are good ways to resume conversation after a gap of ...
“Hi ___! I enjoyed our chat/seeing you/reading your profile/etc. I was wondering if you'd be free to chat / hang out / go...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found