5
Do you remember we have mentioned IFTTT in Android Skill? Automate repetitive things can make life more convenient.
This article shows the publication of the article to the promotion process.
還記得Android小技巧提到的IFTTT嗎?自動化重複的事可以為生活帶來便利,這篇來說明整個部落格發文到推廣的流程。
Self-produced
IG: Shvara uploads cute panda pictures.
Blog: Lunski use MacDown and deploy articles to Github by Hexo.
Pixnet: Lunski write articles on Pixnet.
Direct delivery
The first thing we need to know, IFTTT「if this then that」 is a web service. Like Observer Pattern in design patterns, there will feedback when the conditions were met.
There is a similar service, Zapier. I use it in those way:
首先要先知道 IFTTT「if this then that」是一個網路服務,像監聽者模式,在條件觸發時產生反饋,同類型的服務還有 Zapier,我用的場域有:
IFTTT
When I wrote “holiday” in Google Calendar, my phone will open do not disturb mode, then I will not be awakened. link
When I post articles github, pixnet RSS changed, it will transfer my articles to Telegram: Lunski’s Circle.
When Pixnet RSS Changed, it will will transfer my articles to Twitter.
When Shvara add pictures in IG, it will transfer to Telegram: Lunski’s Circle. link
當在Google日曆寫上放假,當天手機自動啟動勿擾模式,避免被吵醒 link
當我在這邊發文RSS變動會自動發到Telegram: Lunski的小圈圈 link
當Shvara在IG發文自動導到Telegram: Lunski的小圈圈 link
Zapier
When I post articles github, pixnet, RSS changed, it will transfer my articles to FB: Lunski’s Circle.
當我在這邊發文RSS變動會自動發到 FB: Lunski的小圈圈 link
Cloudflare CDN
1 | npm install -g hexo; hexo clean; hexo generate |
https://eric999j-github-io.pages.dev/
Self-monitoring
After APPs Script setting, it will check website’s HTTP status code is 200 OK periodically, if it isn’t 200, there is a message in Line Notify chat room.
透過APPs Script設定,週期確認小圈圈網站有回200 ok,有異常會在Line Notify聊天室通知
Self-selling
Telegram: Lunski’s Circle
FB:Lunski’s Circle
LinkTree: Lunski
LinkTree
A hightlght of my blog system, just like Facade Pattern.
Shvara Bot
- robotShvara
- A bot in Telegram, it has those instructions.
- When bot in a chanel or group only provides:
- hi: reply “hi”
- shvara: Randomly speak a Japanese sentence of Shvara on each call.
Shvara API
ShvaraAPI : Source code of /shvara instruction, deployed on Vercel.
Kanji to Hiragana function
To know kanji’s hiragana is helpful for Japanese learner, so we made it!
Dockerize
The backend of this bot is execute $ node bot.js
in a linux system. However, if we didn’t do dockerize, we will forgot how to setup the environment next time. So I decide to dockerize it.
All depedency wrote in a dockerfile. Generally, we need to upload this file to DockerHub, and host in Heroku, but it contains some private information, so I put in private Github repository. If I have approate linux environment, I can pull and execute $ docker run node-docker
to build to docker image.
這個Bot後端是在一個linux系統下$ node bot.js
,可是所有相依都要在電腦裝好,下次也會忘記怎麼設定,所以我決定把這個nodejs app包成Docker。
相依套件都寫在dockerfile,一般來說直接上傳DockerHub,host在Heroku會更方便,但專案有機密資訊就改成放private Github repository,有linux環境再抓下來在系統下$ docker run node-docker
build image。
這樣只要有適合環境就能再重現出我們的後端囉。
1 | $ docker build --tag node-docker . |
Chatfuel
Chatfuel is a platform to construct bot in Facebook group easily. Different from Shvara is a panda who loves Japanese. Lunski is a engineer, so I use TechCrunch bot, it’s convenient for me and group users.
Chatfuel是一個Facebook社團方便的機器人建造平台,不同於Shvara是隻愛日文的貓熊,Lunski的定位在工程師,那就串個TechCrunch Headlines自己用著也方便。
結語
All setting are easy, after those setting, Lunski only need to focus on post articles, and Shvara only need to acting cute. Everything looks good, isn’t it?
設定都很簡單,之後我只需要專注在部落格發文,貓熊只需要賣萌就可以了,是不是很方便呢?
如果你覺得這篇文章很棒,請你不吝點讚 (゚∀゚)