Resource-grouped TypeScript SDK for BlueBubbles.
- Primitives and types are generated by Hey API.
- Public client is a thin static wrapper over generated primitives.
- OpenAPI spec is derived from the official BlueBubbles Postman collection.
- Documentation: https://bluebubbles.anmho.com/
npm install @anmho/bluebubbles-sdkimport { BlueBubblesClient } from '@anmho/bluebubbles-sdk';
const client = new BlueBubblesClient({
baseUrl: 'http://localhost:1234',
password: 'your-server-password',
});
const chat = await client.chats.get({ path: { chatGuid: 'iMessage;+;12345' } });
const chats = await client.chats.query(); // optional input
await client.messages.sendText({
body: {
chatGuid: 'iMessage;+;12345',
message: 'hello from sdk',
},
});
const attachment = await client.attachments.download({ path: { guid: 'ATTACHMENT_GUID' } });client.attachments, client.backups, client.chats, client.contacts, client.fcm, client.handles, client.icloud, client.macos, client.messages, client.server, client.web, client.webhooks
import { WEBHOOK_EVENT_TYPES } from '@anmho/bluebubbles-sdk';
await client.webhooks.create({
url: 'https://example.com/webhooks/bluebubbles',
events: [WEBHOOK_EVENT_TYPES.NEW_MESSAGE, WEBHOOK_EVENT_TYPES.UPDATED_MESSAGE],
});
const event = client.webhooks.constructEvent(rawBody);
if (event.type === WEBHOOK_EVENT_TYPES.NEW_MESSAGE) {
console.log(event.data);
}npm run spec:download
npm run generatespec:download (optional spec refresh):
- Downloads the official Postman collection.
- Normalizes unresolved placeholders required by the converter.
- Converts Postman -> OpenAPI (
spec/openapi.yaml).
generate (normal SDK build path):
- Generates Hey API primitives and types to
src/generated.
spec/openapi.yaml is the source of truth for generation.
prepare_postman.ts is only used during spec:download to make Postman conversion reproducible.
From a clean checkout:
npm ci
npm run generate
npm testIf you want to refresh the spec first:
npm run spec:download
npm run generate
npm test- Create a feature branch and make your changes.
- Run local checks before opening a PR:
npm run generate
npm run build
npm test- For any user-facing SDK change, add a changeset:
npm run changesetChoose patch, minor, or major for @anmho/bluebubbles-sdk and include a short summary.
- Commit both your code changes and the generated
.changeset/*.mdfile.
Release flow:
- Merging PRs into
mainupdates or creates a release PR. - Merging the release PR publishes to npm and creates a GitHub Release.
- Merging a normal feature PR into
maindoes not publish by itself. Publish only happens when the generatedchore(release): version packagePR is merged.
Release troubleshooting:
- Merging a normal PR does not publish immediately. Publish happens only after the release PR is merged.
- If no
.changeset/*.mdfile is included in merged PRs, no release PR is created. - The npm Trusted Publisher mapping for
anmho/bluebubbles-sdkandrelease.ymlmust remain configured on npm. - The publish build must be green (
npm run build) in CI.
Use this sequence when your PR includes user-facing SDK changes:
# 1) Make your code/docs change
git checkout -b feat/my-change
# 2) Add release metadata
npm run changeset
# 3) Validate locally
npm run generate
npm run build
npm test
# 4) Commit and open PR
git add .
git commit -m "feat: describe your change"
git pushThe changeset file should look like:
---
"@anmho/bluebubbles-sdk": patch
---
Brief release note for users.After merge to main, automation opens or updates a release PR. Merging that release PR publishes to npm and creates a GitHub Release.
The publish workflow lives in .github/workflows/release.yml and uses npm trusted publishing via GitHub OIDC, not NPM_TOKEN.
spec:downloadgeneratebuildchecktestdocs:sync-openapidocs:devdocs:validate
- Do not hand-edit generated files in
src/generated. - The wrapper keeps BlueBubbles semantics and groups methods by resource.