プログラムからiPhoneに通知を送る簡単な方法(IFTTTアプリを使う)
要点
- プログラム → IFTTTのWebhookサービス → IFTTTのNotificationサービス →
IFTTT iPhoneアプリ
準備
Applet作成
- If
Webhooks
Then Notifications
という構造のAppletを作る。
- Webhooks
- triggerは、Receive a web requestにする。
- EventNameは、たとえば
sample_event
を指定しておく。
- Notifications
- actionは、たとえばSend a notification from the IFTTT
appにする。
- こんな感じのAppletになる。

- AppletのSettingsで、Messageに次のようにingredientをセットしておく

送信テスト


$ curl -X POST -H "Content-Type: application/json" \
-d '{"value1":"Hello!","value2":"Nice!","value3":"Good!"}' \
https://maker.ifttt.com/trigger/sample_event/with/key/xxxxx-xxxxxxxxxxxxxxxxx
- するとiPhoneのIFTTTアプリに通知がやってくる。

- あとはcurlをプログラム中から呼び出すなり、同じようなHTTPS
POSTを発行するなりすればよい。
- たとえばNetlifyのDeploy
Notificationに使うなら、
https://maker.ifttt.com/trigger/sample_event/with/key/xxxxx-xxxxxxxxxxxxxxxxx
のところをそのままWebhook
URLとしてNetlifyに与えればよい。