쿨에스엠에스 문자메시지를 발송하기 위한 기반 코드를 작성해봤습니다.
V2 를 사용합니다.
코드만 제공해드리기 때문에 그 외의 문의는 받지 않습니다.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const request = require('async-request') | |
const uniqid = require('uniqid') | |
const { HmacMD5 } = require('crypto-js') | |
async function send (data) { | |
const res = await request('https://api.coolsms.co.kr/sms/2/send', { | |
method: 'POST', | |
data | |
}) | |
console.log(res) | |
} | |
const apiSecret = 'API_SECRET' | |
const timestamp = (Math.floor(Date.now() / 1000)).toString() | |
const salt = uniqid() | |
const signature = HmacMD5(timestamp + salt, apiSecret).toString() | |
send({ | |
api_key: 'API_KEY', | |
signature, | |
salt, | |
timestamp, | |
to: '수신 번호', | |
from: '발신 번호', | |
text: 'hello' | |
}) |
'IT > 여러가지' 카테고리의 다른 글
마지막 글 작성 (0) | 2020.09.16 |
---|---|
오랜만에 글을 작성해보네요. ㅎㅎ (0) | 2019.09.21 |
2. Docker 이미지 설치 (0) | 2018.04.30 |
1. Docker 설치하기 (0) | 2018.04.30 |
OAuth란? (0) | 2017.12.12 |