Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics 365 | Integration, Dataverse...
Answered

How to get the conversation Id on Custom Website using JavaScript

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).

  • Suggested answer
    Henry J. Profile Picture
    Henry J. 5,237 on at
    RE: How to get the conversation Id on Custom Website using JavaScript

    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

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: How to get the conversation Id on Custom Website using JavaScript

    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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans