@msgmorph/better-auth-plugin
v0.1.6
Published
Better Auth plugin for MsgMorph - auto-creates contacts on user signup
Maintainers
Readme
@msgmorph/better-auth-plugin
Better Auth plugin for MsgMorph. Automatically creates contacts when users sign up.
Installation
npm install @msgmorph/better-auth-pluginSetup
Add the plugin to your Better Auth configuration:
// auth.ts
import { betterAuth } from "better-auth";
import { msgMorphPlugin } from "@msgmorph/better-auth-plugin";
export const auth = betterAuth({
// ... your config
plugins: [
msgMorphPlugin({
apiKey: process.env.MSGMORPH_API_KEY!,
organizationId: process.env.MSGMORPH_ORGANIZATION_ID!,
projectId: process.env.MSGMORPH_PROJECT_ID!,
}),
],
});Configuration
| Option | Type | Required | Description |
| ---------------- | -------- | -------- | -------------------------------- |
| apiKey | string | Yes | Your MsgMorph API key |
| organizationId | string | Yes | Your MsgMorph organization ID |
| projectId | string | Yes | Project ID to create contacts in |
Environment Variables
MSGMORPH_API_KEY=your-api-key
MSGMORPH_ORGANIZATION_ID=your-org-id
MSGMORPH_PROJECT_ID=your-project-idHow It Works
The plugin hooks into Better Auth's signup flow:
- User signs up via email or OAuth
- After successful signup, plugin creates a contact in MsgMorph
- Contact is linked via
externalId(user's auth ID)
Documentation
For more docs, check docs.msgmorph.com.
License
MIT
