- An HTML attribute. Add
data-roserx-opento an existing button or link. No JavaScript needed. - JavaScript. Call
window.RoseRx.open()from your own code.
Before you start
- Your widget is saved and its status is Active.
- The RoseRx embed script is installed on the same page as your button. See Embedding Your Widget.
Option A: Add an attribute to your button or link
Add thedata-roserx-open attribute to the element you want to open the chat.
Which elements it works on
The attribute works on any HTML element:<button>, <a>, <div>, <span>, <img> and so on.
- Clicks inside the element count. If your button contains an icon or a
<span>, clicking those opens the widget too. - Elements added later work. Buttons rendered after the page loads, for example by a single-page app, a modal, or a cookie banner, work without any extra setup.
- The element’s own click behavior is canceled. A link with the attribute does not navigate anywhere, which is why
href="#"is fine. A submit button inside a form does not submit the form.
For accessibility, use a
<button> or an <a>. A <div> or <span> responds to mouse clicks and taps, but keyboard and screen-reader users cannot reach it unless you add tabindex="0", a role, and your own keyboard handling. A disabled button does not respond to clicks, so it will not open the widget.Open straight into the Appointment Finder
If your agent uses the Appointment Finder, you can open the widget and start the Appointment Finder in one click. Set the attribute’s value toappointment-finder:
- The agent is a patient agent.
- In the agent’s Workflows settings, the Sub-agent is set to Appointment Finder.
- At least one care pathway, Telehealth or In-Person, is enabled under Care Workflows.
RoseRx: Appointment Finder is not enabled for this widget.
The Embed tab only shows the Appointment Finder example when the assigned agent meets these requirements. If you don’t see it, check the agent’s Workflows settings.
Option B: Open the widget with JavaScript
Use this when opening the chat is part of your own code, for example after a visitor completes a form or reaches a certain step on your page. The embed script adds these functions to the page:appointment-finder attribute value above.
window.RoseRx.open only exists once embed.js has loaded, so guard your call as shown above. If the widget is still starting up when you call open(), the request is held and carried out as soon as the widget is ready. If the widget cannot load at all, for example because it is inactive or the domain is not allowed, the call does nothing.Hiding the default launch button
If you want visitors to open the widget only from your own buttons and links, adddata-hide-button="true" to the RoseRx script tag:
Troubleshooting
The widget opens but the Appointment Finder doesn't start
The widget opens but the Appointment Finder doesn't start
- Check the attribute value, or the
flowoption, is exactlyappointment-finder. Any other value opens the widget normally and logsRoseRx: Unknown widget flow.in the console. - Check the agent meets the requirements in Open straight into the Appointment Finder.
The console says window.RoseRx is undefined
The console says window.RoseRx is undefined
- The embed script had not finished loading when your code ran. Guard the call with
if (window.RoseRx && window.RoseRx.open), or use thedata-roserx-openattribute instead, which needs no timing.
Next steps
Embedding Your Widget
Install the embed script and set up domain restrictions.
Workflows
Set up the Appointment Finder and care pathways for your agent.

