← Public packages
@kentcdodds/exchange-threads
Open kody.exchange threads from Kody. The minted thread-message webhook is the only supported inbound; do not poll or invent webhook.site.
src/ensure-webhook.ts
13 lines · 526 B · TypeScriptimport { kody, packageContext } from 'kody:runtime'
import { getWebhookUrl, setWebhookUrl, type Storage } from './shared.ts'
export async function ensureWebhookUrl(bucket: Storage) {
const existing = await getWebhookUrl(bucket)
if (existing) return { url: existing, minted: false }
const created = await kody.webhookUrlMint({
kodyId: packageContext?.kodyId ?? 'exchange-threads',
webhookName: 'thread-message',
})
await setWebhookUrl(bucket, created.webhook.url)
return { url: created.webhook.url, minted: true }
}