API Reference
Widget API Functions

Widget API Functions

The API functions define a set of methods useful for integrating Ralipo and various component actions on your web applications.

This document provides a comprehensive overview of the available API functions, their usage, parameters, and expected outcomes.

Visit the publish section of the documentation here to see the function you need to incorporate inorder to trigger this functions for embeded links and widgets

initialize

Description: Initializes ralipo send feedback widget with specific options.

ralipo.initialize(uid, options)

Parameters
  - uid: A unique identifier for the widget.
  - options: Object with configuration options like:
   - elementId?: string: The target ID of the HTML element where the widget should be placed.
   - customData?: any: Custom data in form of object to be associated with the user.
   - user?: any: Additional user information.
   - showLauncher?: boolean: To set visibility of the launcher on initialization. Can be true or false.

Example

ralipo.initialize("user1213", { elementId: "chat-container", customData: { role: "admin" }, showLauncher: true })
hideLauncher

Description: Hides ralipo feedback launcher globally. This function can only be called after being initialized

ralipo.hideLauncher(uid)

Parameter
  - uid?: optional A unique identifier for the widget. If omitted, hides the launcher globally.

Example

hideLauncher("user123")
showLauncher

Description: Shows the chat launcher globally.

ralipo.showLauncher(uid)

Parameters
  - uid?: optional A unique identifier for the campaign. If omitted, shows the launcher globally.

Example

ralipo.showLauncher("user456")
setCustomData

Description: Sets custom data for a specific campaign or globally.

ralipo.setCustomData(customData, uid)

Parameters
  - customData: A key-value pair object containing custom data.
  - uid: A unique identifier for the user. If omitted, sets data globally.
Example

ralipo.setCustomData({name: "Samuel", age: 32})

or

ralipo.setCustomData({preferences: { darkMode: true }}, "user789")
openWidget

Description: Opens the send Feedback widget.

ralipo.openWidget(uid)

Parameters
  - uid?: optional A unique identifier for the widget. If omitted, it opens the existing widget.
Example

ralipo.openWidget("user1011")
addNewResponseDynamically

Description: Adds new responses to the send Feedback widget dynamically.

ralipo.setNewResponseDynamically(uid)

Parameters
  - uid: A unique identifier for the widget.
  - options: An object containing the new responses:
   - response: { question: string, value: string }[] An array of response objects with question-answer pairs.
   - customData?: any: optional Custom data to be associated with the responses.

Example

ralipo.setNewResponseDynamically("user1415", { response: [{ question: "What are your hours?", value: "We're open 9am-5pm, Monday-Friday." }], customData: { category: "FAQ" } })