Workflow

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST
GET

Create workflow imports

Turns Customer.io automations into draft workflows. Pass each automation as Customer.io's Journeys UI API returns it. Pass the templates its messages use, or leave them out when the project stored a Customer.io App API key, and PostHog reads them. Each result lists what the import changed or left out. Importing an automation again updates its draft, unless that workflow is no longer a draft. Set dry_run to preview without saving.

Required API key scopes

hog_flow:write

Request parameters

  • source
  • campaigns
    Click to open
    array
  • snippets
    object
  • segment_cohorts
    object
  • layouts
    object
  • sender_identities
    Click to open
    array
  • segments
    Click to open
    array
  • dry_run
    boolean
    Default: false

Response


Example request

POST /api/projects/:project_id/workflow_imports
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/workflow_imports/\
-d source=undefined,\
-d campaigns="array"

Example response

Status 200
RESPONSE
{
"results": [
{
"source_id": "string",
"name": "string",
"status": "preview",
"workflow_id": "string",
"notes": [
{
"level": "approximated",
"message": "string",
"step_id": "string",
"step_name": "string"
}
],
"validation_errors": [
"string"
]
}
],
"content_fetched": true,
"segment_cohorts": [
{
"segment_id": "string",
"segment_name": "string",
"status": "created",
"cohort_id": 0,
"reason": "string"
}
]
}

Retrieve workflow imports for workflow

Required API key scopes

hog_flow:read

Query parameters

  • hog_flow_id
    string

Response


Example request

GET /api/projects/:project_id/workflow_imports/for_workflow
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/workflow_imports/for_workflow/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"source": "string",
"source_id": "string",
"source_name": "string",
"hog_flow": "a358a3bf-876e-4745-ab24-d5d741b3cd17",
"notes": [
{
"level": "approximated",
"message": "string",
"step_id": "string",
"step_name": "string"
}
],
"updated_at": "2019-08-24T14:15:22Z"
}
Status 204 The workflow was not imported.