Creates Journey.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.
Created
Resource not found
Validation failure
Too many requests
{- "name": "Journey from API",
- "description": "This is a journey created from the API",
- "definition": {
- "entryRules": {
- "type": "MULTIPLE",
- "concurrency": {
- "enabled": true,
- "concurrencyKey": "applicationId"
}
}, - "exitRules": {
- "enabled": true,
- "rules": [
- {
- "key": {
- "id": "exitRuleExit_12345"
}, - "type": "EXIT_RULE",
- "exitType": "EVENT_PERFORMED",
- "condition": "event('Credit Card Application Discarded').count() = 1",
- "enabled": true,
- "concurrencyEnabled": true,
- "connectedDestinations": [
- "destination_5678"
]
}, - {
- "key": {
- "id": "exitRuleExit_22345"
}, - "type": "EXIT_RULE",
- "exitType": "AUDIENCE_MEMBERSHIP_CHANGE",
- "enabled": true,
- "concurrencyEnabled": false,
- "audienceId": "aud_12345"
}
], - "relatedDestinations": [
- {
- "type": "DESTINATION",
- "key": {
- "id": "destination_5678"
}, - "destinations": [
- {
- "destinationId": "67644425c7c427181c2dcb6a",
- "activations": [
- {
- "id": "4R7udgi1oiCH8AooG3mC5",
- "eventName": "Credit Card Application Approved in journey",
- "actionDefinition": {
- "id": "ddond619L9vRgb1eAMhuKm",
- "name": "Send",
- "enabled": true,
- "actionId": "ddond619L9vRgb1eAMhuKm",
- "mappings": {
- "method": "POST",
- "batch_size": 0,
- "data": {
- "@path": "$."
}, - "enable_batching": false
}
}, - "propertySelections": {
- "profile": [
- "phone",
- "name",
- "whatsapp",
- "email"
]
}
}
]
}
]
}
]
}, - "initialState": "entry_12345",
- "states": [
- {
- "key": {
- "id": "entry_12345"
}, - "type": "EVENT_ENTRY",
- "transitions": [
- {
- "next": "exit_12345"
}
], - "condition": "event('Credit Card Application Discarded').count() = 1"
}, - {
- "key": {
- "id": "exit_12345"
}, - "type": "EXIT"
}
]
}
}
{- "data": {
- "journey": {
- "containerId": "jcon_2tG95HZh4oPsgHfcOlznyfcDDAg",
- "versionNumber": 1
}
}
}
Returns the journey by containerId
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.journeys.getJourney('space_id', 'jcon_2tG95HZh4oPsgHfcOlznyfcDDAg')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "journey": {
- "containerId": "jcon_2tG95HZh4oPsgHfcOlznyfcDDAg",
- "name": "Journey from API",
- "description": "This is a journey created from the API",
- "createdAt": "2006-01-02T15:04:05.000Z",
- "updatedAt": "2006-01-02T15:04:05.000Z",
- "createdBy": "john doe",
- "updatedBy": "john doe",
- "version": {
- "version": 1,
- "createdAt": "2006-01-02T15:04:05.000Z",
- "createdBy": "john doe",
- "id": "jver_2tG95GjGbpWY6ekr2KPQ6vMmlkZ",
- "status": "DRAFT",
- "definition": {
- "initialState": "entry_12345",
- "exitRules": {
- "enabled": true,
- "rules": [
- {
- "key": {
- "id": "exitRuleExit_12345"
}, - "type": "EXIT_RULE",
- "exitType": "EVENT_PERFORMED",
- "condition": "event('Credit Card Application Discarded').count() = 1",
- "enabled": true,
- "concurrencyEnabled": true,
- "connectedDestinations": [
- "destination_5678"
]
}, - {
- "key": {
- "id": "exitRuleExit_22345"
}, - "type": "EXIT_RULE",
- "exitType": "AUDIENCE_MEMBERSHIP_CHANGE",
- "enabled": true,
- "concurrencyEnabled": false,
- "audienceId": "aud_12345"
}
], - "relatedDestinations": [
- {
- "type": "DESTINATION",
- "key": {
- "id": "destination_5678"
}, - "destinations": [
- {
- "destinationId": "67644425c7c427181c2dcb6a",
- "activations": [
- {
- "id": "4R7udgi1oiCH8AooG3mC5",
- "eventName": "Credit Card Application Approved in journey",
- "actionDefinition": {
- "id": "ddond619L9vRgb1eAMhuKm",
- "name": "Send",
- "enabled": true,
- "actionId": "ddond619L9vRgb1eAMhuKm",
- "mappings": {
- "method": "POST",
- "batch_size": 0,
- "data": {
- "@path": "$."
}, - "enable_batching": false
}
}, - "propertySelections": {
- "profile": [
- "phone",
- "name",
- "whatsapp",
- "email"
]
}
}
]
}
]
}
]
}, - "entryRules": {
- "type": "MULTIPLE",
- "concurrency": {
- "enabled": true,
- "concurrencyKey": "applicationId"
}
}, - "states": [
- {
- "key": {
- "id": "exit_12345"
}, - "type": "EXIT"
}, - {
- "key": {
- "id": "exit_22345"
}, - "type": "EXIT"
}, - {
- "key": {
- "id": "entry_12345",
- "name": ""
}, - "type": "EVENT_ENTRY",
- "transitions": [
- {
- "next": "split_12345"
}
], - "condition": "event('Credit Card Application Discarded').count() = 1"
}, - {
- "key": {
- "id": "split_12345",
- "name": "wait for event modified"
}, - "type": "EVENT_SPLIT",
- "transitions": [
- {
- "type": "CONDITION",
- "next": "destination_12345",
- "condition": "event('Credit Card Application Approved').count() = 1"
}, - {
- "type": "TIMEOUT",
- "next": "exit_12345",
- "duration": "2h"
}
]
}, - {
- "key": {
- "id": "destination_12345",
- "name": "Send to Twilio Omni channel"
}, - "type": "DESTINATION",
- "transitions": [
- {
- "next": "exit_12345"
}
], - "destinations": [
- {
- "destinationId": "67644425c7c427181c2dcb6a",
- "activations": [
- {
- "id": "4R7udgi1oiCH8AooG3mC5",
- "eventName": "Credit Card Application Approved in journey",
- "actionDefinition": {
- "id": "ddond619L9vRgb1eAMhuKm",
- "name": "Send",
- "enabled": true,
- "actionId": "ddond619L9vRgb1eAMhuKm",
- "mappings": {
- "data": {
- "@path": "$."
}, - "method": "POST",
- "batch_size": 0,
- "enable_batching": false
}
}, - "propertySelections": {
- "profile": [
- "phone",
- "name",
- "whatsapp",
- "email"
]
}
}
]
}
]
}
]
}, - "updatedAt": "2006-01-02T15:04:05.000Z",
- "updatedBy": "john doe"
}
}
}
}
Delete a journey
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.journeys.removeJourneyFromSpace('spaceId', 'jcon_2tG95HZh4oPsgHfcOlznyfcDDAg', 1)) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "status": "SUCCESS"
}
}
Get Analytics for a journey
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap( api.journeys.getJourneyAnalytics('spaceId', 'jcon_2tG95HZh4oPsgHfcOlznyfcDDAg', 1, '2006-01-02T15:04:05.000Z') ) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "journeyAnalytics": {
- "topLevelAnalytics": {
- "entered": {
- "total": 1000,
- "unique": 680
}, - "completed": {
- "total": 800,
- "unique": 500
}, - "inProgress": {
- "total": 200,
- "unique": 180
}, - "exited": {
- "total": 10,
- "unique": 8
}
}, - "stepLevelAnalytics": [
- {
- "from": {
- "id": "entry_12345"
}, - "to": {
- "id": "split_12345",
- "name": "wait for event"
}, - "analytics": {
- "total": 1000,
- "unique": 680
}
}, - {
- "from": {
- "id": "split_12345",
- "name": "wait for event"
}, - "to": {
- "id": "destination_12345",
- "name": "Send to Twilio Omni channel"
}, - "analytics": {
- "total": 500,
- "unique": 400
}
}, - {
- "from": {
- "id": "split_12345",
- "name": "wait for event"
}, - "to": {
- "id": "exit_12345"
}, - "analytics": {
- "total": 300,
- "unique": 100
}
}, - {
- "from": {
- "id": "destination_12345",
- "name": "Send to Twilio Omni channel"
}, - "to": {
- "id": "exit_23456"
}, - "analytics": {
- "total": 500,
- "unique": 400
}
}
]
}
}
}
Replace steps for a journey
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
{- "initialState": "entry_12345",
- "states": [
- {
- "key": {
- "id": "exit_12345"
}, - "type": "EXIT"
}, - {
- "key": {
- "id": "exit_22345"
}, - "type": "EXIT"
}, - {
- "key": {
- "id": "entry_12345"
}, - "type": "EVENT_ENTRY",
- "transitions": [
- {
- "next": "split_12345"
}
], - "condition": "event('Credit Card Application Discarded').count() = 1"
}, - {
- "key": {
- "id": "split_12345",
- "name": "wait for event modified"
}, - "type": "EVENT_SPLIT",
- "transitions": [
- {
- "type": "CONDITION",
- "next": "destination_12345",
- "condition": "event('Credit Card Application Approved').count() = 1"
}, - {
- "type": "TIMEOUT",
- "next": "exit_12345",
- "duration": "2h"
}
]
}, - {
- "key": {
- "id": "destination_12345",
- "name": "Send to Twilio Omni channel"
}, - "type": "DESTINATION",
- "transitions": [
- {
- "next": "exit_22345"
}
], - "destinations": [ ]
}
]
}
{- "data": {
- "containerId": "jcon_2tG95HZh4oPsgHfcOlznyfcDDAg",
- "versionNumber": 1
}
}
Update DESTINATIONS for a journey
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
{- "stateDestinations": [
- {
- "stateId": "destination_12345",
- "destinations": [
- {
- "destinationId": "67644425c7c427181c2dcb6a",
- "activations": [
- {
- "eventName": "Credit Card Application Approved in journey",
- "actionDefinition": {
- "actionId": "ddond619L9vRgb1eAMhuKm",
- "useDefaultMappings": true,
}, - "propertySelections": {
- "profile": [
- "email",
- "name",
- "phone",
- "whatsapp"
]
}
}
]
}
]
}
]
}
{- "data": {
- "containerId": "jcon_2tG95HZh4oPsgHfcOlznyfcDDAg",
- "destinations": [
- {
- "key": {
- "id": "destination_12345"
}, - "type": "DESTINATION",
- "destinations": [
- {
- "destinationId": "67644425c7c427181c2dcb6a",
- "activations": [
- {
- "id": "4R7udgi1oiCH8AooG3mC5",
- "eventName": "Credit Card Application Approved in journey",
- "actionDefinition": {
- "id": "ddond619L9vRgb1eAMhuKm",
- "name": "Send",
- "enabled": true,
- "actionId": "ddond619L9vRgb1eAMhuKm",
- "mappings": {
- "method": "POST",
- "batch_size": 0,
- "data": {
- "@path": "$."
}, - "enable_batching": false
}
}, - "propertySelections": {
- "profile": [
- "phone",
- "name",
- "whatsapp",
- "email"
]
}
}
]
}
], - "transitions": [
- {
- "next": "exit_12345"
}
]
}
]
}
}
Update status of the journey
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Journeys feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
{- "action": "PUBLISH",
- "version": 1
}
{- "data": {
- "containerId": "jcon_2tG95HZh4oPsgHfcOlznyfcDDAg",
- "status": "PUBLISHED",
- "version": 1
}
}