rt-journey-create
RT Journey Creation
Create event-triggered journeys that activate in real-time when specific events occur.
Note: This is for RT Journeys (event-triggered, API-only). For Batch Journeys (stage-based, YAML workflow), use the journey skill.
Journey Types
| Type | Entry | Workflow | This Skill? |
|---|---|---|---|
| RT Journeys | Event occurs | API | ✅ Yes |
| Batch Journeys | Segment membership | YAML + tdx journey |
❌ No |
Prerequisites
- RT configuration complete (RT status = "ok")
- Key events configured
- Webhook/activation endpoint ready (optional)
Quick Start
# Check RT status
tdx ps view <parent_segment_id> --json | jq '.realtime_config.status'
# List key events
tdx api "/audiences/<parent_segment_id>/realtime_key_events" --type cdp
# Create RT journey
tdx api "/entities/realtime_journeys" --type cdp --method POST --data '{
"name": "welcome_email",
"parent_segment_id": 394649,
"event_name": "registration",
"activations": [...]
}'
RT Journey Structure
{
"name": "abandoned_cart_recovery",
"parent_segment_id": 394649,
"event_name": "cart_abandon",
"description": "Send webhook when cart is abandoned",
"activations": [
{
"type": "webhook",
"name": "cart_recovery_webhook",
"endpoint": "https://marketing-platform.com/webhooks/cart",
"method": "POST",
"payload_template": {
"user_id": "{{user_id}}",
"cart_value": "{{cart_value}}",
"cart_items": "{{cart_items}}"
}
}
],
"filters": {
"cart_value": {
"operator": "greater_than",
"value": 50
}
}
}
Event Triggers
RT journeys trigger when key events occur:
# List available key events
tdx api "/audiences/<parent_segment_id>/realtime_key_events" --type cdp
# Create key event
tdx api "/audiences/<parent_segment_id>/realtime_key_events" --type cdp --method POST --data '{
"name": "high_value_purchase",
"event_name": "purchase",
"description": "Purchase over $100",
"filters": {
"purchase_amount": {
"operator": "greater_than",
"value": 100
}
}
}'
Event Filters
Filter which events trigger the journey:
{
"filters": {
// Numeric filters
"purchase_amount": {
"operator": "greater_than",
"value": 100
},
// String filters
"product_category": {
"operator": "equals",
"value": "electronics"
},
// Multiple conditions (AND)
"cart_value": {
"operator": "greater_than",
"value": 50
},
"purchase_count_7d": {
"operator": "equals",
"value": 0
}
}
}
Journey Examples
Welcome Journey
{
"name": "welcome_new_users",
"parent_segment_id": 394649,
"event_name": "registration",
"description": "Welcome email for new users",
"activations": [
{
"type": "webhook",
"endpoint": "https://email-service.com/api/send",
"payload_template": {
"template": "welcome",
"to": "{{email}}",
"user_name": "{{first_name}}",
"user_id": "{{user_id}}"
}
}
]
}
Abandoned Cart
{
"name": "cart_recovery",
"parent_segment_id": 394649,
"event_name": "cart_abandon",
"filters": {
"cart_value": {
"operator": "greater_than",
"value": 50
}
},
"activations": [
{
"type": "email",
"template_id": "cart_recovery",
"to": "{{email}}",
"dynamic_data": {
"cart_items": "{{cart_items}}",
"cart_value": "{{cart_value}}",
"recovery_link": "https://shop.com/cart/{{cart_id}}"
}
}
]
}
High-Value Purchase
{
"name": "vip_thank_you",
"parent_segment_id": 394649,
"event_name": "purchase",
"filters": {
"purchase_amount": {
"operator": "greater_than",
"value": 500
}
},
"activations": [
{
"type": "salesforce",
"object": "Contact",
"operation": "update",
"field_mapping": {
"Email": "{{email}}",
"VIP_Status__c": "true",
"Last_Purchase_Amount__c": "{{purchase_amount}}",
"Last_Purchase_Date__c": "{{event_time}}"
},
"match_field": "Email"
}
]
}
Product Recommendation
{
"name": "product_view_recommendation",
"parent_segment_id": 394649,
"event_name": "product_view",
"activations": [
{
"type": "webhook",
"endpoint": "https://recommendation-engine.com/api/trigger",
"payload_template": {
"user_id": "{{user_id}}",
"viewed_product": "{{product_id}}",
"viewed_category": "{{category}}",
"recent_products": "{{viewed_products_30d}}",
"favorite_category": "{{favorite_category}}"
}
}
]
}
Trial Conversion
{
"name": "trial_to_paid",
"parent_segment_id": 394649,
"event_name": "subscription_start",
"filters": {
"plan_type": {
"operator": "equals",
"value": "paid"
}
},
"activations": [
{
"type": "webhook",
"endpoint": "https://crm.com/api/events",
"payload_template": {
"event": "trial_conversion",
"user_id": "{{user_id}}",
"email": "{{email}}",
"plan": "{{plan_name}}",
"mrr": "{{monthly_revenue}}"
}
}
]
}
Manage RT Journeys
# List RT journeys
tdx api "/entities/realtime_journeys?parent_segment_id=<parent_segment_id>" --type cdp
# Get journey details
tdx api "/entities/realtime_journeys/<journey_id>" --type cdp
# Update journey
tdx api "/entities/realtime_journeys/<journey_id>" --type cdp --method PATCH --data '{
"name": "updated_journey_name",
"description": "Updated description"
}'
# Delete journey
tdx api "/entities/realtime_journeys/<journey_id>" --type cdp --method DELETE
# Enable journey
tdx api "/entities/realtime_journeys/<journey_id>/enable" --type cdp --method POST
# Disable journey
tdx api "/entities/realtime_journeys/<journey_id>/disable" --type cdp --method POST
Payload Variables
Use variables from RT attributes and event data:
{
"payload_template": {
// User identifiers
"user_id": "{{user_id}}",
"email": "{{email}}",
"td_client_id": "{{td_client_id}}",
// Event data
"event_name": "{{event_name}}",
"event_time": "{{event_time}}",
"event_properties": "{{event_properties}}",
// RT attributes
"last_product_viewed": "{{last_product_viewed}}",
"viewed_products_30d": "{{viewed_products_30d}}",
"purchase_count_7d": "{{purchase_count_7d}}",
// Batch attributes
"customer_tier": "{{customer_tier}}",
"total_lifetime_value": "{{total_lifetime_value}}"
}
}
Testing
# Test webhook endpoint
curl -X POST "https://your-webhook.com/test" \
-H "Content-Type: application/json" \
-d '{
"user_id": "test_123",
"event": "test_event"
}'
# Create journey in test mode
# Use test event name or add "test_" prefix
Performance
- Latency: Typical activation is 30s-3min
- Rate Limits: Max 100 activations/sec per journey
- Retry Policy: 3 retries with exponential backoff
- Timeout: Default webhook timeout is 5000ms
Common Errors
| Error | Solution |
|---|---|
| "RT not configured" | Complete RT configuration first |
| "Key event not found" | Create key event via RT config |
| "Invalid event_name" | Verify event name matches key event |
| "Parent segment not found" | Verify parent segment ID |
| "Activation configuration invalid" | Check activation structure |
Best Practices
Journey Design
- Single purpose: One trigger per journey
- Clear naming: Descriptive journey names
- Test first: Test with non-production webhooks
- Start simple: Add complexity incrementally
Event Selection
- Business events: Use meaningful business events
- Specific filters: Add filters to reduce noise
- Volume consideration: Avoid high-volume events without filters
Activation Config
- Error handling: Plan for activation failures
- Retry logic: Rely on built-in retries
- Timeout: Set appropriate timeout values
Next Steps
After creating journeys:
- Configure Activations: Set up webhooks/integrations → Use
rt-journey-activationsskill - Monitor: Track activation success → Use
rt-journey-monitorskill - Optimize: Refine filters and targeting
API Reference
# Base URLs by region
US: https://api-cdp.treasuredata.com
Tokyo: https://api-cdp.in.treasuredata.com
EU: https://api-cdp.eu01.treasuredata.com
# Endpoints
POST /entities/realtime_journeys # Create journey
GET /entities/realtime_journeys # List journeys
GET /entities/realtime_journeys/:id # Get journey
PATCH /entities/realtime_journeys/:id # Update journey
DELETE /entities/realtime_journeys/:id # Delete journey
POST /entities/realtime_journeys/:id/enable # Enable
POST /entities/realtime_journeys/:id/disable # Disable
Resources
More from treasure-data/td-skills
workflow
Manages TD workflows using `tdx wf` commands. Covers project sync (pull/push/clone), running workflows, monitoring sessions/attempts, task timeline visualization, retry/kill operations, and secrets management. Use when users need to manage, monitor, or debug Treasure Workflow projects via tdx CLI.
3journey
Load when the client wants to create, edit, or manage a CDP customer journey. Use for building journey YAML with segments, activations, and stage steps, modifying journey stages or flow logic (decision points, condition waits, A/B tests), or pushing journey changes to Treasure Data. Also load when the client wants to analyze journey performance, query journey tables, create journey dashboards, or generate journey action reports.
2parent-segment-analysis
Query and analyze CDP parent segment database data. Use `tdx ps desc -o` to get output database schema, then query customers and behavior tables. Use when exploring parent segment data, building reports, or analyzing customer attributes and behaviors.
2connector-config
Writes connector_config for segment/journey activations using `tdx connection schema <type>` to discover available fields. Use when configuring activations - always run schema command first to see connector-specific fields.
2trino
TD Trino SQL with TD-specific functions (td_interval, td_time_range, td_time_string, td_sessionize). Use for time-based filtering, partition pruning, and TD query patterns.
2segment
Manages CDP child segments using `tdx sg` commands with YAML rule configs. Covers Value/Behavior condition types, all operators (Equal, In, Between, TimeWithinPast, etc.), behavior aggregations with filters, and nested condition group restrictions. Use when creating audience segments with filtering rules, configuring behavior-based conditions, managing segment hierarchies, or exploring available fields with `tdx sg fields`.
2