@kody/producthunt
Read today's Product Hunt posts, lookups, and comments through the saved Product Hunt OAuth integration.
Files
@kody/producthunt — agent notes
Human setup and intent live in README.md. This file is for
agents: imports, smoke/dryRun execute snippets, and edge cases. Secrets by
name only — never paste key values. Do not disable live webhooks or jobs.
Auth
| Lane | Credential | Notes |
|---|---|---|
| A (recommended) | Integration producthunt (or producthunt-<purpose>) | BYO confidential OAuth. Host api.producthunt.com. |
| B | User secret producthuntAccessToken | Developer / access token Bearer. |
Every export accepts account, integrationName / integration,
secretName, and auth: "oauth" | "token" when both exist.
account: "work" → producthunt-work /
producthuntAccessToken-work. Optional secret name for the client secret:
producthuntClientSecret. GraphQL:
https://api.producthunt.com/v2/api/graphql. Placeholders:
{{secret:producthuntAccessToken|scope=user}}. Do not hard-code a hunter
username or post slug.
Import paths
| Export | Import |
|---|---|
| overview / action dispatcher | kody:@kody/producthunt |
| accounts | kody:@kody/producthunt/accounts |
| smoke-test | kody:@kody/producthunt/smoke-test |
| guide | kody:@kody/producthunt/guide |
| list-today-posts | kody:@kody/producthunt/list-today-posts |
| list-posts | kody:@kody/producthunt/list-posts |
| get-post | kody:@kody/producthunt/get-post |
| list-comments | kody:@kody/producthunt/list-comments |
| get-user | kody:@kody/producthunt/get-user |
| get-viewer | kody:@kody/producthunt/get-viewer |
| get-topic | kody:@kody/producthunt/get-topic |
| list-topics | kody:@kody/producthunt/list-topics |
| get-collection | kody:@kody/producthunt/get-collection |
| list-collections | kody:@kody/producthunt/list-collections |
| request (escape hatch) | kody:@kody/producthunt/request |
| types | kody:@kody/producthunt/types |
Prefer static kody:@kody/producthunt/... imports from execute. Do not lead
with packages.invoke. Page sizes are clamped to 1–20.
Smoke test (read-only)
import smokeTest from 'kody:@kody/producthunt/smoke-test'
export default async function main() {
return await smokeTest()
// without creds => { ok: true, live: false, setup: { ...URLs } }
// with creds => { live: true, hasViewer, todayPostCount } (no hunter PII)
}Or through the root export:
import producthunt from 'kody:@kody/producthunt'
export default async function main() {
return await producthunt({ action: 'smoke-test' })
}Common snippets
import listTodayPosts from 'kody:@kody/producthunt/list-today-posts'
export default async function main() {
return await listTodayPosts({ first: 5 })
}import getPost from 'kody:@kody/producthunt/get-post'
import listComments from 'kody:@kody/producthunt/list-comments'
export default async function main() {
const post = await getPost({ slug: 'some-product-slug' })
const comments = await listComments({ slug: post.slug, first: 10 })
return { post, comments }
}dryRun / confirm (writes)
Public schema mutations are goals and follow/unfollow — not comments.
./request treats query documents as read-only. Mutation documents need
confirm: true. Pass dryRun: true to inspect the payload:
import request from 'kody:@kody/producthunt/request'
export default async function main() {
return await request({
query: `mutation FollowUser($userId: ID!) { userFollow(input: { userId: $userId }) { user { id } } }`,
variables: { userId: 'user-id-from-caller' },
dryRun: true,
})
}Edge cases / troubleshooting
- Connect page asks for authorize/token URLs → use the full first-time URL in README Lane A
- HTTP 401 / expired token → reconnect
https://kody.codes/connect/oauth?provider=producthunt viewer.userempty → reconnect withprivatescope- Mutation
FORBIDDEN→ Product Hunt must approvewrite, then reconnect redirect_urimismatch → app redirect must be exactlyhttps://kody.codes/connect/oauth