Note:If you are using the Embedded Modal, you must use our Frontend JavaScript SDK. For other presentation options such as the Embedded Link or Headless, the frontend JavaScript SDK is not required.
Installation
Install the package with npm as seen below:HTML
window object.
Rendering the Embedded Modal
Now that you have the SDK installed the first thing you’ll need to do in order to render the Embedded Modal is to set your JWT. As mentioned here, a JWT is required to securely authorize the user. Once you’ve made a request to the Embedded APIs to retrieve your short lived token, you can set the token in the frontend SDK using thesetToken method.
JavaScript
setToken.
Now that you’ve set the token, to render the Alloy Modal, call the install method. This method tells the frontend SDK to render the Alloy Modal for the user specific to the JWT you generated.
The install method takes various arguments, many of which are optional:
| Parameter | Type | Description |
|---|---|---|
integrationId | String | The Id of the integration you want to display. |
callback | N/A | A callback function invoked when the user has successfully installed their workflow from the Alloy Modal |
workflowSelection | boolean | This argument allows the End User to select which workflows they want to install. Defaults to False. When toggled to True, it provides the end-user with a toggle-list to choose which workflows are passed in the argument to install. |
alwaysShowAuthentication | boolean | This (optional) argument will always show the authentication step in the Alloy Modal when set to true. By default, the authentication screen is hidden if and when an Embedded Merchant has already authenticated the apps displayed on that screen. |
hide | boolean | This (optional) argument will hide the entire Alloy Modal if and when a user has has already authenticated the apps displayed needed to enable the workflow and the workflow does not require any configuration in the second step. |
title | String | This (optional) field will show a custom title in the Alloy Modal as specified. |
JavaScript
workflowIds by specifying the workflowIds parameter.
JavaScript"
Updating a Workflow
When a new workflow version is released that is newer than the currently installed version, you’ll often want to prompt users to upgrade to the latest version.Updating Workflows:You can tell when a workflow needs to be updated by comparing the payload returned from the List Integrations or List Workflows endpoints. When the
version is greater than the installedVersion value, you should prompt the user to update their workflow.update method. This method allows you to edit a workflow and accepts the same params as install. The edit method does not accept an integrationId and only works with workflowIds.
JavaScript
update method does not allow you to specify a version to update to. Instead, it defaults to whatever the most recently released version (as specified by the version key in the List Workflows endpoint).
Editing a Workflow
You may want to allow a user to edit a workflow after they have installed it. For example, let’s say our merchant installed a workflow that sends them a message in Slack every time an event happens. This workflow requires them to customize the “channel” parameter of the Slack integration (i.e. the user needs to select the channel to send messages to in Slack). Now let’s assume the user decides they want to change their selection after the fact. Theedit method allows you to present the modal again so that they can do just that.
JavaScript
integrationId and only works with workflowIds.
List all Workflows
You can list all workflows for a user by invoking thegetWorkflows method as seen below.
JavaScript
List all Integrations
You can list all integrations for a user by invoking thegetIntegrations method as seen below.
JavaScript
Deactivate a Workflow
You can deactivate a workflow byworkflowId or name using the deactivate method as seen below.
JavaScript
Activate a Workflow
Similarly, you can activate (or reactivate) a workflow by itsworkflowId or name using the deactivate method as seen below.
JavaScript

