EngageLab SMS API Skill
This skill enables you to interact with the EngageLab SMS REST API. It covers three areas:
- 1. Send SMS — Send notification or marketing SMS to one or more recipients
- Template Management — Create, read, update, and delete SMS templates
- Signature (Sender ID) Management — Create, read, update, and delete sender ID signatures
Resources
scripts/
- -
sms_client.py — Python client class (EngageLabSMS) wrapping all API endpoints: send_sms() (immediate and scheduled), template CRUD (list_templates(), get_template(), create_template(), update_template(), delete_template()), and signature CRUD (list_signatures(), get_signature(), create_signature(), update_signature(), delete_signature()). Handles authentication, request construction, and typed error handling. Use as a ready-to-run helper or import into the user's project.
references/
- -
template-and-signature-api.md — Full request/response field specs for all template and signature endpoints error-codes.md — Complete error code tables for SMS sending and template/signature operations
Authentication
All EngageLab SMS API calls use HTTP Basic Authentication.
- - Base URL: INLINECODE15
- Header: INLINECODE16
- Content-Type: INLINECODE17
The user must provide their dev_key and dev_secret (also called apikey and apisecret). Encode them as base64("dev_key:dev_secret") and set the Authorization header.
Example (using curl):
CODEBLOCK0
If the user hasn't provided credentials, ask them for their dev_key and dev_secret before generating API calls.
Quick Reference — All Endpoints
| Operation | Method | Path |
|---|
| Send SMS | INLINECODE26 | INLINECODE27 |
| List templates |
GET |
/v1/template-configs |
| Get template |
GET |
/v1/template-configs/:templateId |
| Create template |
POST |
/v1/template-configs |
| Update template |
PUT |
/v1/template-configs/:templateId |
| Delete template |
DELETE |
/v1/template-configs/:templateId |
| List signatures |
GET |
/v1/sign-configs |
| Get signature |
GET |
/v1/sign-configs/:signId |
| Create signature |
POST |
/v1/sign-configs |
| Update signature |
PUT |
/v1/sign-configs/:signId |
| Delete signature |
DELETE |
/v1/sign-configs/:signId |
Sending SMS
Endpoint: INLINECODE48
Request Body
CODEBLOCK1
Parameters
| Field | Type | Required | Description |
|---|
| INLINECODE49 | INLINECODE50 | Yes | Target phone numbers (include country code) |
| INLINECODE51 |
string | Yes | ID of an approved SMS template |
|
template.params |
object | Yes | Key-value pairs matching template variables (e.g.,
{{name}} →
{"name": "Bob"}) |
|
plan_name |
string | No | Plan name, defaults to
"-" |
|
schedule_time |
integer | No | Unix timestamp for scheduled sends; omit for immediate |
|
custom_args |
object | No | Custom parameters for tracking |
Template Variables
If the template contains {{var}} placeholders, populate them via params. For example, for template content "Hi {{name}}, your code is {{code}}", pass:
CODEBLOCK2
Unpopulated variables are sent literally as {{var}}.
Response
Success (single target):
CODEBLOCK3
Success (scheduled):
CODEBLOCK4
Error: Contains code (non-zero) and message fields alongside plan_id.
For the full error code table, read references/error-codes.md.
Template Management
Templates define the SMS content. Each template must pass review before it can be used for sending.
For full request/response details and field descriptions, read references/template-and-signature-api.md.
Key Rules
- - Template content cannot contain:
【, 】, 、, 测试, test, [, INLINECODE79 - After creation or update, templates enter Pending Review status (status=1) and cannot be used until Approved (status=2)
- Templates in Pending Review cannot be updated
- Templates tied to pending/running message plans cannot be updated or deleted
- Template types:
utility (notification), marketing (marketing)
CRUD Summary
Create — INLINECODE82
CODEBLOCK5
List all — GET /v1/template-configs (returns array)
Get one — INLINECODE84
Update — PUT /v1/template-configs/:templateId (same body as create, all fields required)
Delete — INLINECODE86
Signature (Sender ID) Management
Signatures identify the sender and are attached to templates. They also go through a review process.
For full request/response details and field descriptions, read references/template-and-signature-api.md.
Key Rules
- - Signature name: 2–60 characters, cannot contain
【, 】, [, INLINECODE91 - Names must be unique within the same business
- After creation or update, signatures enter Pending Review (status=1)
- Signatures in Pending Review cannot be updated
- Signatures tied to pending/running plans cannot be updated or deleted
CRUD Summary
Create — INLINECODE92
CODEBLOCK6
List all — GET /v1/sign-configs (returns array)
Get one — INLINECODE94
Update — PUT /v1/sign-configs/:signId (same body as create)
Delete — INLINECODE96
Generating Code
When the user asks to send SMS or manage templates/signatures, generate working code. Default to curl unless the user specifies a language. Supported patterns:
- - curl — Shell commands with proper auth header
- Python — Using
requests library - Node.js — Using
fetch or INLINECODE100 - Java — Using INLINECODE101
- Go — Using INLINECODE102
Always include the authentication header and proper error handling. Use placeholder values like YOUR_DEV_KEY and YOUR_DEV_SECRET if the user hasn't provided credentials.
Status Codes Reference
| Value | Template/Signature Status |
|---|
| 1 | Pending Review |
| 2 |
Approved |
| 3 | Rejected |
| Value | Signature Position |
|---|
| 0 | No Signature |
| 1 |
Prefix |
| 2 | Suffix |
| Value | Template Type |
|---|
| INLINECODE105 | Notification |
| INLINECODE106 |
Marketing |
EngageLab短信API技能
本技能使您能够与EngageLab短信REST API进行交互。涵盖三个领域:
- 1. 发送短信 — 向一个或多个收件人发送通知或营销短信
- 模板管理 — 创建、读取、更新和删除短信模板
- 签名(发送者ID)管理 — 创建、读取、更新和删除发送者ID签名
资源
scripts/
- - smsclient.py — Python客户端类(EngageLabSMS),封装所有API端点:sendsms()(即时和定时发送)、模板CRUD(listtemplates()、gettemplate()、createtemplate()、updatetemplate()、deletetemplate())和签名CRUD(listsignatures()、getsignature()、createsignature()、updatesignature()、deletesignature())。处理认证、请求构建和类型化错误处理。可作为即用型助手或导入到用户项目中。
references/
- - template-and-signature-api.md — 所有模板和签名端点的完整请求/响应字段规范
- error-codes.md — 短信发送和模板/签名操作的完整错误代码表
认证
所有EngageLab短信API调用使用HTTP基本认证。
- - 基础URL:https://smsapi.engagelab.com
- 请求头:Authorization: Basic key:devsecret)>
- 内容类型:application/json
用户必须提供其devkey和devsecret(也称为apikey和apisecret)。将其编码为base64(devkey:devsecret)并设置Authorization请求头。
示例(使用curl):
bash
curl -X POST https://smsapi.engagelab.com/v1/messages \
-H Content-Type: application/json \
-H Authorization: Basic $(echo -n YOURDEVKEY:YOURDEVSECRET | base64) \
-d { ... }
如果用户未提供凭据,请在生成API调用前询问其devkey和devsecret。
快速参考 — 所有端点
| 操作 | 方法 | 路径 |
|---|
| 发送短信 | POST | /v1/messages |
| 列出模板 |
GET | /v1/template-configs |
| 获取模板 | GET | /v1/template-configs/:templateId |
| 创建模板 | POST | /v1/template-configs |
| 更新模板 | PUT | /v1/template-configs/:templateId |
| 删除模板 | DELETE | /v1/template-configs/:templateId |
| 列出签名 | GET | /v1/sign-configs |
| 获取签名 | GET | /v1/sign-configs/:signId |
| 创建签名 | POST | /v1/sign-configs |
| 更新签名 | PUT | /v1/sign-configs/:signId |
| 删除签名 | DELETE | /v1/sign-configs/:signId |
发送短信
端点:POST /v1/messages
请求体
json
{
to: [+6591234567],
template: {
id: TEMPLATE_ID,
params: {
var_name: value
}
},
plan_name: 可选计划名称,
schedule_time: 1700000000,
custom_args: {}
}
参数
| 字段 | 类型 | 必填 | 描述 |
|---|
| to | string[] | 是 | 目标电话号码(包含国家代码) |
| template.id |
string | 是 | 已审批短信模板的ID |
| template.params | object | 是 | 与模板变量匹配的键值对(例如,{{name}} → {name: Bob}) |
| plan_name | string | 否 | 计划名称,默认为- |
| schedule_time | integer | 否 | 定时发送的Unix时间戳;省略则立即发送 |
| custom_args | object | 否 | 用于跟踪的自定义参数 |
模板变量
如果模板包含{{var}}占位符,通过params填充。例如,对于模板内容Hi {{name}}, your code is {{code}},传递:
json
params: { name: Alice, code: 123456 }
未填充的变量将按原样发送为{{var}}。
响应
成功(单个目标):
json
{
plan_id: 1972488990548348928,
total_count: 1,
accepted_count: 1,
message_id: 1972488990804201472
}
成功(定时发送):
json
{
plan_id: 1972492618659033088,
total_count: 1,
accepted_count: 1,
scheduleinfo: { taskid: 1972492621368553472 }
}
错误:包含code(非零)和message字段以及plan_id。
有关完整错误代码表,请阅读references/error-codes.md。
模板管理
模板定义短信内容。每个模板必须通过审核才能用于发送。
有关完整的请求/响应详情和字段描述,请阅读references/template-and-signature-api.md。
关键规则
- - 模板内容不能包含:【、】、、、测试、test、[、]
- 创建或更新后,模板进入待审核状态(status=1),在已批准(status=2)之前不能使用
- 待审核的模板不能更新
- 与待处理/运行中的短信计划关联的模板不能更新或删除
- 模板类型:utility(通知)、marketing(营销)
CRUD摘要
创建 — POST /v1/template-configs
json
{
template_name: 订单通知,
template_type: utility,
templatecontent: 您的订单{orderno}已发货,预计{delivery_time}到达。,
country_codes: CN,US,
add_signature: true,
signid: SIGNATUREID,
sign_position: 2
}
列出所有 — GET /v1/template-configs(返回数组)
获取单个 — GET /v1/template-configs/:templateId
更新 — PUT /v1/template-configs/:templateId(与创建相同的请求体,所有字段必填)
删除 — DELETE /v1/template-configs/:templateId
签名(发送者ID)管理
签名标识发送者并附加到模板。它们也经过审核流程。
有关完整的请求/响应详情和字段描述,请阅读references/template-and-signature-api.md。
关键规则
- - 签名名称:2–60个字符,不能包含【、】、[、]
- 同一业务内名称必须唯一
- 创建或更新后,签名进入待审核状态(status=1)
- 待审核的签名不能更新
- 与待处理/运行中的计划关联的签名不能更新或删除
CRUD摘要
创建 — POST /v1/sign-configs
json
{ sign_name: 我的公司 }
列出所有 — GET /v1/sign-configs(返回数组)
获取单个 — GET /v1/sign-configs/:signId
更新 — PUT /v1/sign-configs/:signId(与创建相同的请求体)
删除 — DELETE /v1/sign-configs/:signId
生成代码
当用户要求发送短信或管理模板/签名时,生成可工作的代码。除非用户指定语言,否则默认使用curl。支持的格式:
- - curl — 带有正确认证请求头的Shell命令
- Python — 使用requests库
- Node.js — 使用fetch或axios
- Java — 使用HttpClient
- Go — 使用net/http
始终包含认证请求头和适当的错误处理。如果用户未提供凭据,使用YOURDEVKEY和YOURDEVSECRET等占位符值。
##