...
Code Block | ||
---|---|---|
| ||
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 | YesNo | 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”.
|
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.
...