Script tag attributes
Add to the <script> element that loads the widget.
| Attribute | Description |
|---|---|
| data-raia-launcher-script | Required marker — identifies the launcher script tag. |
| data-agent-id | Agent ID for the Raia chat skill to load. |
| data-inline | Set to 'true' to embed the widget inline instead of as a floating launcher. |
| data-console-enabled | Render the in-page dev console for tweaking the widget live. |
| data-auto-open-disabled | Disable any auto-open behavior configured on the agent. |
window.raiaChat.sendCommand
Call window.raiaChat.sendCommand(type, payload) after the widget is ready. Returns a Promise that resolves when the iframe acknowledges the command.
init (API key)INIT
window.raiaChat.sendCommand("INIT", {
"apiKey": ""
});openChatOPEN_CHAT
window.raiaChat.sendCommand("OPEN_CHAT", {
"page": "chat"
});closeChatCLOSE_CHAT
window.raiaChat.sendCommand("CLOSE_CHAT");sendMessageSEND_MESSAGE
window.raiaChat.sendCommand("SEND_MESSAGE", {
"message": "Hello from the SDK"
});setUserSET_USER
window.raiaChat.sendCommand("SET_USER", {
"user": {
"fkId": "",
"firstName": "",
"lastName": "",
"email": "",
"phoneNumber": "",
"customData": {}
}
});clearUserCLEAR_USER
window.raiaChat.sendCommand("CLEAR_USER");resetUserRESET_USER
window.raiaChat.sendCommand("RESET_USER");setContextSET_CONTEXT
window.raiaChat.sendCommand("SET_CONTEXT", {
"context": ""
});clearContextCLEAR_CONTEXT
window.raiaChat.sendCommand("CLEAR_CONTEXT");setConversationContextSET_CONVERSATION_CONTEXT
window.raiaChat.sendCommand("SET_CONVERSATION_CONTEXT", {
"context": ""
});deleteChatDELETE_CHAT
window.raiaChat.sendCommand("DELETE_CHAT");resetConversationRESET_CONVERSATION
window.raiaChat.sendCommand("RESET_CONVERSATION");enableCurrentPageTextENABLE_CURRENT_PAGE_TEXT
window.raiaChat.sendCommand("ENABLE_CURRENT_PAGE_TEXT");disableCurrentPageTextDISABLE_CURRENT_PAGE_TEXT
window.raiaChat.sendCommand("DISABLE_CURRENT_PAGE_TEXT");setWelcomeMessageSET_WELCOME_MESSAGE
window.raiaChat.sendCommand("SET_WELCOME_MESSAGE", {
"message": "Welcome back 👋"
});clearWelcomeMessageCLEAR_WELCOME_MESSAGE
window.raiaChat.sendCommand("CLEAR_WELCOME_MESSAGE");patchSkillConfigPATCH_SKILL_CONFIG
window.raiaChat.sendCommand("PATCH_SKILL_CONFIG", {
"suggestions": [
"What can you do?"
]
});setTextAreaAutofocusSET_TEXT_AREA_AUTOFOCUS
window.raiaChat.sendCommand("SET_TEXT_AREA_AUTOFOCUS", {
"enabled": true
});updateThemeUPDATE_RAIA_CHAT_THEME
window.raiaChat.sendCommand("UPDATE_RAIA_CHAT_THEME", {
"themeMode": "auto",
"lightTheme": {},
"darkTheme": {}
});destroyDESTROY
window.raiaChat.sendCommand("DESTROY");