WhatsApp消息格式化
规范WhatsApp
UniOne是面向开发者的邮件发送服务,支持每秒3000封邮件的高并发投递。该技能通过Web API实现事务邮件与营销邮件的发送、模板管理、地址验证、投递追踪等功能。
环境准备
# 设置API密钥
export UNIONE_API_KEY="your_api_key_here"
关键前提:域名验证(必须完成)
邮件在域名验证通过前无法送达。按以下步骤操作:
curl -X POST "https://api.unione.io/en/transactional/api/v1/domain/get-dns-records.json?platform=openclaw" \
-H "Content-Type: application/json" \
-H "X-API-KEY: $UNIONE_API_KEY" \
-d '{"domain": "yourdomain.com"}'
curl -X POST "https://api.unione.io/en/transactional/api/v1/domain/validate-verification.json?platform=openclaw" \
-H "Content-Type: application/json" \
-H "X-API-KEY: $UNIONE_API_KEY" \
-d '{"domain": "yourdomain.com"}'
curl -X POST "https://api.unione.io/en/transactional/api/v1/domain/validate-dkim.json?platform=openclaw" \
-H "Content-Type: application/json" \
-H "X-API-KEY: $UNIONE_API_KEY" \
-d '{"domain": "yourdomain.com"}'
DNS生效可能需要48小时,验证失败请检查记录拼写或稍后重试。
发送邮件示例
curl -X POST "https://api.unione.io/en/transactional/api/v1/email/send.json?platform=openclaw" \
-H "Content-Type: application/json" \
-H "X-API-KEY: $UNIONE_API_KEY" \
-d '{
"message": {
"recipients": [{"email": "user@example.com"}],
"body": {"html": "<p>Hello World</p>"},
"subject": "Test Email",
"from_email": "noreply@yourdomain.com"
},
"idempotency_key": "uuid-for-this-send"
}'
重试策略
遇到429/500/502/503/504错误时,按以下间隔重试:立即、1秒、5秒、30秒。每次发送务必携带唯一的idempotency_key,重试时使用相同key避免重复投递。
见下方输入与输出表格。
| 项目 | 内容 |
|---|---|
| 输入 | 收件人邮箱地址、邮件主题、HTML/纯文本内容、发件域名、idempotency_key(幂等键) |
| 输出 | 发送状态、message_id、投递统计、错误代码 |
| 适用人群 | 需要批量发送事务邮件的系统、营销活动邮件推送、邮件投递状态监控场景 |
| 不包含 | SMTP协议接入、邮件客户端UI、联系人列表管理界面、A/B测试功能 |
原始链接:https://github.com/openclaw/skills/tree/main/skills/andythemartketing/unione/SKILL.md
来源类型:GitHub仓库