인증 방식
🔑 API Key
요금
SMS 건당 약 9원, LMS 30원
Base URL
sens.apigw.ntruss.com
태그
SMS, 문자
서비스 소개
SENS(Simple & Easy Notification Service)는 네이버 클라우드의 메시지 발송 서비스입니다. SMS/LMS/MMS 문자, 카카오 알림톡, 푸시 알림(FCM/APNS)을 하나의 API로 통합 지원합니다. 건당 약 9원(SMS)으로 안정적인 발송률을 제공합니다.
🚀 시작하기
- 1
Naver Cloud 가입 및 서비스 신청
console.ncloud.com → Simple & Easy Notification Service → 프로젝트 생성
- 2
발신번호 등록
발신번호 관리 → 발신번호 등록 (본인 인증 필요)
- 3
API Key 발급
Access Key ID와 Secret Key 복사 (계정 관리에서 발급)
- 4
Service ID 확인
SENS 프로젝트의 Service ID 복사
💡 코드 예제
JavaScriptNode.js (HMAC 인증)
import crypto from 'crypto'
const ACCESS_KEY = process.env.NAVER_ACCESS_KEY!
const SECRET_KEY = process.env.NAVER_SECRET_KEY!
const SERVICE_ID = process.env.NAVER_SENS_SERVICE_ID!
function makeSignature(method: string, url: string, timestamp: string) {
const message = `${method} ${url}\n${timestamp}\n${ACCESS_KEY}`
return crypto.createHmac('sha256', SECRET_KEY).update(message).digest('base64')
}
async function sendSMS(to: string, content: string) {
const timestamp = Date.now().toString()
const url = `/sms/v2/services/${SERVICE_ID}/messages`
const res = await fetch(`https://sens.apigw.ntruss.com${url}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-ncp-apigw-timestamp': timestamp,
'x-ncp-iam-access-key': ACCESS_KEY,
'x-ncp-apigw-signature-v2': makeSignature('POST', url, timestamp),
},
body: JSON.stringify({
type: 'SMS',
from: '0212345678', // 등록된 발신번호
content,
messages: [{ to }],
}),
})
return res.json()
}
await sendSMS('01012345678', '인증번호는 123456입니다.')