Skip to content

Commit 7537c86

Browse files
Alec GuessousAlec Guessous
authored andcommitted
finalize documentation
1 parent 6a67129 commit 7537c86

File tree

5 files changed

+209
-0
lines changed

5 files changed

+209
-0
lines changed
324 KB
Loading
187 KB
Loading
62.3 KB
Loading
333 KB
Loading
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
---
2+
title: Batch Destination
3+
id: 596d11f870a3e552b957e6d9
4+
---
5+
6+
{% include content/plan-grid.md name="actions" %}
7+
8+
[Batch](https://batch.com/?utm_source=segmentio&utm_medium=docs&utm_campaign=partners){:target="_blank"} is a customer engagement platform for personalized, timely notifications and messages that boost retention and drive growth.
9+
10+
This destination is maintained by Batch. For any issues, [contact Batch Support](mailto:[email protected]).
11+
12+
## Getting started
13+
14+
1. From your workspace’s [Destinations catalog](https://app.segment.com/goto-my-workspace/destinations/catalog){:target="_blank"}, search for **Batch**.
15+
2. Select **Batch (Actions)** and click **Add Destination**.
16+
3. Choose the **Source** you want to connect to **Batch (Actions)**.
17+
4. In the [Batch dashboard](https://dashboard.batch.com/){:target="_blank"}, copy your **Project Key** and **REST API Key**.
18+
5. Paste the **Project Key** and **REST API Key** into the Batch destination settings in Segment.
19+
6. Toggle **Enable Destination**. Segment will start sending data to Batch according to your **Mappings**.
20+
![Basic settings destination](./images/basic_settings_destination.png "Basic settings destination")
21+
22+
{% include components/actions-fields.html %}
23+
24+
---
25+
26+
## Profile attributes mapping
27+
28+
If you’re new to Identify, read the Segment spec: <https://segment.com/docs/connections/spec/identify/>
29+
30+
When you call **Identify**, Segment maps `userId` to **`identifiers.custom_id`** and writes traits into **`attributes`**.
31+
32+
33+
### Example Identify (Segment input)
34+
35+
```js
36+
analytics.identify("97980cfea0067", {
37+
name: "Peter Gibbons",
38+
39+
phone: "+33600000000",
40+
email_marketing: "subscribed",
41+
sms_marketing: "unsubscribed",
42+
plan: "premium",
43+
logins: 5
44+
}, {
45+
context: {
46+
timezone: "Europe/Paris",
47+
locale: "fr-FR"
48+
}
49+
});
50+
```
51+
52+
### Auto-mapped fields (native)
53+
54+
| Segment field | Batch field |
55+
|----------------------------------------|---------------------------------|
56+
| `userId` | `identifiers.custom_id` |
57+
| `traits.email` | `attributes.$email_address` |
58+
| `traits.phone` | `attributes.$phone_number` |
59+
| `traits.email_marketing` | `attributes.$email_marketing` |
60+
| `traits.sms_marketing` | `attributes.$sms_marketing` |
61+
| `context.timezone` | `attributes.$timezone` |
62+
| `context.locale` → language (e.g. `fr`)| `attributes.$language` |
63+
| `context.locale` → region (e.g. `FR`) | `attributes.$region` |
64+
65+
**Notes**
66+
- `$email_marketing` / `$sms_marketing`: use `subscribed` / `unsubscribed`.
67+
- A locale like `fr-FR` is split into **language** (`fr`) and **region** (`FR`).
68+
- All other non‑reserved fields become **custom attributes** under `attributes` (strings, numbers, booleans, arrays of strings). Avoid arbitrary nested objects.
69+
70+
*For more details on the fields to be included, please refer to the Batch documentation → [API Profile](https://doc.batch.com/developer/api/cep/profiles/update){:target="_blank"}.*
71+
72+
73+
### Resulting Batch profile payload (output)
74+
75+
```json
76+
{
77+
"identifiers": {
78+
"custom_id": "97980cfea0067"
79+
},
80+
"attributes": {
81+
"$email_address": "[email protected]",
82+
"$phone_number": "+33600000000",
83+
"$email_marketing": "subscribed",
84+
"$sms_marketing": "unsubscribed",
85+
"$language": "fr",
86+
"$region": "FR",
87+
"$timezone": "Europe/Paris",
88+
89+
"name": "Peter Gibbons",
90+
"plan": "premium",
91+
"logins": 5
92+
}
93+
}
94+
```
95+
96+
### Add custom mappings
97+
98+
To map additional traits into Batch profile attributes:
99+
100+
1. Open your destination → **Mappings****Edit Mapping**.
101+
2. Go to **Profile attributes****Add Mapping Field**.
102+
3. Choose a **source** (for example `traits.plan`) and set a **target** under `attributes` (for example `attributes.plan`).
103+
![Attributes mapping](./images/attributes_mapping.png "Attributes mapping")
104+
4. In **Step 4 – Send test record**, you can test your mapping before saving.
105+
![Test record](./images/test_record.png "Test record")
106+
5. **Save** and enable the mapping.
107+
108+
> Supported types: strings, numbers, booleans, arrays of strings. Avoid arbitrary nested objects.
109+
110+
---
111+
112+
## Historical backfill request
113+
114+
If you want to integrate your entire Segment userbase into Batch using the **Identify** method, you can request a historical backfill from Segment.
115+
116+
To do this:
117+
118+
1. **Contact Segment Support**[[email protected]](mailto:[email protected])
119+
2. **Request a historical replay** of your data
120+
3. Provide Segment with the following details:
121+
- **Start date and time**
122+
- **End date and time** (usually “now”)
123+
- **Source**: the Segment source you want to replay
124+
- **Destination**: **Batch (Actions)**
125+
- **Events**: `Identify`
126+
127+
Segment will then replay your historical data so Batch can import your full userbase.
128+
129+
---
130+
131+
## Profile events mapping
132+
133+
When you call **Track**, Segment uses your `userId` as Batch’s **`identifiers.custom_id`**. A **userId is required** to attribute the event to a profile.
134+
135+
Track spec: <https://segment.com/docs/connections/spec/track/>
136+
137+
### Example Track (Segment input)
138+
139+
```js
140+
analytics.track("User Registered", {
141+
plan: "Pro Annual",
142+
accountType: "Facebook"
143+
}, {
144+
userId: "97980cfea0067"
145+
});
146+
```
147+
148+
### How Segment maps to Batch
149+
150+
| Segment | Batch |
151+
|-------------------|-------------------------|
152+
| `userId` | `identifiers.custom_id` |
153+
| `event` | `event.name` |
154+
| `properties.*` | `event.attributes.*` |
155+
156+
### Resulting Batch event payload (output)
157+
158+
```json
159+
{
160+
"identifiers": {
161+
"custom_id": "97980cfea0067"
162+
},
163+
"event": {
164+
"name": "User Registered",
165+
"attributes": {
166+
"plan": "Pro Annual",
167+
"accountType": "Facebook"
168+
}
169+
}
170+
}
171+
```
172+
173+
Events are sent to Batch in near real time according to your destination mappings, and all event `properties` are included under `event.attributes`.
174+
![Events mapping](./images/events_mapping.png "Events mapping")
175+
176+
---
177+
178+
## Validation checklist
179+
180+
- Always send a stable `userId` → becomes `identifiers.custom_id`.
181+
- Native profile fields in `attributes`: `$email_address`, `$email_marketing`, `$phone_number`, `$sms_marketing`, `$language`, `$region`, `$timezone`.
182+
- Everything else → **custom attributes** under `attributes`.
183+
- Dates: use **ISO‑8601 UTC** (e.g., `1989-07-20T00:00:00Z`).
184+
- Configure additional mappings in **Mappings → Edit Mapping**.
185+
- Test with a read-back/export to verify types, encodings, and timezones.
186+
187+
---
188+
189+
## Integrating a computed trait
190+
191+
If you’re new to *Computed traits*, read the Segment spec: <https://segment.com/docs/unify/Traits/computed-traits/>
192+
193+
To integrate a computed trait with Batch:
194+
195+
1. Go to your **Segment workspace**.
196+
2. Open the **Engage** tab → **Destinations**.
197+
- If your Batch destination is already listed, skip this step.
198+
- Otherwise, click **Add destination** and select **Batch (Actions)**.
199+
3. Open the **Engage** tab → **Audiences****Computed traits**.
200+
4. Click **Create computed trait**.
201+
5. Configure your **calculation method** (e.g., count, aggregation, last value).
202+
6. Click **Preview**, then **Next**.
203+
7. Select your **Batch destination**.
204+
8. Choose how to send the data:
205+
- For an attribute → enable **Send Identify** in the connection settings.
206+
- For an event → enable **Send Track**.
207+
9. Give your computed trait a **clear name**.
208+
209+
Segment will then automatically update and forward your computed trait data to Batch.

0 commit comments

Comments
 (0)