在 Day 6 我們以複製/貼上神技喚醒了妹妹彌豆子,本篇延續 Google Apps Script(GAS) 服務設定定時觸發,讓彌豆子妹妹先養成規律生活,別像雷姆又要躺一季!!系列文後續會移駕至 Python 及入住 Heroku 別墅,本篇接著設定GAS的定時傳送通知吧!
延續Day 6的程式碼,在GAS完成後續設定:
程式碼:
function doPost() {
UrlFetchApp.fetch('https://notify-api.line.me/api/notify', {
'headers': {
'Authorization': 'Bearer ' + '你的權杖',
},
'method': 'post',
'payload': {
'message':'歐逆醬早安!!!',
'stickerPackageId': '2',
'stickerId': '523'
}
});
}
選擇發布-佈署為網頁應用程式
每次修正時重新發布的3個選項
點選編輯-現有專案啟動程序,將另開視窗
點選右下方新增觸發條件
設定屬於自己的觸發條件,這邊自己是設定每日一次
設定完成,本來彌豆子需要你主動喚醒,現在換妹妹來喚醒你了!
我們的程式碼包含了驗證用的權杖、訊息、貼圖,其格式都規定好在官方文件,在後續系列文章將回歸以Python做介紹跟添加功能,我們下篇見!
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing