Skip to content

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

Package listing

@kody/linkedin

src/index.ts

81 lines · 2.6 KB · TypeScript
import {
	LINKEDIN_AUTHORIZE_URL,
	LINKEDIN_CALLBACK_URL,
	LINKEDIN_CONNECT_URL,
	LINKEDIN_SCOPES,
	LINKEDIN_TOKEN_URL,
	byoConnectUrl,
} from './request.ts'

export {
	LinkedInApiError,
	createArticlePost,
	createImagePost,
	createPost,
	createTextPost,
	createVideoPost,
	deletePost,
	finalizeVideoUpload,
	getPersonUrn,
	getUserInfo,
	linkedinRequest,
	personUrnFromUserInfo,
	registerImageUpload,
	registerVideoUpload,
	request,
	smokeTest,
	uploadVideoPart,
} from './client.ts'

/**
 * Return LinkedIn package discovery metadata: utilities, auth, and safety notes.
 */
export default async function linkedinOverview() {
	return {
		package: '@kody/linkedin',
		description:
			'Identity, generic requests, and guarded posting through the saved LinkedIn OAuth integration.',
		integration: 'linkedin',
		auth: "createAuthenticatedFetch('linkedin') + LinkedIn-Version / X-Restli-Protocol-Version headers",
		plan: 'B — no usable public LinkedIn OpenAPI; compact request helper',
		callbackUrl: LINKEDIN_CALLBACK_URL,
		connectUrl: LINKEDIN_CONNECT_URL,
		byoConnectUrl: byoConnectUrl(),
		authorizeUrl: LINKEDIN_AUTHORIZE_URL,
		tokenUrl: LINKEDIN_TOKEN_URL,
		scopes: [...LINKEDIN_SCOPES],
		utilities: [
			'smoke-test',
			'get-user-info',
			'get-person-urn',
			'request',
			'create-post',
			'create-text-post',
			'create-article-post',
			'delete-post',
			'register-image-upload',
			'create-image-post',
			'register-video-upload',
			'upload-video-part',
			'finalize-video-upload',
			'create-video-post',
		],
		importPattern: "import utility from 'kody:@kody/linkedin/<utility-name>'",
		paramsNote: 'When importing from Kody execute, pass utility input as the function argument.',
		reconnectUrl: LINKEDIN_CONNECT_URL,
		scopeNotes: {
			identity: 'openid profile email via Sign In with LinkedIn using OpenID Connect',
			posting: 'w_member_social via Share on LinkedIn',
			refresh:
				'No linkedinRefreshToken is currently saved; LinkedIn programmatic refresh tokens require approved partner access.',
		},
		videoFlow:
			'register-video-upload -> upload-video-part for each uploadInstruction -> finalize-video-upload -> create-video-post',
		articleFlow:
			'create-article-post -> initialize image upload -> upload thumbnail bytes -> publish explicit title, description, and image URN',
		postApi:
			'create-* helpers publish through POST https://api.linkedin.com/rest/posts with Linkedin-Version 202602.',
		safety: 'Posting and upload helpers require params.confirm = true unless params.dryRun = true.',
		identity: 'Resolved from /v2/userinfo. Do not hard-code a person URN.',
	}
}