feat(elevenlabs): add ElevenLabs voice AI integration#935
Open
AdarshJ173 wants to merge 3 commits into
Open
Conversation
Closes RedPlanetHQ#524 - Add ElevenLabs integration scaffold following posthog pattern - Implement API key authentication (xi-api-key header) in account-create.ts - Add axios client factory with proper ElevenLabs auth headers in utils.ts - Sync generation history, voice library, and usage stats in schedule.ts - Expose full integration spec with API key field in index.ts - Add package.json, tsconfig.json, tsup.config.ts matching existing integrations - Add README.md with auth steps, synced data, and dev commands
… to Promise<any> Matches the PostHog integration pattern. IntegrationCLI base class expects Promise<any>, not Promise<unknown>.
…ttern Pins all resolved dependency versions and integrity hashes for @redplanethq/sdk, axios, commander, zod, zod-to-json-schema, tsup, TypeScript 4.9.5, eslint, prettier, and the full dev tree.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR implements the ElevenLabs integration for CORE, resolving issue #524. It follows the exact same architecture and code patterns as the PostHog integration (the canonical reference for new integrations per the issue body). Once merged, CORE users will be able to connect their ElevenLabs account and have their TTS generation history and voice library automatically synced into their workspace timeline.
What changed
integrations/elevenlabs/src/utils.tsElevenLabsConfiginterface ({ api_key: string })getElevenLabsClient()— creates anaxiosinstance withbaseURL: https://api.elevenlabs.ioand thexi-api-keyauth header (exactly how ElevenLabs API expects it)integrations/elevenlabs/src/account-create.tsintegrationCreate()following the posthog patternGET /v1/userto validate the key and retrieve user identityGET /v1/user/subscriptionto capture tieraccounttype withconfig: { api_key }stored for downstream sync useintegrations/elevenlabs/src/schedule.tshandleSchedule()with incremental sync usinglastSyncTimestatesyncHistory()— pollsGET /v1/history(50 items), filters to items since last sync, emits oneactivityper generation (voice name, model, char count, text preview)syncVoices()— pollsGET /v1/voices, filters tocloned/generatedcategory (user-created), emits activities for new additionstry/catchto isolate failures — one failing endpoint does not abort the otherslastSyncTimeafter each runintegrations/elevenlabs/src/index.tsrun()dispatch function handlingSETUP→integrationCreate,SYNC→handleScheduleElevenLabsCLIextendsIntegrationCLIwith correctnameandversiongetSpec()returns integration metadata:name,key,description,icon, andauth.api_keyfield with user-friendly label/placeholder/descriptionintegrations/elevenlabs/package.json@core/posthogstructure exactly: same@redplanethq/sdk@0.1.14,axios,commander,zoddependencies@core/elevenlabs, version0.1.0integrations/elevenlabs/tsconfig.jsontsconfig.json— strict TypeScript withes2022targetintegrations/elevenlabs/tsup.config.tstsup.config.tswithname: 'elevenlabs'integrations/elevenlabs/README.mdAcceptance criteria checklist
integrations/github/src/index.tspatternaccount-create.tsutils.tsfor TTS, voices, historyschedule.tsfor polling generation history and usageREADME.md)integrations/README.md(see Notes)Testing
cd integrations/elevenlabs && pnpm install && pnpm buildnode bin/index.cjs spec— should return JSON withname: 'ElevenLabs'node bin/index.cjs setup --data '{"api_key":"sk_xxx"}'— should return anaccountobjectnode bin/index.cjs sync --config '{"api_key":"sk_xxx"}'— should returnactivityobjects for recent history items and voiceslastSyncTimein state should filter out already-seen itemsstatemessage (no crash)syncVoicesreturns empty array without errorNotes
integrations/README.mdregistration is a one-liner update best done as a follow-up or in a separate PR per the repo's conventions, to keep this diff focusedaxios,@redplanethq/sdk,commander,zod)xi-api-keyheader auth (notBearer) — this is correctly implemented inutils.tsper the ElevenLabs API docs