Legacy Dev Forum Posts

 View Only

Sign Up

Not getting updated attributes from web messaging widget

  • 1.  Not getting updated attributes from web messaging widget

    Posted 06-05-2025 18:39

    Hassan_Shah | 2025-01-13 08:36:00 UTC | #1

    Hello,

    I'm having trouble getting to reflect the updated attributes to the participant data. When a new inbound message is received along with the custom attributes, the participant data doesn't get immediately updated. Instead, it will update when the next message is received.

    Code:

      <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.usw2.pure.cloud/genesys-bootstrap/genesys.min.js', {
          environment: 'prod-usw2',
          deploymentId: '8de86cd1-9d06-4a8b-acf1-f8bccf0a474e'
        });
    
        let query
        Genesys("subscribe", "MessagingService.messagesReceived", function ({ data }) {
          if (data.messages[0].direction === "Inbound") {
            query = data.messages[0].text;
            console.log(data);
            Genesys(
              "command",
              "Database.update",
              { messaging: { customAttributes: { "query": query } } },
              function (data) {
                /* fulfilled, returns data */
                return true
              },
              function () {
                return false
                /* rejected */
              }
            );
          }
        });
      </script>

    system | 2025-02-12 08:35:40 UTC | #2

    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: 31168