Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김영곤
/
LINEBOT
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
강수인
2018-12-07 00:45:27 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9f63dc5090c6da86bea6dc3002f23d89ef299503
9f63dc50
1 parent
7507d95b
파파고 api 설정
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
server.js
server.js
View file @
9f63dc5
...
...
@@ -12,8 +12,9 @@ var bodyParser = require('body-parser');
var
api_url
=
'https://openapi.naver.com/v1/papago/n2mt'
;
// Naver Auth Key
var
client_id
=
'86rKmat0DijccSxKa01P'
;
var
client_secret
=
'rMapNjB8DP'
;
//새로 발급받은 naver papago api id, pw 입력
var
client_id
=
'xZMx34y7uru1v8lywZ2d'
;
var
client_secret
=
'p6L7M7WsH9'
;
// Parse Application JSON
app
.
use
(
bodyParser
.
json
());
...
...
@@ -21,6 +22,9 @@ app.use(bodyParser.json());
// Parse Application/x-www-form-urlencoded
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
// Kakao Keyboard API
app
.
get
(
'/keyboard'
,
function
(
req
,
res
)
{
const
menu
=
{
...
...
@@ -59,15 +63,15 @@ app.post('/message', function(req, res) {
// Message 잘 찍히는지 확인
console
.
log
(
objBody
.
message
.
result
.
translatedText
);
// Kakao Message API
// Kakao Message API
let
massage
=
{
"message"
:
{
// Naver API Translate 결과를 Kakao Message
"text"
:
objBody
.
message
.
result
.
translatedText
"text"
:
objBody
.
message
.
result
.
translatedText
},
};
// Kakao Message API 전송
// Kakao Message API 전송
res
.
set
({
'content-type'
:
'application/json'
}).
send
(
JSON
.
stringify
(
massage
));
...
...
Please
register
or
login
to post a comment