Legacy Dev Forum Posts

 View Only

Sign Up

How to implement a snippet of web messenger in TypeScript

  • 1.  How to implement a snippet of web messenger in TypeScript

    Posted 06-05-2025 18:36

    enotani | 2023-02-13 13:41:22 UTC | #1

    Hello,

    Our customer wants to develop a web page for a web messenger in TypeScript. However, it does not work well with snippets (JavaScript). Que: Is there a sample that implements a web page for web messenger in TypeScript? Also, would it be possible to make the snippet Typescript?

    Best Regards, Hirofumi.Enotani


    RanjithManikanteSa | 2023-02-14 06:45:14 UTC | #2

    Hi @enotani,

    The single snippet that we provide out of the box is in JavaScript. It needs to be converted to TypeScript for using in TypeScript project. Here is the converted one for you. This is referring to USE1 region. Please update this snippet with your appropriate environment/deploymentId and can start using it.

    ((g: any, e: string, n: string, es: any, ys?: HTMLScriptElement) => { g['_genesysJs'] = e;

    g[e] = g[e]

    function () {

    (g[e].q = g[e].q

    []).push(arguments)

    }; let date: any = new Date(); g[e].t = 1 * date; g[e].c = es; ys = document.createElement('script'); ys.async = true; ys.src = n; ys.charset = 'utf-8'; document.head.appendChild(ys); })(window, 'Genesys', 'https://apps.mypurecloud.com/genesys-bootstrap/genesys.min.js', { environment: 'use1', deploymentId: '<your depId>' });

    Here is a working example using this TypeScript snippet - https://jsfiddle.net/Sabana/7u6c5n0s/1/.


    enotani | 2023-02-15 15:14:53 UTC | #3

    Hello

    Sorry for the late reply. Thank you for your teachings. Our customers use the code you provide us.

    Best Regards, Hirofumi Enotani


    system | 2023-03-17 15:15:10 UTC | #4

    This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 18390