---
title: "Transcript webhooks: signed JSON, HMAC-SHA256 · Typd"
description: "Typd POSTs each transcript as JSON signed with HMAC-SHA256. Payload, headers, retries, and signature checks in TypeScript, Go, Rust, Python and Swift."
url: https://gettypd.app/docs/webhooks/
---

Docs

# Webhooks

Typd POSTs each transcript as JSON signed with HMAC-SHA256. Payload, headers, retries, and signature checks in TypeScript, Go, Rust, Python and Swift.

Typd can send every transcript to a URL you choose: one webhook per [watch folder](https://gettypd.app/docs/watch-folders/), and one for recordings. Use it with Zapier, Make, n8n, a notes app, or your own script. Webhooks are a **Pro** feature.

Webhooks are off until you enter a URL. They are the only network traffic from Typd that carries your transcript to a server (Sync, if you turn it on, writes it to your iCloud Drive). Every connection the app makes is listed in [Permissions › Network](https://gettypd.app/docs/permissions/#network).

## Set up

-   **Folder webhook:** in the main window’s sidebar, right-click a watch folder › **Edit Folder…** › Webhook.
-   **Dictation webhook:** Settings › **Automation** › **Dictation Webhook** › **Edit…**. It fires for every dictation (from your shortcut, the menu, a link or the command line), for every recording with [other apps’ audio](https://gettypd.app/docs/meetings/), and for every answer you give a [coding agent](https://gettypd.app/docs/mcp/). Its `folder_name` is `Recordings` and its `folder_path` is the recordings folder (default `~/Typd/Recordings`).

Each webhook has a **secret** (generated for you; Copy or Regenerate), optional **custom headers**, and a **Send Test** button that posts a sample payload and shows the HTTP status. **Include the file path** (on by default) controls whether `file_path` and `file_name` are sent; local paths contain your macOS user name.

URLs must use HTTPS. Plain `http://` is allowed only for `localhost`, `127.0.0.1`, `::1` and `*.local` hosts. **Use the final URL: redirects are not followed.** A 3xx reply counts as a failed delivery, and Typd does not retry it.

## Request

```http
POST /your/endpoint HTTP/1.1
Content-Type: application/json
User-Agent: Typd/0.1.0
X-Typd-Event: transcription.completed
X-Typd-Delivery: 3f1c2e0a-9b7d-4c1e-8f2a-6d5b4a3c2b1a
X-Typd-Signature: sha256=<hex HMAC-SHA256(secret, raw body)>
X-Typd-Timestamp: 1791883920
```

## Payload

Every key is always present. Optional values are `null`.

```json
{
  "event": "transcription.completed",
  "id": "8d0f6c2e-5a43-4b8e-9a51-2f7d3c1b9e64",
  "source": "watch_folder",
  "text": "Interview notes: the candidate has strong Swift experience.",
  "folder_path": "/Users/you/Interviews",
  "folder_name": "Interviews",
  "file_path": "/Users/you/Interviews/call.m4a",
  "file_name": "call.m4a",
  "duration_seconds": 42.0,
  "model": "cohere-transcribe",
  "language": null,
  "created_at": "2026-10-13T09:12:00Z",
  "app_version": "0.1.0"
}
```

| Field | Type | Notes |
| --- | --- | --- |
| `event` | string | Always `transcription.completed`. |
| `id` | string (UUID) | The History entry id. Stable across retries: use it to ignore duplicates. |
| `source` | string | `watch_folder` or `recording`. |
| `text` | string | The transcript. Never empty: empty transcripts do not fire a webhook. |
| `folder_path`, `folder_name` | string | The watch folder, or the recordings folder and `Recordings`. |
| `file_path`, `file_name` | string or null | The source file. |
| `duration_seconds` | number | Audio length. |
| `model` | string | The model that transcribed it. |
| `language` | string or null | Currently always `null`. |
| `created_at` | string | ISO 8601, UTC. |
| `app_version` | string | Typd version. |

Discarded or canceled recordings never fire a webhook.

## Delivery and retries

-   Timeout: 10 seconds per attempt.
-   Any 2xx response is success.
-   Network errors, timeouts, 408, 429 and 5xx are retried: up to 4 tries in total, after 2 s, 10 s and 60 s. Other statuses, redirects included, fail immediately.
-   History shows the delivery state of each entry: **Sending…**, **Delivered** or **Failed (…)**. Right-click an entry › **Resend Webhook** to try again.

## Verify the signature

The signature is `sha256=` followed by the lowercase hex HMAC-SHA256 of the **raw request body**, keyed with the webhook secret **as text**: the key is the UTF-8 bytes of the 64-character hex secret you copied, not the bytes it encodes. All samples below do this. Compute it over the exact bytes you received, before parsing the JSON, and compare in constant time. The timestamp header is not part of the signature; deduplicate with `id` or `X-Typd-Delivery`.

### TypeScript (Node.js)

Uses only Node’s built-in modules; no packages needed.

```ts
import { createHmac, timingSafeEqual } from 'node:crypto';
import { createServer } from 'node:http';

const SECRET = process.env.TYPD_WEBHOOK_SECRET ?? '';
if (!SECRET) throw new Error('Set TYPD_WEBHOOK_SECRET to the webhook secret from Typd.');

function verify(raw: Buffer, header: string | string[] | undefined): boolean {
  const expected = Buffer.from('sha256=' + createHmac('sha256', SECRET).update(raw).digest('hex'));
  const received = Buffer.from(typeof header === 'string' ? header : '');
  return received.length === expected.length && timingSafeEqual(received, expected);
}

interface TypdEvent {
  id: string;
  folder_name: string;
  text: string;
}

createServer((req, res) => {
  const chunks: Buffer[] = [];
  req.on('data', (chunk: Buffer) => chunks.push(chunk));
  req.on('end', () => {
    const raw = Buffer.concat(chunks);
    if (!verify(raw, req.headers['x-typd-signature'])) {
      res.writeHead(401).end();
      return;
    }
    const event = JSON.parse(raw.toString('utf8')) as TypdEvent;
    console.log(`[${event.folder_name}] ${event.text}`);
    res.writeHead(204).end();
  });
}).listen(8787, '127.0.0.1'); // this Mac only
```

### Go

Standard library only (Go 1.22 or later for the `POST /` route pattern).

```go
package main

import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/hex"
	"encoding/json"
	"io"
	"log"
	"net/http"
	"os"
)

var secret = []byte(os.Getenv("TYPD_WEBHOOK_SECRET"))

func verify(raw []byte, header string) bool {
	mac := hmac.New(sha256.New, secret)
	mac.Write(raw)
	expected := "sha256=" + hex.EncodeToString(mac.Sum(nil))
	return hmac.Equal([]byte(expected), []byte(header))
}

func hook(w http.ResponseWriter, r *http.Request) {
	raw, err := io.ReadAll(io.LimitReader(r.Body, 10<<20))
	if err != nil || !verify(raw, r.Header.Get("X-Typd-Signature")) {
		w.WriteHeader(http.StatusUnauthorized)
		return
	}
	var event struct {
		FolderName string `json:"folder_name"`
		Text       string `json:"text"`
	}
	if err := json.Unmarshal(raw, &event); err != nil {
		w.WriteHeader(http.StatusBadRequest)
		return
	}
	log.Printf("[%s] %s", event.FolderName, event.Text)
	w.WriteHeader(http.StatusNoContent)
}

func main() {
	if len(secret) == 0 {
		log.Fatal("Set TYPD_WEBHOOK_SECRET to the webhook secret from Typd.")
	}
	http.HandleFunc("POST /", hook)
	log.Fatal(http.ListenAndServe("127.0.0.1:8787", nil)) // this Mac only
}
```

### Rust

Uses axum with the `hmac`, `sha2` and `hex` crates; the first line lists the Cargo dependencies.

```rust
// Cargo.toml: axum = "0.8", tokio = { version = "1", features = ["full"] }, hmac = "0.12", sha2 = "0.10", hex = "0.4", serde_json = "1"
use axum::{body::Bytes, http::{HeaderMap, StatusCode}, routing::post, Router};
use hmac::{Hmac, Mac};
use sha2::Sha256;

fn verify(secret: &str, raw: &[u8], header: Option<&str>) -> bool {
    let Some(hex_sig) = header.and_then(|h| h.strip_prefix("sha256=")) else { return false };
    let Ok(sig) = hex::decode(hex_sig) else { return false };
    let mut mac = Hmac::<Sha256>::new_from_slice(secret.as_bytes()).expect("any key length works");
    mac.update(raw);
    mac.verify_slice(&sig).is_ok() // constant time
}

async fn hook(headers: HeaderMap, raw: Bytes) -> StatusCode {
    let secret = std::env::var("TYPD_WEBHOOK_SECRET").expect("set TYPD_WEBHOOK_SECRET");
    let header = headers.get("x-typd-signature").and_then(|v| v.to_str().ok());
    if !verify(&secret, &raw, header) {
        return StatusCode::UNAUTHORIZED;
    }
    let Ok(event) = serde_json::from_slice::<serde_json::Value>(&raw) else { return StatusCode::BAD_REQUEST };
    println!("[{}] {}", event["folder_name"].as_str().unwrap_or(""), event["text"].as_str().unwrap_or(""));
    StatusCode::NO_CONTENT
}

#[tokio::main]
async fn main() {
    let app = Router::new().route("/", post(hook));
    let listener = tokio::net::TcpListener::bind("127.0.0.1:8787").await.unwrap(); // this Mac only
    axum::serve(listener, app).await.unwrap();
}
```

### Python

```python
import hashlib, hmac, json, os
from http.server import BaseHTTPRequestHandler, HTTPServer

SECRET = os.environ["TYPD_WEBHOOK_SECRET"].encode()

def verify(raw: bytes, header: str | None) -> bool:
    expected = "sha256=" + hmac.new(SECRET, raw, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, header or "")

class Hook(BaseHTTPRequestHandler):
    def do_POST(self):
        raw = self.rfile.read(int(self.headers.get("Content-Length", 0)))
        if not verify(raw, self.headers.get("X-Typd-Signature")):
            self.send_response(401); self.end_headers(); return
        event = json.loads(raw)
        print(f"[{event['folder_name']}] {event['text']}")
        self.send_response(204); self.end_headers()

HTTPServer(("127.0.0.1", 8787), Hook).serve_forever()
```

### Swift

```swift
import CryptoKit
import Foundation

/// Verifies `X-Typd-Signature` against the raw request body.
func verifyTypdSignature(body: Data, header: String?, secret: String) -> Bool {
    guard let header, header.hasPrefix("sha256=") else { return false }
    let hex = header.dropFirst("sha256=".count)
    guard hex.count == 64 else { return false }
    var mac = Data(capacity: 32)
    var index = hex.startIndex
    while index < hex.endIndex {
        let next = hex.index(index, offsetBy: 2)
        guard let byte = UInt8(hex[index..<next], radix: 16) else { return false }
        mac.append(byte)
        index = next
    }
    // Constant-time comparison.
    return HMAC<SHA256>.isValidAuthenticationCode(mac, authenticating: body, using: SymmetricKey(data: Data(secret.utf8)))
}
```

## Test locally

Run one of the receivers above, set the folder’s webhook to `http://localhost:8787/`, paste the secret into `TYPD_WEBHOOK_SECRET`, and click **Send Test**.

## Recipes

-   **Zapier / Make:** use a “Catch Hook” / “Custom webhook” trigger and paste its URL. Map `text` and `folder_name` into the next step.
-   **n8n:** add a Webhook node (POST). To verify the signature, add a Code node that computes the HMAC of the raw body with your secret.
-   **Your notes app:** run a tiny receiver (above) that appends `text` to a Markdown file named after `folder_name`.
