agent-skills/skills/email-center/SKILL.md
2026-11-28 15:28:03 +02:00

6.9 KiB


name: email-center description: Send transactional and marketing email from an application through the Interweb Mozambique E-mail Center API: verify a sender domain with DKIM, SPF and DMARC, send one email or a batch, use templates with variables, schedule, follow statuses and webhooks, manage suppressions, contacts and campaigns. Use when the user wants their code or site to send email, set up a sender domain, or check why an email did not arrive.

Interweb Mozambique E-mail Center

Use this skill for email sent by applications (order confirmations, password resets, newsletters). Mailboxes of a hosting plan are in manage-hosting.

Setup

  • API address: https://api.interweb.co.mz/v1. It is fixed for Interweb Mozambique: never ask the user for another address.
  • API key: always read it from the INTERWEB_API_KEY environment variable. Check it without printing it: test -n "$INTERWEB_API_KEY" && echo set || echo missing
  • If it is missing, ask the user to create a key in the API Center (https://www.meu.interweb.co.mz/api-center.php) with email_center:read (and email_center:write to send and change), then to run export INTERWEB_API_KEY="sandbox_..." and restart Claude Code (or the editor).
  • sandbox_ keys read the real account but only simulate writes and never charge. prod_ keys change the account and can charge. GET /v1/token gives the mode in data.mode and the permissions in data.permissions. Suggest a sandbox_ key for a first try.
  • Never print, log or commit the key, and never put it in code that runs in a browser or a mobile app. In code, read it from the environment.

Every request looks like this:

curl -sS "https://api.interweb.co.mz/v1/PATH" -H "Authorization: Bearer $INTERWEB_API_KEY" -H "Accept: application/json"

Rules

  • Before anything that charges, deletes data or cannot be undone, tell the user exactly what will happen (with the price, when the API gives one) and wait for a clear yes.
  • Send an Idempotency-Key header on purchases, sends and other POST requests that accept it, and reuse the same value if you retry the same request: IDEM=$(uuidgen 2>/dev/null || cat /proc/sys/kernel/random/uuid).
  • Lists come in pages: ?page=1&per_page=100, and meta.total_pages says how many there are.
  • Long operations answer 202 with an action_id. Follow them with GET /v1/actions/{action_id} every 10 to 20 seconds until status is done or failed.
  • Answer the user in the language they write in, and show amounts with the currency the API returns.

Before sending

  • E-mail Center must be active on the account. Otherwise the API answers 403 with details.reason email_account_required: the user turns it on in Meu Interweb.
  • The sender must be on a verified domain (or a subdomain of it).

Verify a sender domain

curl -sS -X POST "https://api.interweb.co.mz/v1/email/domains" -H "Authorization: Bearer $INTERWEB_API_KEY" \
  -H "Content-Type: application/json" -H "Idempotency-Key: $IDEM" -d '{"domain": "mybusiness.co.mz"}'
  1. The answer has dns_records: a DKIM TXT (required), SPF TXT and DMARC TXT (recommended).
  2. If the domain uses our DNS, offer to add them with the manage-dns skill. Otherwise show the user the exact records to add where their DNS is.
  3. Then POST /v1/email/domains/{domain}/verify. DNS can take a few hours; found on each record shows progress. When DKIM is live, the domain is verified.
  4. Optional: PUT /v1/email/domains/{domain}/mail-from with a subdomain such as bounce, and add the extra CNAME it returns.

Send an email

curl -sS -X POST "https://api.interweb.co.mz/v1/email/messages" -H "Authorization: Bearer $INTERWEB_API_KEY" \
  -H "Content-Type: application/json" -H "Idempotency-Key: $IDEM" \
  -d '{"from": "My Company <notifications@mybusiness.co.mz>", "to": ["customer@example.org"], "subject": "Your order is ready", "html": "<p>Hello, your order is ready.</p>", "text": "Hello, your order is ready."}'
  • to, cc and bcc take one address, a comma list or an array; at most 50 recipients per email, and each recipient uses one email credit.
  • Templates: template_id plus variables (the template uses placeholders such as {{name}}). Manage them at /v1/email/templates.
  • send_at (ISO 8601 with time zone, for example 2026-12-01T09:00:00+02:00) schedules; cancel with POST /v1/email/messages/{id}/cancel.
  • Batch: POST /v1/email/messages/batch. Attachments: attachments in base64, up to 5 MB in total.
  • With a sandbox_ key nothing is sent and nothing is charged.
  • In application code, read the key from the environment and send from the server side only.

Limits and balance

GET /v1/email/balance shows monthly_limits (emails and different recipients, both reset on the 1st). When one runs out, sending answers 422 with details.limit monthly_emails or monthly_recipients: show the message as it comes. Extra emails: GET /v1/email/credits/prices, then POST /v1/email/credits/purchase (charges credit, ask first).

Delivery problems

  • GET /v1/email/messages/{id} shows the status and events. GET /v1/email/stats gives totals.
  • Suppressed addresses (bounces, complaints, unsubscribes): GET /v1/email/suppressions; remove one with DELETE /v1/email/suppressions/{email} only if the user confirms the person wants mail again.
  • Webhook for events: PUT /v1/email/webhook, test with POST /v1/email/webhook/test.

Marketing

Contacts (/v1/email/contacts), groups, forms and campaigns (/v1/email/campaigns): create a campaign, run GET /v1/email/campaigns/{id}/spam-check, send a test with POST .../test, and only then send or schedule, after the user approves. Only write to people who agreed to receive email.

Errors

Errors look like {"error": {"code", "message", "correlation_id", "details"}}. Act on code, never on the text of message.

HTTP code What to do
401 unauthorized The key is missing, wrong or revoked. Ask the user to check INTERWEB_API_KEY.
402 insufficient_credit Not enough account credit, and nothing was charged. Give the user details.add_funds_url.
403 insufficient_scope The key lacks a permission. Name it and ask for a key that has it.
403 spending_limit_exceeded The purchase goes over the key spending limit. Nothing was charged.
404 not_found Wrong id, or it is not in this account.
409 conflict and others Read details.reason and explain it in plain words.
422 validation_failed Fix the field named in details and try again.
429 rate_limited Wait for the Retry-After seconds, then try once more.
5xx internal_error, upstream_error Try again later. If the user contacts support, give them the correlation_id.

More