콘텐츠로 이동

hono-pages-send-only (Example)

한국어 번역본이 없어 영문 예제 문서를 표시합니다.

Cloudflare Pages Functions + Hono send template with:

  • advanced send route (POST /send) using raw SendInput JSON (single or batch)
  • SMS shortcut route (POST /send/sms)
Terminal window
cd examples/hono-pages-send-only
bun install
  1. Copy .dev.vars.example to .dev.vars.
  2. Fill IWINV provider secrets.
Terminal window
bun run dev
  • POST /send (advanced single/batch)
  • POST /send/sms

For batch requests to POST /send, the route always returns 200. Check per-item success/failure in data.results.

Advanced request body (single, raw SendInput):

{
"type": "SMS",
"to": "01012345678",
"text": "hello from advanced route",
"from": "01000000000",
"providerId": "iwinv"
}

Advanced request body (batch, raw SendInput[]):

[
{
"type": "SMS",
"to": "01012345678",
"text": "hello from advanced route #1",
"from": "01000000000",
"providerId": "iwinv"
},
{
"type": "SMS",
"to": "01012345679",
"text": "hello from advanced route #2",
"from": "01000000000",
"providerId": "iwinv"
}
]

SMS shortcut request body:

{
"to": "01012345678",
"text": "hello",
"from": "01000000000"
}