Skip to main content
POST
/
v1
/
webhooks
Node.js SDK
import Migma from 'migma';

const migma = new Migma('YOUR_API_KEY');

const { data, error } = await migma.webhooks.create({
  url: 'https://yourapp.com/webhooks/migma',
  events: ['email.generation.completed', 'project.import.completed']
});
{
  "success": true,
  "data": {
    "id": "<string>",
    "url": "<string>",
    "events": [
      "<string>"
    ],
    "active": true,
    "description": "<string>",
    "successCount": 123,
    "failureCount": 123,
    "lastTriggeredAt": "2023-11-07T05:31:56Z",
    "createdAt": "2023-11-07T05:31:56Z",
    "updatedAt": "2023-11-07T05:31:56Z",
    "secret": "<string>"
  },
  "error": "<string>"
}

Authorizations

Authorization
string
header
required

API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → API Integration.

Body

application/json
url
string<uri>
required

The webhook endpoint URL (must be HTTPS)

events
string[]
required

Array of event types to subscribe to (e.g., email.generation.completed)

Minimum array length: 1
description
string

Optional description for the webhook

customHeaders
object

Optional custom headers to include in webhook requests

Response

Webhook created

success
boolean
required
data
object
error
string | null