@msgmorph/ts-sdk
v0.1.4
Published
Official TypeScript SDK for MsgMorph
Downloads
56
Maintainers
Readme
@msgmorph/ts-sdk
Official TypeScript SDK for MsgMorph.
Installation
npm install @msgmorph/ts-sdkUsage
import { MsgMorphClient } from "@msgmorph/ts-sdk";
const client = new MsgMorphClient({
apiKey: process.env.MSGMORPH_API_KEY!,
organizationId: process.env.MSGMORPH_ORGANIZATION_ID!,
});
// Create a contact
const contact = await client.contacts.create({
externalId: "user-123",
email: "[email protected]",
name: "John Doe",
projectId: "proj-456",
});
// List contacts
const contacts = await client.contacts.list({
projectId: "proj-456",
});
// Get a contact
const contact = await client.contacts.get("contact-id");
// Update a contact
const updated = await client.contacts.update("contact-id", {
name: "Jane Doe",
});
// Delete a contact
await client.contacts.delete("contact-id");Environment Variables
MSGMORPH_API_KEY=your-api-key
MSGMORPH_ORGANIZATION_ID=your-org-idError Handling
import { MsgMorphError } from "@msgmorph/ts-sdk";
try {
await client.contacts.create({ ... });
} catch (error) {
if (error instanceof MsgMorphError) {
console.error(error.message, error.statusCode);
}
}Documentation
For more docs, check docs.msgmorph.com.
License
MIT
