Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
window.sendGreenbackMessage({trigger: 'default'}) // It will open the chat modal without sending message
window.sendGreenbackMessage({message: 'Show me green dresses', trigger: 'pdp'})
window.sendGreenbackMessage({message: 'Show me green dresses', trigger: 'default'})
window.sendGreenbackMessage({message: 'Show me green dresses', trigger: 'pdp', source: 'size button'})

...

Name

Required

Data Type

Example

Explain

message

No

string

Show me some blue dresses

The message field is a text that will be sent to the AI.

trigger

Yes

pdp | default

default

Trigger indicates where we are passing the data. There are two options “pdp” and “default”.

  1. pdp: data passing to pdp and message will show up in pdp.

  2. default: data passing to chatbot

    1. Show the message in the chatbot.

    2. When the message field is empty and the chatbot is closed. It will open the chatbot without sending a message except the greeting message.

    3. open the chatbot if it is not already opened.

source

No

string

Size Button

The source field is an optional field to indicate what has triggered this action.

E.g. source: “size button” meaning the size button triggered this action

Info

Note: when the trigger is default and the message is empty, it will open the chat modal if it is not already open, and it will not send message

Implementation

The Greenback widget exposes an API to allow customers to use it on the page. To use the API, customers need to pass in the correct data structure with the required fields.

...