Qiita Conference 2025

Qiita史上最多!豪華12名のゲストが登壇

特別講演ゲスト(敬称略)

ymrl、成瀬允宣、鹿野壮、伊藤淳一、uhyo、徳丸浩、ミノ駆動、みのるん、桜庭洋之、tenntenn、けんちょん、こにふぁー

24
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

IFTTTのWebhookをGASのPOSTで受け取るときのパラメータ覚書

Last updated at Posted at 2017-12-14

はじめに

ほぼ自分用の覚書

JSONの場合

IFTTTの設定

  • URL: https://script.google.com/macros/s/XXXXXX/exec
  • Method: POST
  • Content Type: application/json
  • Body: {"value1": "moge", "value2": "もげもげ", "value3": "{{TextField}}}

GASの実装

sample.gs
function doPost(e) {
  var jsonString = e.postData.getDataAsString();
  var data = JSON.parse(jsonString);
  var value1 = data.value1; //moge
  var value2 = data.value2; //もげもげ
  var value3 = data.value3; //TextFieldの中身
}

x-www-form-urlencodedの場合

IFTTTの設定

  • URL: https://script.google.com/macros/s/XXXXXX/exec
  • Method: POST
  • Content Type:x-www-form-urlencoded
  • Body: value1=moge&values=hage&values=hoge

GASの実装

sample.gs
function doPost(e) {
  var moge = e.parameters["value1"][0];
  var hage = e.parameters["values"][0];
  var hoge = e.parameters["values"][1];
}

text/plainの場合

IFTTTの設定

  • URL: https://script.google.com/macros/s/XXXXXX/exec
  • Method: POST
  • Content Type:text/plain
  • Body: もげもげ

GASの実装

sample.gs
function doPost(e) {
  var body = e.postData.getDataAsString(); //もげもげ
}
24
24
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
24
24

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?