How to pass metadata from an external website into chat (new widget)

How to pass metadata from an external website into chat (new widget)

This article explains how to pass the metadata when a new request comes from a Chat widget from an external website.

By default, Chat Information has a few fields and values when the chat is initiated. Below is the screenshot for reference, which shows all the default values:

In addition to this, if we want to add custom fields or values, it’s possible by adding metadata code in the HTML. Below is the code that has to be added:

<html> <body> <script src="https://chat-api.spartez-software.com/chat-widget.js" defer></script> <chat-widget jira-id="8ad73648-24b8-3d3c-bf91-f75ff508305b" service-desk-id="1" primary-color="#2D60D8" text-color="#FFFFFF" metadata="[ { name: 'External', value: 'Yes', render: true, }, { name: 'Website', value: 'https://appfire.com', render: true, }, { name: 'User', value: 'NA', render: false, }, ]" auto-show="true"></chat-widget> <chat-widget auto-show="false"></chat-widget> </body> </html>

Here metadata should be between <chat-widget> </chat-widget> tags.

Here, the name indicates the field name, the value indicates the field value, and the render indicates whether to show the field/value. Render has only two values, true/false.

Here is an example of metadata: