Runtime Automation

Local automation scripts for sharing Adapt Action Explorer feedback and usage signals into Slack.

Runtime scripts live in this project folder and are exposed through repository-root npm commands.

Current script layout:

  • projects/adapt-action-explorer/scripts/env/check-env.ts
  • projects/adapt-action-explorer/scripts/posthog/index.ts
  • projects/adapt-action-explorer/scripts/typeform/fetch-typeform-feedback.ts

Setup

# From the cdp-index repository root:
cp .env.example .env

Fill in the root .env with real tokens. Do not commit .env or other secret-bearing env files.

Environment loading now comes from the root CDP Index runtime helper in src/runtime/env.ts. It loads .env, .env.local, environment-specific .env.* files, and .env.pets from the repository root first, then this app folder for optional local overrides.

Secret Managers

Doppler and Infisical can inject secrets at runtime instead of storing them in plaintext .env files. The repo still supports .env as a fallback.

The root Doppler manifest is ../doppler.yaml. It names Doppler project/config bindings for apps in this repo plus required secret keys. It intentionally does not contain secret values.

Install status can be checked with:

doppler --version
infisical --version

Configure Doppler for this app from the repository root:

npm run env:doppler:login
npm run env:doppler:check -- cdp-worldwide

Configure Infisical for this app if that project is available:

infisical login
infisical init

Define these secrets in either provider:

  • SLACK_BOT_TOKEN
  • TYPEFORM_ACCESS_TOKEN
  • POSTHOG_PERSONAL_API_KEY

Set them in Doppler:

doppler secrets set --project cdp-worldwide --config dev SLACK_BOT_TOKEN
doppler secrets set --project cdp-worldwide --config dev TYPEFORM_ACCESS_TOKEN
doppler secrets set --project cdp-worldwide --config dev POSTHOG_PERSONAL_API_KEY

Default scripts run through Doppler:

npm run feedback:fetch -- --date 2026-06-08
npm run feedback:share-slack -- --date 2026-06-08

Infisical wrappers remain available if that project is configured:

npm run feedback:fetch:infisical -- --date 2026-06-08
npm run feedback:share-slack:infisical -- --date 2026-06-08

Required Access

  • Slack bot token with chat:write.
  • Slack bot invited to each target channel.
  • Typeform access token for feedback sharing.
  • PostHog personal API key with query:read.

Commands

npm run check
npm run env:check
npm run trigger:dev

Fetch Typeform feedback submitted today as JSON:

npm run feedback:fetch -- --date 2026-06-08

Preview Typeform feedback as Slack messages without posting:

npm run feedback:share-slack:dry-run -- --date 2026-06-08

Post Typeform feedback submitted today to Slack:

npm run feedback:share-slack -- --date 2026-06-08

Fetch one Typeform response:

npm run feedback:fetch -- --response-id RESPONSE_ID

Share one Typeform response:

npm run feedback:share-slack -- --response-id RESPONSE_ID

Preview the PostHog Slack message without posting:

npm run posthog:share-slack:dry-run

Fetch the default PostHog summary as JSON:

npm run posthog:fetch -- --days 7 --limit 10

Post the default PostHog summary:

npm run posthog:share-slack -- --days 7 --limit 10

Post a custom HogQL query:

npm run posthog:share-slack -- --title "Adapt Action Explorer signups" --query "SELECT count() AS signups FROM events WHERE event = 'signup' AND timestamp >= now() - INTERVAL {days} DAY"

Trigger.dev Schedules

Trigger.dev is initialized for project proj_josluemttxuyxlckpgpf.

Registered tasks:

  • posthog-summary-to-slack: publishes projects/adapt-action-explorer/scripts/posthog/index.ts.
  • typeform-feedback-to-slack: publishes projects/adapt-action-explorer/scripts/typeform/fetch-typeform-feedback.ts.

Both tasks call the same project-local Node scripts used by the root npm commands. Direct Typeform runs fetch JSON unless Slack publishing is explicitly requested through the automation wrapper.

Kennel owns the Trigger.dev schedules in the root raggle.json publish config:

  • posthog-summary-to-slack: runs daily at 09:00 and 17:00 Europe/London.
  • typeform-feedback-to-slack: runs hourly in Europe/London.

Deploy Trigger.dev tasks manually while developing:

npm run trigger:dev
npm run trigger:deploy

npm run trigger:dev verifies the tasks locally. npm run trigger:deploy deploys the task definitions for project proj_josluemttxuyxlckpgpf.

On production docs deploy, kennel deploy runs the configured Trigger.dev deploy command and creates or updates the schedules with stable deduplication keys. Kennel loads TRIGGER_SECRET_KEY from Doppler project cdp-worldwide, config prd.

Set production secrets in Trigger.dev before deploying:

  • SLACK_BOT_TOKEN
  • TYPEFORM_ACCESS_TOKEN
  • POSTHOG_PERSONAL_API_KEY

Optional Trigger.dev schedule overrides:

  • POSTHOG_SUMMARY_DAYS
  • POSTHOG_SUMMARY_LIMIT
  • POSTHOG_SUMMARY_TITLE
  • TYPEFORM_FEEDBACK_DATE for one-off backfills only.

Environment Variables

SLACK_BOT_TOKEN : Slack bot token used by both scripts.

TYPEFORM_ACCESS_TOKEN : Typeform API access token.

Typeform feedback publishing routes are defined in code:

  • Typeform form h0Og6Gme posts to Slack channel C0B6FN8KHRC.

POSTHOG_PERSONAL_API_KEY : PostHog personal API key for private query endpoints.

PostHog summary routing is defined in code:

  • PostHog project 141282 on https://eu.posthog.com posts to Slack channel C0B9VA48737.