# Bloomreach

Bloomreach is a combines the power of unified customer and product data with AI optimization, helping deliver personalized customer journeys and analytics.

## Overview

Bloomreach combines the power of unified customer and product data with AI optimization, helping deliver personalized customer journeys.

## \*\*API Information \*\*

The Base URL used for the Bloomreach connector can be, for example, simply\*\* <https://api.exponea.com/>,\*\* but in many cases, this would be your own custom URL. More information can be found on their main [API documentation](https://documentation.bloomreach.com/engagement/reference/authentication) site.

## Authentication

Within the builder, click on the Bloomreach connector to display the connector properties panel. Select the **Auth** tab and click on the **New authentication** button.
In the Tray.io authentication pop-up modal name your authentication in a way that will quickly identify it within a potentially large list. For example, whether it is a Sandbox or Production auth, etc.
Consider who/ how many people will need access to this authentication when choosing where to create this authentication ('Personal' vs 'Organisational').
The next page asks you for your API key, API secret, Project token and Base URL credentials.
![Bloomreach Auth Popup](https://tray.ai/documentation/images/connectors/service/bloomreach/17y7ZhJHGZ8yVDgADkFVWr_Screenshot%202023-01-25%20at%2013.19.16.png)
To get these fields, head to the Bloomreach Engagement interface. Navigate to the settings section of your Bloomreach dashboard, found at the gear icon. Click on 'Project settings'.
![Bloomreach project settings](https://tray.ai/documentation/images/connectors/service/bloomreach/RkpdKtFkQeA3pVl6q8pF5_image.png)
You can see your Project token within the General project settings.
![Bloomreach project token](https://tray.ai/documentation/images/connectors/service/bloomreach/1FKuOC7cwax86F3ShQQkAg_Bloomreach-project-token.png)
To find your API key, API secret, and base URL, click on 'Access management' and then 'API'.
You will need to generate an API key and API secret. Once they have been generated, you won't be able to view the API secret again. However, you can generate a new one here if you need to.
You can also view your Project key on this screen.
![Bloomreach auth creds](https://tray.ai/documentation/images/connectors/service/bloomreach/7mRLpyCiwGijIw8Y56QMrQ_Bloomreach-auth-creds.png)
Once you have added these fields to your Tray.io authentication pop-up window click the **Create authentication** button. 
Your connector authentication setup should now be complete. Please run the simplest operation available to test and ensure you can retrieve data as expected.

## Available Operations

The examples below show one or two of the available connector operations in use.
Please see the [Full Operations Reference](#operationsFull) at the end of this page for details on all available operations for this connector.

## Notes on using Bloomreach

The operations in Bloomreach are designed to be very customisable so as not to limit the schema you can send to the API. Please note that due to this, there may be some required fields required in some operations that are not obvious from the workflow input panel.
Note also, that the output examples for each operation are for example only. The operation may return different or additional parameters when the operation is actually run, depending on your inputs.

## Using the Raw HTTP Request ('Universal Operation')

As of **version 1.0**, you can effectively create your own operations.
This is a powerful feature that you can use when there is an endpoint in Bloomreach that is not used by any of our operations.
To use this you will, first of all, need to research the endpoint in the [Bloomreach](https://documentation.bloomreach.com/engagement/reference/welcome) API documentation to **find the exact format** that Bloomreach will be expecting the endpoint to be passed in.
For example, say that the **'Retrieve customer attributes'** operation did not exist in our Bloomreach connector, and you wanted to use this endpoint. You would use the Bloomreach API docs to find the relevant endpoint - which in this case is a POST request called:\*\* `/data/v2/projects/&#123;projectToken&#125;/customers/attributes`.\*\*`** **`
More details about this endpoint can be found [here](https://documentation.bloomreach.com/engagement/reference/customer-attributes-2).
![Bloomreach API call RAW](https://tray.ai/documentation/images/connectors/service/bloomreach/5SNdcZZqVNJi6sjx76RxW0_image.png)
Based on the information provided in the above API call doc, you need to configure the following attributes on your Tray platform:

* **Method: POST**
* **Headers:**
  * **Key: Content-Type**
  * **Value: application/json**
* \*\*URL: \*\*
  * **Endpoint : /data/v2/projects/{projectToken}/customers/attributes**
* \*\*Body Type: \*\*
  * **raw**
  * **\&#123;"customer\_ids": {"registered": "\<the customer ID>"\&#125;}**
    ![Bloomreach Raw](https://tray.ai/documentation/images/connectors/service/bloomreach/1lxiLnZfFuBnLu67gFE4eN_image.png)
    Note that the endpoint URL requires your Bloomreach Project token. If you have created a  Bloomreach authentication, select it for this connector. This will allow you to use the base URL, and also allow you to interpolate the Project token from your authentication into the endpoint URL via jsonpaths. A shortcut for interpolation is to start typing `{$` in the input field. You can then choose the value you want from the drop-down.
    ![Bloomreach interpolate](https://tray.ai/documentation/images/connectors/service/bloomreach/cU2wYqe1599iInnGiTdUC_image.png)
    Once the API call is executed successfully,  you should get the following results:
    ![Bloomreach raw HTTP result](https://tray.ai/documentation/images/connectors/service/bloomreach/5CuWB7Ho8v1cVMixTsIO3u_image.png)

## Bloomreach Example Usage

> **Info:** **TRAY POTENTIAL:** Tray is extremely flexible. By design there is no fixed way of working with it - you can pull whatever data you need from other services and work with it using our core and helper connectors.

Below is an example of a way in which you could potentially use the Bloomfields connector 'Batch commands' operation, to update a customer's properties and add an event for a customer, at the same time.
The overall logic of the workflow is:

1. Setup using a manual trigger and Bloomreach connector
2. Set your Bloomreach connector to the 'Batch commands' operation
3. Configure the operation inputs
   Your completed workflow should look similar to this:
   ![Bloomreach workflow overview](https://tray.ai/documentation/images/connectors/service/bloomreach/57tVbVBOgtPGZW2JDLWPQe_image.png)

### Step-by-step Explanation

### Step 1 - Setup using a manual trigger and Bloomreach connector

Set up your workflow with a manual trigger. Add a Bloomreach connector step to the end of your workflow.

### Step 2 - Set your Bloomreach connector to the 'Batch commands' operation

Select the 'Batch commands' operation. This operation allows you to perform multiple commands at once. You can perform either 'Add event' or 'Update customer properties' operations using 'Batch commands'.
The Bloomreach endpoints are highly customizable, so some params may be required which are not shown on the workflow input panel. Please refer to the API documentation to ensure you have included all required or relevant fields.

### Step 3 - Configure the operation inputs

We can use this operation to perform both the 'Update customer properties' and 'Add event' operations. We can see from the API documentation that the 'name' property is required, and refers to the API command route.
![Bloomreach batch command route](https://tray.ai/documentation/images/connectors/service/bloomreach/3GVabPgXgitl8ImEBNCbxs_image.png)
To set up the 'Update customer properties' operation first set the 'Name' property to `customers`.
We can see from the API documentation that `customer_ids` and `properties` params are required for this operation.
![Bloomreach update customer properties](https://tray.ai/documentation/images/connectors/service/bloomreach/ZF5vvfPT8JzaTM42V2Gt9_image.png)
To add the `customer_ids` value, select 'Add property to Customer IDs'. You will be asked for the key value of the property. For this endpoint, the most common key value is 'registered'. Once your key has been added, you can insert the value.
![Bloomreach add customer\_ids property](https://tray.ai/documentation/images/connectors/service/bloomreach/5rvPYk3R7g7rrfu9iu8krZ_image.png)
Use the same method to add the keys and values for the `properties` parameter. Ensure that any custom keys being added are in the APIs expected format, for example snake case.
To set up the 'Add events' operations, add a second item to the 'Commands' array. Set the 'Name' property to `customers/events`.
We can see from the API documentation that the `customer_ids`, `properties`, and `event_type` parameters are required.
![Bloomreach Add event](https://tray.ai/documentation/images/connectors/service/bloomreach/5wpG3MUhH0mBe7NkuesNCq_image.png)
Set up the 'Customer IDs' and 'Properties' parameters as we did previously. To add the `event_type` parameter, select 'Add property to Data'. Enter the key of `event_type` and then enter your value. You can do the same thing to add a `timestamp` property if you wish to.
Note you can also add a 'Command ID' property to any 'Commands' items. It will allow you to easily match any errors in the response to the input item.
Your input panel should look something like this:
![Bloomreach batch commands](https://tray.ai/documentation/images/connectors/service/bloomreach/2D9u9KAZGjd7ytidyDRhCN_image.png)

> **Info:** \*\*BEST PRACTICES: \*\*Whenever you do decide to create your own workflow, be sure to check out some of our key articles such as:- [Using callable workflows](https://tray.ai/documentation/platform/automation-integration/building-workflows/composable-workflows/calling-other-workflows)
> - [Pagination](https://tray.ai/documentation/platform/automation-integration/advanced-use-cases/batching-queueing/pagination)
> - [Data transformation guide](https://tray.ai/documentation/platform/automation-integration/building-workflows/mapping-data/data-transformation-guide)
