Conversations-2

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

Endpoints

GET
PATCH
DELETE
POST
POST
POST
GET

Retrieve conversations tickets

Get single ticket and mark as read by team.

Required API key scopes

ticket:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/conversations/tickets/: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/conversations/tickets/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0,
"channel_source": "widget",
"channel_detail": "slack_channel_message",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string",
"user": {
"property1": "string",
"property2": "string"
},
"role": {
"property1": "string",
"property2": "string"
}
},
"anonymous_traits": null,
"ai_resolved": true,
"escalation_reason": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message_count": 0,
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_text": "string",
"unread_team_count": 0,
"unread_customer_count": 0,
"session_id": "string",
"session_context": null,
"sla_due_at": "2019-08-24T14:15:22Z",
"snoozed_until": "2019-08-24T14:15:22Z",
"slack_channel_id": "string",
"slack_thread_ts": "string",
"slack_team_id": "string",
"email_subject": "string",
"email_from": "user@example.com",
"email_to": "string",
"cc_participants": null,
"github_repo": "string",
"github_issue_number": 0,
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
},
"tags": [
null
]
}

Update conversations tickets

Required API key scopes

ticket:write

Path parameters

  • id
    string

Request parameters

  • status
  • priority
  • anonymous_traits
  • ai_resolved
    boolean
  • escalation_reason
    stringnull
  • sla_due_at
    stringnull
  • snoozed_until
    stringnull
  • tags
    array

Response


Example request

PATCH /api/projects/:project_id/conversations/tickets/: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/conversations/tickets/:id/\
-d ticket_number="integer"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0,
"channel_source": "widget",
"channel_detail": "slack_channel_message",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string",
"user": {
"property1": "string",
"property2": "string"
},
"role": {
"property1": "string",
"property2": "string"
}
},
"anonymous_traits": null,
"ai_resolved": true,
"escalation_reason": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message_count": 0,
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_text": "string",
"unread_team_count": 0,
"unread_customer_count": 0,
"session_id": "string",
"session_context": null,
"sla_due_at": "2019-08-24T14:15:22Z",
"snoozed_until": "2019-08-24T14:15:22Z",
"slack_channel_id": "string",
"slack_thread_ts": "string",
"slack_team_id": "string",
"email_subject": "string",
"email_from": "user@example.com",
"email_to": "string",
"cc_participants": null,
"github_repo": "string",
"github_issue_number": 0,
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
},
"tags": [
null
]
}

Delete conversations tickets

Required API key scopes

ticket:write

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/conversations/tickets/: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/conversations/tickets/:id/

Example response

Status 204 No response body

Create conversations tickets suggest reply

Path parameters

  • id
    string

Response


Example request

POST /api/projects/:project_id/conversations/tickets/:id/suggest_reply
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/conversations/tickets/:id/suggest_reply/

Example response

Status 200
RESPONSE
{
"suggestion": "string"
}
Status 400
RESPONSE
{
"detail": "string",
"error_type": "string"
}
Status 403
RESPONSE
{
"detail": "string",
"error_type": "string"
}
Status 500
RESPONSE
{
"detail": "string",
"error_type": "string"
}

Create conversations tickets bulk update tags

Bulk update tags on multiple objects.

Accepts:

  • {"ids": [...], "action": "add"|"remove"|"set", "tags": ["tag1", "tag2"]}

Actions:

  • "add": Add tags to existing tags on each object
  • "remove": Remove specific tags from each object
  • "set": Replace all tags on each object with the provided list

Request parameters

  • ids
    array
  • action
  • tags
    array

Response


Example request

POST /api/projects/:project_id/conversations/tickets/bulk_update_tags
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/conversations/tickets/bulk_update_tags/\
-d ids="array",\
-d action=undefined,\
-d tags="array"

Example response

Status 200
RESPONSE
{
"updated": [
{
"id": 0,
"tags": [
"string"
]
}
],
"skipped": [
{
"id": 0,
"reason": "string"
}
]
}

Create conversations tickets compose

Create a new outbound ticket and send the first message to the customer.

Request parameters

  • recipient_email
    string
  • recipient_distinct_id
    string
  • email_subject
    string
  • email_config_id
    string
  • message
    string
  • rich_content

Response


Example request

POST /api/projects/:project_id/conversations/tickets/compose
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/conversations/tickets/compose/\
-d recipient_email="string",\
-d email_config_id="string",\
-d message="string"

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0
}
Status 400
RESPONSE
{
"detail": "string",
"error_type": "string"
}

Retrieve conversations tickets unread count

Get total unread ticket count for the team.

Returns the sum of unread_team_count for all non-resolved tickets. Cached in Redis for 30 seconds, invalidated on changes.

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"ticket_number": 0,
"channel_source": "widget",
"channel_detail": "slack_channel_message",
"distinct_id": "string",
"status": "new",
"priority": "low",
"assignee": {
"id": "string",
"type": "string",
"user": {
"property1": "string",
"property2": "string"
},
"role": {
"property1": "string",
"property2": "string"
}
},
"anonymous_traits": null,
"ai_resolved": true,
"escalation_reason": "string",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"message_count": 0,
"last_message_at": "2019-08-24T14:15:22Z",
"last_message_text": "string",
"unread_team_count": 0,
"unread_customer_count": 0,
"session_id": "string",
"session_context": null,
"sla_due_at": "2019-08-24T14:15:22Z",
"snoozed_until": "2019-08-24T14:15:22Z",
"slack_channel_id": "string",
"slack_thread_ts": "string",
"slack_team_id": "string",
"email_subject": "string",
"email_from": "user@example.com",
"email_to": "string",
"cc_participants": null,
"github_repo": "string",
"github_issue_number": 0,
"person": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"distinct_ids": [
"string"
],
"properties": {},
"created_at": "2019-08-24T14:15:22Z",
"is_identified": true
},
"tags": [
null
]
}

Community questions

Questions about this page? or post a community question.