← 返回
未分类 Key

Sending SMS

Sends SMS messages via the Sendly API with the Node.js SDK or REST API. Handles single messages, batch sends, scheduling, conversations, and sandbox testing....
通过 Sendly API(Node.js SDK 或 REST API)发送短信。支持单条消息、批量发送、定时发送、会话及沙箱测试。
sendly-live sendly-live 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 264
下载
💾 0
安装
1
版本
#latest

概述

Sending SMS with Sendly

Quick start

import Sendly from "@sendly/node";

const sendly = new Sendly(process.env.SENDLY_API_KEY!);

const message = await sendly.messages.send({
  to: "+15551234567",
  text: "Your order has shipped!",
  messageType: "transactional",
});

Authentication

All requests require a Bearer token. Store the API key in SENDLY_API_KEY env var.

  • sk_test_* keys → sandbox mode (no real SMS sent, no credits charged)
  • sk_live_* keys → production (real SMS on verified numbers)

REST API

Base URL: https://sendly.live/api/v1

Send a message

curl -X POST https://sendly.live/api/v1/messages \
  -H "Authorization: Bearer $SENDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "+15551234567", "text": "Hello!", "messageType": "transactional"}'

Required fields: to (E.164 format), text, messageType (transactional or marketing)

Optional fields: metadata (object, max 4KB), from (sender ID)

Response shape

{
  "id": "msg_abc123",
  "to": "+15551234567",
  "text": "Hello!",
  "status": "sent",
  "segments": 1,
  "creditsUsed": 2,
  "createdAt": "2026-03-31T10:00:00Z"
}

Schedule a message

curl -X POST https://sendly.live/api/v1/messages/schedule \
  -H "Authorization: Bearer $SENDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"to": "+15551234567", "text": "Reminder!", "messageType": "transactional", "scheduledAt": "2026-04-01T14:00:00Z"}'

Schedule window: 5 minutes to 5 days in the future.

Batch send

curl -X POST https://sendly.live/api/v1/messages/batch \
  -H "Authorization: Bearer $SENDLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"messages": [{"to": "+15551234567", "text": "Hello"}, {"to": "+15559876543", "text": "Hi"}], "messageType": "transactional"}'

Up to 10,000 recipients per batch.

List messages

curl "https://sendly.live/api/v1/messages?limit=50" \
  -H "Authorization: Bearer $SENDLY_API_KEY"

Supports limit, offset, status, q (full-text search).

Node.js SDK

npm install @sendly/node
import Sendly from "@sendly/node";

const sendly = new Sendly(process.env.SENDLY_API_KEY!);

const msg = await sendly.messages.send({ to: "+15551234567", text: "Hello!", messageType: "transactional" });
const scheduled = await sendly.messages.schedule({ to: "+15551234567", text: "Later!", messageType: "transactional", scheduledAt: "2026-04-01T14:00:00Z" });
const batch = await sendly.messages.batch({ messages: [{to: "+15551234567", text: "Hi"}], messageType: "transactional" });
const list = await sendly.messages.list({ limit: 50 });
const single = await sendly.messages.get("msg_abc123");

Message types

  • transactional: OTP codes, order confirmations, appointment reminders, account alerts. Allowed 24/7.
  • marketing: Promotions, sales, newsletters. Subject to quiet hours (9pm–8am recipient local time).

Misclassifying marketing as transactional violates TCPA.

Sandbox testing

Use sk_test_* keys with magic phone numbers:

NumberBehavior
------
+15005550000Always succeeds
+15005550001Invalid number error
+15005550002Cannot route error
+15005550006Carrier rejected

Credit costs

  • US/CA: 2 credits per SMS ($0.02)
  • International: varies by country (2–48 credits)
  • 1 credit = $0.01

Conversations API

Messages are automatically threaded into conversations. Use the conversations API for two-way messaging:

const convos = await sendly.conversations.list({ status: "active", limit: 20 });
const replies = await sendly.conversations.suggestReplies("conv_abc123");

Full reference

  • API docs: https://sendly.live/docs/sms
  • SDK docs: https://sendly.live/docs/sdks
  • OpenAPI spec: https://sendly.live/openapi.yaml
  • Sandbox docs: https://sendly.live/docs/sandbox

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 20:43 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

SMS Best Practices

sendly-live
提供Sendly API的短信合规、格式及投递最佳实践,涵盖TCPA合规、静默时段、退订处理以及E.164电话格式。
★ 0 📥 384
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,099 📥 827,485
ai-agent

Find Skills

guipi888
场景驱动+关键词双模式技能发现工具。当用户用自然语言描述场景/需求(如"我想做一个海报""帮我分析股票"),或明确说"安装技能/find skills/找个skill"时,自动从官方内置、本地已安装、SkillHub、虾评、GitHub、C
★ 1,463 📥 528,472