Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/meta

src/index.ts

53 lines · 2.1 KB · TypeScript
export * from './accounts.ts'
export * from './core.ts'
export * as instagram from './instagram.ts'
export * as pages from './pages.ts'
export * as whatsapp from './whatsapp.ts'
import { describeMetaAccount } from './accounts.ts'
import { ALL_PRODUCT_SCOPES, buildMetaConnectUrl, GRAPH_API_BASE_URL, setupUrls } from './scopes.ts'
import smokeTest from './smoke-test.ts'

export { smokeTest }
export { default as request } from './request.ts'
export { default as scopes } from './scopes.ts'

/**
 * Package overview plus a read-only Graph smoke test (`GET /me`).
 * @example
 * import meta, { smokeTest } from 'kody:@kody/meta'
 * const overview = await meta()
 * const me = await smokeTest()
 */
export default async function meta() {
	return {
		package: '@kody/meta',
		description:
			'Meta Graph helpers for Facebook Pages, Instagram professional accounts, and WhatsApp Cloud.',
		auth: ['oauth', 'system-user'],
		notApiKey: true,
		notBotToken: true,
		apiBaseUrl: GRAPH_API_BASE_URL,
		defaultAccount: describeMetaAccount(),
		setup: setupUrls(),
		connectUrl: buildMetaConnectUrl(),
		allProductsConnectUrl: buildMetaConnectUrl({ scopes: [...new Set(ALL_PRODUCT_SCOPES)] }),
		safety: [
			'Auth is Facebook Login OAuth via /connect/oauth or a Business system user token — not an API key or bot token.',
			'Pass integration or account to select among meta / meta-* connections.',
			'Mutations (Page publish, Instagram publish, WhatsApp send) require dryRun: true to preview, or confirm: true after explicit user approval.',
			'403 / permission errors name the missing Graph permission and the BYO OAuth connect URL (plus the system user secret URL).',
			'Never hard-code a Page, Instagram, or phone-number id. Discover them from the connected token.',
		],
		exports: {
			accounts: 'kody:@kody/meta/accounts',
			pages: 'kody:@kody/meta/pages',
			instagram: 'kody:@kody/meta/instagram',
			whatsapp: 'kody:@kody/meta/whatsapp',
			core: 'kody:@kody/meta/core',
			request: 'kody:@kody/meta/request',
			scopes: 'kody:@kody/meta/scopes',
			smokeTest: 'kody:@kody/meta/smoke-test',
			types: 'kody:@kody/meta/types',
		},
	}
}