Skip to main content
OpenClaw (formerly ClawdBot) is an open-source AI agent that automates tasks through messaging apps like WhatsApp, Telegram, and Discord. Connect it to Migma and you can send professional emails from a single chat command — no coding, no ESP dashboard. This guide takes seconds.

1. Create a Migma API Key

1

Log in to Migma

Go to migma.ai and sign in to your account.
2

Open API Settings

Navigate to Settings → API Integration and click Create API Key.
3

Set Permissions

Name the key (e.g. openclaw) and enable:
  • email:send — send emails
  • domain:read — check your sending domain
  • audience:write — manage contacts (optional)
4

Copy the Key

Copy the key immediately — it starts with mgma_sk_live_ and won’t be shown again.
Store the key in your OpenClaw environment variables. Never paste it directly into a chat message.

2. Set Up a Sending Domain

A managed domain lets you start sending in seconds — no DNS records, no verification wait.
1

Open Sending Domains

In Migma, go to Settings → Sending Domains and click Add Domain.
2

Choose Quick Setup

Select the Quick tab and type a prefix (e.g. yourcompany).Your sending address will be: [email protected]
3

Done — Start Sending

The domain is verified instantly. You can send from any address at that domain right away.
Want to send from your own domain (e.g. [email protected])? See Add a Custom Domain for the full DNS setup.

3. Get Your Project ID

A project in Migma represents your brand — it holds your logos, colors, fonts, and brand voice. Every email you send is tied to a project so Migma knows which brand identity to use. Grab your project ID with one call:
cURL
curl https://api.migma.ai/v1/projects \
  -H "Authorization: Bearer mgma_sk_live_your_key_here"
The response lists your projects — copy the id of the brand you want to send from.

4. Send Your First Email

Add your credentials to OpenClaw’s environment:
.env
MIGMA_API_KEY=mgma_sk_live_your_key_here
MIGMA_PROJECT_ID=your_project_id_here
Then send an email:
cURL
curl -X POST https://api.migma.ai/v1/sending \
  -H "Authorization: Bearer $MIGMA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "recipientType": "email",
    "recipientEmail": "[email protected]",
    "from": "[email protected]",
    "fromName": "Your Company",
    "subject": "Hello from OpenClaw",
    "template": "<h1>Hi there!</h1><p>This email was sent from OpenClaw via Migma.</p>",
    "providerType": "migma",
    "projectId": "YOUR_PROJECT_ID"
  }'
JavaScript
const response = await fetch('https://api.migma.ai/v1/sending', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.MIGMA_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    recipientType: 'email',
    recipientEmail: '[email protected]',
    from: '[email protected]',
    fromName: 'Your Company',
    subject: 'Hello from OpenClaw',
    template: '<h1>Hi there!</h1><p>This email was sent from OpenClaw via Migma.</p>',
    providerType: 'migma',
    projectId: process.env.MIGMA_PROJECT_ID
  })
});
Python
import requests
import os

response = requests.post(
    'https://api.migma.ai/v1/sending',
    headers={
        'Authorization': f'Bearer {os.environ["MIGMA_API_KEY"]}',
        'Content-Type': 'application/json'
    },
    json={
        'recipientType': 'email',
        'recipientEmail': '[email protected]',
        'from': '[email protected]',
        'fromName': 'Your Company',
        'subject': 'Hello from OpenClaw',
        'template': '<h1>Hi there!</h1><p>This email was sent from OpenClaw via Migma.</p>',
        'providerType': 'migma',
        'projectId': os.environ['MIGMA_PROJECT_ID']
    }
)
Required fields:
FieldDescription
recipientType"email" for single send, "tag" or "audience" for bulk
recipientEmailRecipient address (for single sends)
fromSender address (must be from a verified domain)
fromNameSender display name
subjectEmail subject line
templateHTML body of the email
providerType"migma" for managed domains, or "ses", "resend", "sendgrid"
projectIdYour Migma project ID

5. Go Further

Once you’re connected, you can tell OpenClaw to do more with the Migma API:
Use two API calls:
  1. POST /v1/projects/emails/generate — generate an on-brand email from a prompt
  2. Poll GET /v1/projects/emails/{conversationId}/status until it’s ready
  3. Export the HTML with GET /v1/export/html/{conversationId}
  4. Send it with POST /v1/sending
This lets OpenClaw create and send professional emails from a single chat message like “Create a summer sale email and send it to [email protected].
Change recipientType to "tag" or "audience" and provide a recipientId:
{
  "recipientType": "tag",
  "recipientId": "tag_id_here",
  "from": "[email protected]",
  "fromName": "Your Company",
  "subject": "Monthly Newsletter",
  "template": "<h1>Newsletter</h1>...",
  "providerType": "migma",
  "projectId": "YOUR_PROJECT_ID"
}
Batch sends are queued automatically. Check status with GET /v1/sending/batches/{batchId}.
Set up webhooks so OpenClaw gets notified when emails are opened, clicked, or bounced — and can take action automatically.

Need Help?