Skip to content

Instantly share code, notes, and snippets.

@chnbohwr
Created January 4, 2017 15:21
Show Gist options
  • Select an option

  • Save chnbohwr/c32e5cbbd00e1bd897ea3986e1bb71d8 to your computer and use it in GitHub Desktop.

Select an option

Save chnbohwr/c32e5cbbd00e1bd897ea3986e1bb71d8 to your computer and use it in GitHub Desktop.
line_notify_example
var request = require('request');
var API_URL = 'https://notify-api.line.me/api/notify';
var token = 'TOKEN'
var message = '今天吃好料的'
var data = {
url: API_URL,
method: 'POST',
json: true,
headers: {
'User-Agent': 'Request-Promise',
'Authorization': `Bearer ${token}`
},
formData: {
message: message
}
}
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log('send success');
} else {
console.log(error);
}
}
request.post(API_URL, data, callback)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment