Line notify with Apps script
Summary
This article will teach u how to crate a apps script application.
This application will send message to your line using line notify service.
line notify
create line notify token
- login in line notify
- click right coner select box and choose person page
- scroll down the page and publish token
- enter your own token name
- choose u whant group name and click publish
- copy token and save to other place
apps script
create app script application
- login in google
- enter https://script.google.com/home
- click left coner plus sign to create new project
- naming your project name
- coding
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15function doPost(e) {
var token = 'xxxxxxx';
var param = e.parameter;
var msg = param.msg;
UrlFetchApp.fetch('https://notify-api.line.me/api/notify', {
'headers': {
'Authorization': 'Bearer ' + token,
},
'method': 'post',
'payload': {
'message':msg
}
});
} - click right coner deploy icon
- choose new deploy
- add description…and deploy
- Authorize…and allow
- copy your application url
Testing
Using js
- open chrome console
- load jquery
1
2
3
4var jqry = document.createElement('script');
jqry.src = "https://code.jquery.com/jquery-3.3.1.min.js";
document.getElementsByTagName('head')[0].appendChild(jqry);
jQuery.noConflict(); - test code
1
2
3
4
5$.post('your application url',
{msg:'hello world'},
function(e){
console.log(e);
}); - get message on line app
Using python
1 | url = 'your application url' |
reference
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Comment