In v1 the bot exposed 5 typed WhatsApp sub-APIs: bot.groups,
bot.profile, bot.privacy, bot.chats, bot.presence. In v2 these
were removed from the core: @botmesh/core is transport-agnostic, and
group/privacy/profile management is WhatsApp-specific — it doesn’t exist on
Telegram or Discord in the same shape.
For everything else — creating groups, invite links, privacy settings,
chat archive/pin/mute — reach through the Baileys provider to the raw
socket. provider.socket returns it typed unknown (Baileys’ types are not
part of the @botmesh/baileys API); socketOf(provider) from
@botmesh/baileys/internal returns it typed as the Baileys socket of the
installed release (no semver guarantee). Importing /internal pulls in
Baileys’ .d.ts files, which do not compile with skipLibCheck: false:
keep "skipLibCheck": true in a project that uses it (the main entry does
not need it):
import { Bot } from '@botmesh/core'import { BaileysProvider } from '@botmesh/baileys'import { socketOf } from '@botmesh/baileys/internal'const provider = new BaileysProvider({ session: 'my-bot' })const bot = new Bot({ provider })bot.on('ready', async () => { const sock = socketOf(provider) // the raw Baileys 7 socket, typed if (!sock) return // v1 bot.groups.create(...) equivalent: const group = await sock.groupCreate('My group', ['573001234567@s.whatsapp.net']) // v1 bot.profile.setName(...): await sock.updateProfileName('My Bot') // v1 bot.privacy.setLastSeen(...): await sock.updateLastSeenPrivacy('all') // v1 bot.groups.inviteLink(...): const code = await sock.groupInviteCode(group.id)})await bot.start()
Transport-specific code stays transport-specificAnything you write against provider.socket only works with
@botmesh/baileys (and only against a real WhatsApp connection — not the
MockProvider used by createTestBot()). Guard it behind
provider.id === 'baileys' if your code may run on other transports.
See the Baileys docs for the
full socket API (groupCreate, groupMetadata, groupParticipantsUpdate,
updateProfilePicture, chatModify, …).