Retool
This guide describes how to embed Regal into your existing Retool applications and reference key contact data to power downstream Retool queries.
Add Custom Component to Retool app
- Navigate to you and existing or new Retool web app
- Add the custom component building block to your app

-
Click on the custom component to reveal the inspector
-
Add the below pieces of code to the "Model" & "iFrame" sections on the component
- Model:
{"contactPhone": "", "agentEmail":"", "externalId":"","profileId":""}
- iFrame:
<iframe src="https://app.regal.io/agent" allow="fullscreen;microphone" sandbox="allow-scripts allow-downloads allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-same-origin" width="740px" height="580px"> //this can be resized </iframe> <script> function updateModel(dataObject) { for (const key in dataObject) { if (dataObject.hasOwnProperty(key)) { window.Retool.modelUpdate({ [key]: dataObject[key] }); } } } window.addEventListener('message', (event) => { if (event.data && event.data.action === 'task-active') { console.log('Event received from regal', event.data); let eventKeys = ['contactPhone', 'agentEmail', 'externalId', 'profileId']; let updateData = {}; eventKeys.forEach((key) => { if (event.data[key]) { updateData[key] = event.data[key]; } }); updateModel(updateData); } }, false); </script>
-
Enable all the check boxes under "Interactions"
-
Now you can preview and interact with Regal within Retool


Using Regal contact data within your Retool web app
- Now that you've success embedded Regal into Retool, you can now reference Regal data across your web app to dynamically power queries and other components
- Regal will pass the below data we defined in the Model of the custom component for any active task. An active task is any task that is highlighted on the agent desktop.
- To reference the Model data use the below syntax, note you will replace the "customComponentName" with the name of the custom component that houses Regal.
- Contact Phone:
{{ customComponentName.model.contactPhone}}
- Agent Email:
{{ customComponentName.model.agentEmail}}
- External Id:
{{ customComponentName.model.externalId}}
- Regal Profile Id:
{{ customComponentName.model.profileId}}
- Contact Phone:

Updated about 1 year ago