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: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 theReachProvider 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
TheViewAutomationModal component allows you to pass in a function to return extra merge fields for the automation.
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 aPOST request with the following body:
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:
templateNames and their values: