web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to get the conversation Id on Custom Website using JavaScript

(0) ShareShare
ReportReport
Posted on by 45

Hi all,

On my custom web page, I've included the Omnichannel chat widget. Through JavaScript, I want to obtain an ongoing conversation ID for any event (lcw:startChat, lcw:chatRetrieved or Icw:onClose).

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Hi VS Singh,

    Unfortunately, you can't get conversation ID on your web page.

    The official offers the API to get it. However, it can get on the Omnichannel Side.

    Reference:

    getConversationId (Omnichannel JavaScript API reference) | Microsoft Docs

    Get Omnichannel Conversation Id and Custom Context through JavaScript - Carl de Souza

  • Suggested answer
    Henry J. Profile Picture
    5,237 on at

    Resurfacing this thread to suggest 2 workarounds:

    1) In the new PVA unified authoring canvas (currently in public preview)

    For chatbots created in the new authoring canvas, you can get the conversation id directly from the system variables:

    HenryJammes_5F00_0_2D00_1669409107541.png

    Note: as of today the new unified authoring canvas isn't available for Omnichannel for Customer Service integration.

    2) In the production version of PVA, using Bot Framework Composer

    Open the PVA bot with Bot Framework Composer:

    HenryJammes_5F00_1_2D00_1669409192917.png

    Create a new dialog (e.g. GetConversationId)

    HenryJammes_5F00_2_2D00_1669409349518.png

    In the dialog, under "Dialog Interface", add a new Output.
    With a key name, e.g. "conversationId" and of type "string".

    HenryJammes_5F00_3_2D00_1669409448820.png

    In BeginDialog, add a new node of type "Set a property" (under "Manage properties"), and define it with:

    Property: dialog.result.conversationId

    Value: =turn.activity.conversation.id (even if it's not auto-suggested)

    pastedimage1677772370562v2.png

    In Bot Framework Composer, the final step is to publish the bot:

     HenryJammes_5F00_5_2D00_1669409707196.png

    Back in Power Virtual Agents, in a topic, you can select "Redirect to another topic" and select the "getConversationId" dialog.

    The conversationId variable will be available as an output:

    HenryJammes_5F00_6_2D00_1669409928357.png

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 51 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
#ManoVerse Profile Picture

#ManoVerse 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans