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

  1. login in line notify
  2. click right coner select box and choose person page
  3. scroll down the page and publish token
  4. enter your own token name
  5. choose u whant group name and click publish
  6. copy token and save to other place

apps script

create app script application

  1. login in google
  2. enter https://script.google.com/home
  3. click left coner plus sign to create new project
  4. naming your project name
  5. coding
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    function 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
    }
    });
    }
  6. click right coner deploy icon
  7. choose new deploy
  8. add description…and deploy
  9. Authorize…and allow
  10. copy your application url

Testing

Using js

  1. open chrome console
  2. load jquery
    1
    2
    3
    4
    var jqry = document.createElement('script');
    jqry.src = "https://code.jquery.com/jquery-3.3.1.min.js";
    document.getElementsByTagName('head')[0].appendChild(jqry);
    jQuery.noConflict();
  3. test code
    1
    2
    3
    4
    5
    $.post('your application url',
    {msg:'hello world'},
    function(e){
    console.log(e);
    });
  4. get message on line app

Using python

1
2
3
4
url = 'your application url'
mydata = {'msg' : msg}

request.post(url,data=mydata,verify =False)

reference