kakaoAuth.js
903 Bytes
const request = require('request');
const querystring = require('querystring');
exports.kakaotoken = async (ctx) => {
const token = ctx.request.body;
'http://kapi.kakao.com/v2/api/talk/memo/default/send'
console.log(ctx);
console.log("token setted", token);
let template_objectObj = {
object_type: "text",
text: "hi", link: {
web_url: "https://developers.kakao.com",
}
};
let template_objectStr = JSON.stringify(template_objectObj);
console.log(template_objectStr);
let options = {
url: "http://kapi.kakao.com/v2/api/talk/memo/default/send",
method: "POST",
headers: {
"Authorization": "Bearer ".concat(token),
"Content-Type": "application/x-www-form-urlencoded"
}, form: {
template_object: template_objectStr
}
};
request.post(options, (err, res, body) => {
if (err != null) {
console.log(err);
}
});
};