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
send({ | |
text: 'Hello World!', | |
to: '01000000000', | |
from: '01000000000' | |
}) | |
async function send (message, agent = {}) { | |
try { | |
console.log(await Group.sendSimpleMessage(message, agent)) | |
} catch (e) { | |
console.log(e) |
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
send({ | |
text: 'Hello World!', | |
to: '01000000000', | |
from: '01000000000' | |
}, { | |
/* 이 부분을 추가해주세요! */ | |
agent: { appId: 'vTL0qHdlXXXp' } | |
}) | |
async function send (message, agent = {}) { | |
try { |
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 express = require('express') | |
const app = express() | |
app.listen(8080, () => { | |
console.log('Server is running on port : 8080') | |
}) |
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
<!doctype html> | |
<html> | |
<head> | |
<title>솔라피 로그인</title> | |
</head> | |
<body> | |
<form action="/login"> | |
<input type="submit" value="솔라피 로그인"> | |
</form> | |
</body> |
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
app.set('view engine', 'ejs') | |
app.get('/', (req, res) => { | |
return res.render('index') | |
}) |
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
app.get('/login', (req, res) => { | |
const uri = `https://api.solapi.net/oauth2/v1/authorize?` + | |
`client_id=CIDPL49TEFPSPLZS&` + | |
`redirect_uri=http://localhost:8080/authorize&` + | |
`response_type=code&` + | |
`scope=message:write&` + | |
`state=ADFN31fmD1fa4` | |
return res.redirect(uri) | |
}) |
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
app.get('/authorize', (req, res) => { | |
}) |
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('request-promise') | |
app.get('/authorize', (req, res) => { | |
const { code } = req.query | |
const result = await request({ | |
method: 'POST', | |
uri: 'https://api.solapi.net/oauth2/v1/access_token', | |
body: { | |
code, | |
grant_type: 'authorization_code', |
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
{ | |
"access_token": "eyGciOiNiIsIkpXVCJ9.eyJ0NTY3ODkwIiwibWRtaW4iOnRydWV9...", | |
"refresh_token": "ciOiJIUzI1NkpXVCJ9.dWIiOiIxMjM0Y3ODIiwibmFtZSIkpv4gR...", | |
"scope": [ "message:write" ], | |
"token_type": "Bearer" | |
} |
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 cookieParser = require('cookie-parser') | |
app.use(cookieParser()) |
OlderNewer