Created
January 4, 2017 15:21
-
-
Save chnbohwr/c32e5cbbd00e1bd897ea3986e1bb71d8 to your computer and use it in GitHub Desktop.
line_notify_example
This file contains hidden or 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
| 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