• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
sourcebot

sourcebot

untitled-6888

Public
Like
untitled-6888
Home
Code
3
README.md
H
index.ts
main.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
9/20/2025
README.md

Typeform to PostHog Webhook

A REST API endpoint that receives Typeform webhook submissions and forwards them as events to PostHog.

Setup

  1. Set the POSTHOG_API_KEY environment variable in your Val Town settings with your PostHog API key.

Endpoints

POST /typeform-submit

Accepts Typeform webhook payloads and sends a typeform_completed event to PostHog.

Request Body:

{ "form_response": { "form_id": "form_123", "token": "response_456", "submitted_at": "2024-01-01T12:00:00Z", "landed_at": "2024-01-01T11:55:00Z", "hidden": { "user_id": "user_789", "source": "email_campaign" } } }

Response:

  • 200 OK: Event successfully sent to PostHog
  • 500 Internal Server Error: Missing API key or PostHog API error

GET /

Health check endpoint that returns API information.

PostHog Event Structure

The endpoint sends events to PostHog with the following structure:

  • Event Name: typeform_completed
  • Distinct ID: Uses hidden.user_id, falls back to landed_at, then 'anonymous'
  • Properties: Includes all hidden fields plus:
    • form_id: Typeform form identifier
    • response_id: Typeform response token
    • submitted_at: Submission timestamp

Typeform Webhook Configuration

In your Typeform settings:

  1. Go to Connect → Webhooks
  2. Add webhook URL: https://your-val-url.web.val.run/typeform-submit
  3. Select "Form submitted" trigger
  4. Configure any hidden fields you want to pass through to PostHog

Environment Variables

  • POSTHOG_API_KEY: Your PostHog project API key (required)
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.