Skip to main content
You can also use our Reach React Library to embed Reach into your application.
You can see an example Github repository for a React application that uses this library here.
We currently only support React 18.

Install the library

Initialize the library

Start by importing our css styles at the top of your application:
Now to integrate Reach components into your application, wrap them with the ReachProvider component. The provider requires a config object that initializes the Reach SDK with authentication and tenant configuration.
Please see Authentication for more information on how to generate an auth token.
If your app enforces security headers like Content Security Policy (CSP) or Cross-Origin Opener Policy (COOP), see Security Headers (CSP & COOP) for required configurations.
Please see Customization for more information on how to customize the components.

Customization

We support the following customization options:

Components Available

SegmentBuilderDialog

We expose a dialog component that can be used to create and edit segments.

CreateAutomationDialog

This is the initial modal that can be used to create a new automation.

ViewAutomationModal

This is the component used to view and edit automations. This components allows users to preview communications, edit automation details and view statistics on sent communications.

SMSOnboarding

This is the component used to onboard a business to SMS. As long as you wrap the component with the ReachProvider component, it will automatically update based on the state of the business’s SMS registration application.
If you would like to request any additional components, please reach out to us at support@embedreach.com.

Extra Merge Fields

The ViewAutomationModal component allows you to pass in a function to return extra merge fields for the automation.
The expected return type is an array of ReachMergeField objects. Each merge field can be either a static or dynamic type. Each merge field must have a unique id that will be used when updating merge field contents. The type field determines whether it’s a static or dynamic merge field.
You cannot have two identical template names for any merge fields.
When a merge field includes an image configuration, the image will be automatically added as an attachment to the message. The merge field still provides its text value for use in the message content, while the image serves as a supplementary attachment (e.g., a QR code for a coupon, a product image, etc.).

Dynamic Merge Field

URL Requirements

The URL will be called with a POST request with the following body:
And a the following headers:
Where the your-auth-token is a signed JWT token using the shared secret for the platform. The userIds are mapped to the externalId Partner Resource. The response should be a JSON object with the following format:
This means for example if you have a dynamic merge field, you can pass up to 20 merge fields in a single request.
The URL will be called with the following body:
And the expected response would be where the key is the userId and it returns a dictionary of all the templateNames and their values: