Passing Data to the Widget

You can pass data to the widget via the chat widget config stored in your page. The config includes a metadata object which can be used to pass any data you need to pass to the widget:

For example:

window.DG_CHAT_WIDGET_CONFIG: {
  env: 'eu',
  widgetId: '22df40c4-110f-4b6f-aa2b-aeaffd6d1179',
  metadata: {
    token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RpZ2l0YWxnZW5pdXMuY29tL2FwcF9tZXRhZGF0YSI6eyJvcmciOiJhdXRoMHw1OGM3ZDY1ZjNkNzc4ZjZlMzAwMTQ2MzciLCJwZXJtaXNzaW9uX3NldCI6WyJ1c2V',
    currentUrl: window.location.href
  }
}