Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  Web Messaging on web view

    Posted 07-23-2025 03:57

    Hello

    I am working on a react native application and I want to use the web messaging on web view.

    This html page was added to local asset: 

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Genesys Chat</title>
    <script type="text/javascript" charset="utf-8">
    (function (g, e, n, es, ys) {
    g['_genesysJs'] = e;
    g[e] = g[e] || function () {
    (g[e].q = g[e].q || []).push(arguments)
    };
    g[e].t = 1 * new Date();
    g[e].c = es;
    ys = document.createElement('script'); ys.async = 1; ys.src = n; ys.charset = 'utf-8'; document.head.appendChild(ys);
    })(window, 'Genesys', 'https://apps.euw2.pure.cloud/genesys-bootstrap/genesys.min.js', {
    environment: 'prod-euw2',
    deploymentId: 'deploymentId'
    });
    </script>
    </head>
    <body>
    </body>
    </html>

    And loaded into a web view:

    <WebView
     source={require(`@assets/genesys-chat.html`)}
    style={{ flex: 1 }}
    originWhitelist={['*']}
    />

    It works on android dev builds but production builds are failing with this error:

    ReactNativeJS: 'Encountered an error loading page', { target: 454,
    ReactNativeJS:   url: 'http://assets_genesyschat/',
    ReactNativeJS:   description: 'net::ERR_CLEARTEXT_NOT_PERMITTED',
    ReactNativeJS:   canGoBack: false,
    ReactNativeJS:   title: 'assets_genesyschat',
    ReactNativeJS:   loading: false,
    ReactNativeJS:   canGoForward: false,
    ReactNativeJS:   code: -1 }

    It seems that genesys is loading an asset using http and it is not allowed.

    Could you please advise me how to fix this issue


    #WebMessaging

    ------------------------------
    Felipe Tavares
    ------------------------------