Messaging

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

Endpoints

GET
POST
GET
PATCH
DELETE
PATCH

List all messaging templates

Required API key scopes

hog_flow:read

Query parameters

  • limit
    integer
  • offset
    integer

Response


Example request

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

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"content": {
"templating": "liquid",
"email": {
"subject": "string",
"text": "string",
"html": "string",
"design": {
"counters": {},
"schemaVersion": 0,
"body": {
"id": "string",
"rows": [
{}
],
"headers": [
{}
],
"footers": [
{}
],
"values": {}
}
}
}
},
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"type": "string",
"message_category": "f74e6cc3-ac28-48ea-b195-3d593d7f03ec",
"deleted": true
}
]
}

Create messaging templates

Required API key scopes

hog_flow:write

Request parameters

  • name
    string
  • description
    string
  • content
  • type
    string
  • message_category
    stringnull
  • deleted
    boolean

Response


Example request

POST /api/projects/:project_id/messaging_templates
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/messaging_templates/\
-d name="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"content": {
"templating": "liquid",
"email": {
"subject": "string",
"text": "string",
"html": "string",
"design": {
"counters": {},
"schemaVersion": 0,
"body": {
"id": "string",
"rows": [
{}
],
"headers": [
{}
],
"footers": [
{}
],
"values": {}
}
}
}
},
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"type": "string",
"message_category": "f74e6cc3-ac28-48ea-b195-3d593d7f03ec",
"deleted": true
}

Retrieve messaging templates

Required API key scopes

hog_flow:read

Path parameters

  • id
    string

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"content": {
"templating": "liquid",
"email": {
"subject": "string",
"text": "string",
"html": "string",
"design": {
"counters": {},
"schemaVersion": 0,
"body": {
"id": "string",
"rows": [
{}
],
"headers": [
{}
],
"footers": [
{}
],
"values": {}
}
}
}
},
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"type": "string",
"message_category": "f74e6cc3-ac28-48ea-b195-3d593d7f03ec",
"deleted": true
}

Update messaging templates

Required API key scopes

hog_flow:write

Path parameters

  • id
    string

Request parameters

  • name
    string
  • description
    string
  • content
  • type
    string
  • message_category
    stringnull
  • deleted
    boolean

Response


Example request

PATCH /api/projects/:project_id/messaging_templates/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/messaging_templates/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"content": {
"templating": "liquid",
"email": {
"subject": "string",
"text": "string",
"html": "string",
"design": {
"counters": {},
"schemaVersion": 0,
"body": {
"id": "string",
"rows": [
{}
],
"headers": [
{}
],
"footers": [
{}
],
"values": {}
}
}
}
},
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"type": "string",
"message_category": "f74e6cc3-ac28-48ea-b195-3d593d7f03ec",
"deleted": true
}

Delete messaging templates

Hard delete of this model is not allowed. Use a patch API call to set "deleted" to true

Required API key scopes

hog_flow:write

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/messaging_templates/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/messaging_templates/:id/

Example response

Status 405 No response body

Update messaging templates design

Required API key scopes

hog_flow:write

Path parameters

  • id
    string

Request parameters

  • operations
    Click to open
    array

Response


Example request

PATCH /api/projects/:project_id/messaging_templates/:id/design
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X PATCH \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/messaging_templates/:id/design/\
-d operations="array"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"description": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"content": {
"templating": "liquid",
"email": {
"subject": "string",
"text": "string",
"html": "string",
"design": {
"counters": {},
"schemaVersion": 0,
"body": {
"id": "string",
"rows": [
{}
],
"headers": [
{}
],
"footers": [
{}
],
"values": {}
}
}
}
},
"created_by": {
"id": 0,
"uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f",
"distinct_id": "string",
"first_name": "string",
"last_name": "string",
"email": "user@example.com",
"is_email_verified": true,
"hedgehog_config": {},
"role_at_organization": "engineering"
},
"type": "string",
"message_category": "f74e6cc3-ac28-48ea-b195-3d593d7f03ec",
"deleted": true
}

Community questions