认证
此提供商需要身份验证。
- api_key: PostHog API 密钥(必需:True,敏感:True)
- project_id: PostHog 项目 ID(必需:True,敏感:False)
某些范围可能需要才能通过提供商执行特定操作或查询。以下是相关范围及其用例的摘要:
- session_recording:read: 读取 PostHog 会话录制(强制)
- session_recording_playlist:read: 读取 PostHog 会话录制播放列表
- project:read: 读取 PostHog 项目数据(强制)
在工作流中
此提供商可用于工作流。
作为"步骤"来查询数据,示例:
yaml
steps:
- name: Query posthog
provider: posthog
config: "{{ provider.my_provider_name }}"
with:
query_type: {value} # 查询类型(例如 "session_recording_domains"、"session_recordings")
hours: {value} # 回溯的小时数
limit: {value} # 要获取的最大项目数
# 附加参数请查看以下工作流示例:
提供商方法
get_session_recording_domains 获取时间段内会话录制中的域名列表(操作,范围:session_recording:read, project:read)
hours: 回溯的小时数(默认:24)limit: 要获取的最大录制数(默认:100)
get_session_recordings 获取时间段内的会话录制(操作,范围:session_recording:read, project:read)
hours: 回溯的小时数(默认:24)limit: 要获取的最大录制数(默认:100)
连接 Provider
API 密钥
要获取 PostHog API 密钥,请按照以下步骤操作:
- 登录您的 PostHog 账户。
- 导航至"Project Settings" > "API Keys"。
- 创建新的 API 密钥或使用现有的。
- 复制 API 密钥值。
项目 ID
要找到您的 PostHog 项目 ID:
- 登录您的 PostHog 账户。
- 项目 ID 在您的项目设置中可见,或者在查看项目时的 URL 中。
可用的方法
PostHog provider 提供以下方法:
获取会话录制域
在指定时间段内从会话录制中检索域列表。
yaml
- name: get-posthog-domains
provider:
config: "{{ providers.posthog }}"
type: posthog
with:
query_type: session_recording_domains
hours: 24 # Number of hours to look back
limit: 500 # Maximum number of recordings to fetch获取会话录制
在指定时间段内检索会话录制数据。
yaml
- name: get-posthog-recordings
provider:
config: "{{ providers.posthog }}"
type: posthog
with:
query_type: session_recordings
hours: 24 # Number of hours to look back
limit: 100 # Maximum number of recordings to fetch示例工作流
以下是一个跟踪过去 24 小时内 PostHog 会话录制中的域并将摘要发送到 Slack 的示例工作流:
yaml
workflow:
id: posthog-domain-tracker
name: PostHog Domain Tracker
description: Tracks domains from PostHog session recordings over the last 24 hours and sends a summary to Slack.
triggers:
- type: manual
- type: interval
value: 86400 # Run daily (in seconds)
steps:
- name: get-posthog-domains
provider:
config: "{{ providers.posthog }}"
type: posthog
with:
query_type: session_recording_domains
hours: 24
limit: 500
actions:
- name: send-to-slack
provider:
config: "{{ providers.slack }}"
type: slack
with:
blocks:
- type: header
text:
type: plain_text
text: "PostHog Session Recording Domains (Last 24 Hours)"
emoji: true
- type: section
text:
type: mrkdwn
text: "Found *{{ steps.get-posthog-domains.results.unique_domains_count }}* unique domains across *{{ steps.get-posthog-domains.results.total_domains_found }}* occurrences"
- type: divider
- type: section
text:
type: mrkdwn
text: "Domains:*"
- type: section
text:
type: mrkdwn
text: "{{#steps.get-posthog-domains.results.unique_domains}}
• *{{ . }}*
{{/steps.get-posthog-domains.results.unique_domains}}"
- type: divider注意事项
PostHog provider 需要以下范围:
session_recording:read- 允许读取会话录制数据project:read- 允许读取项目数据session_recording_playlist:read- 对录制播放列表的可选访问