回答編集履歴
5
test
CHANGED
@@ -200,4 +200,12 @@
|
|
200
200
|
|
201
201
|
}
|
202
202
|
|
203
|
+
|
204
|
+
|
205
|
+
function postToSlack(message) {
|
206
|
+
|
207
|
+
...略...
|
208
|
+
|
209
|
+
}
|
210
|
+
|
203
211
|
```
|
4
test
CHANGED
@@ -80,160 +80,124 @@
|
|
80
80
|
|
81
81
|
具体的には、書き込み用のGASでD列にメールアドレスを書き込んだ後、続けて数式が入っているセル(E列~I列まで)を読み取ってSlackに投稿する、という流れです。
|
82
82
|
|
83
|
+
以下のように、**スプレッドシートのA列~D列に書き込む処理の後に、Slack投稿用のコードを継ぎ足してみてはいかがでしょうか**?
|
84
|
+
|
85
|
+
|
86
|
+
|
83
|
-
|
87
|
+
(先頭が「+」となっている行は追加、「-」となっている行は削除)
|
88
|
+
|
89
|
+
```diff
|
90
|
+
|
91
|
+
//送付エラーのタイムスタンプ/件名/本文/メールIDをスプレッドシートに吐き出す
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
function getGmailToSS() {
|
96
|
+
|
97
|
+
const ss = SpreadsheetApp.getActiveSpreadsheet();
|
98
|
+
|
99
|
+
const sheet = ss.getSheetByName('errordata_gmail');
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
const searchlabel = '"送付エラー"';
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
const threads = GmailApp.search('label:(' + searchlabel + ') -label:処理済み');
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
const msgIdArray = sheet.getRange("D:D").getValues().filter(String).flat();
|
112
|
+
|
113
|
+
let lastRow = msgIdArray.length + 1;
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
for (const n in threads) {
|
118
|
+
|
119
|
+
const thread = threads[n];
|
120
|
+
|
121
|
+
const msgs = thread.getMessages();
|
122
|
+
|
123
|
+
msgs
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
for (m in msgs) {
|
128
|
+
|
129
|
+
const msg = msgs[m];
|
130
|
+
|
131
|
+
const id = msg.getId();
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
if (msgIdArray.includes(id)) continue; //IDがD列に既に存在する場合はスルー
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
const msgData = [[msg.getDate(), msg.getSubject(), msg.getPlainBody(), id]];
|
142
|
+
|
143
|
+
sheet.getRange(lastRow, 1, 1, 4).setValues(msgData); //まとめて書き込み
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
+ // スプレッドシートから必要なデータを読み取り、スラックに投稿する。
|
150
|
+
|
151
|
+
+ const staffErrorEmail = sheet.getRange(lastRow, 5).getValue(); //5=E列(送付エラーアドレス)
|
152
|
+
|
153
|
+
+ const staffName = sheet.getRange(lastRow, 6).getValue(); //6=F列(スタッフ名)
|
154
|
+
|
155
|
+
+ const temphireId = sheet.getRange(lastRow, 7).getValue(); //7=G列(ID)
|
156
|
+
|
157
|
+
+ const slackId = sheet.getRange(lastRow, 9).getValue(); //9=I列(SlackID)
|
158
|
+
|
159
|
+
+ const message = slackId + '\n' + staffName + '\n' + staffErrorEmail + temphireId;
|
160
|
+
|
161
|
+
+ postToSlack(message);
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
lastRow++
|
166
|
+
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
const label = GmailApp.getUserLabelByName('処理済み');
|
174
|
+
|
175
|
+
thread.addLabel(label);
|
176
|
+
|
177
|
+
}
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
- // スプレッドシートから必要なデータを読み取り、スラックに投稿する。
|
184
|
+
|
185
|
+
- const staffErrorEmail = sh.getRange(writeRow, 5).getValue(); //5=E列(送付エラーアドレス)
|
186
|
+
|
187
|
+
- const staffName = sh.getRange(writeRow, 6).getValue(); //6=F列(スタッフ名)
|
188
|
+
|
189
|
+
- const temphireId = sh.getRange(writeRow, 7).getValue(); //7=G列(ID)
|
190
|
+
|
191
|
+
- const slackId = sh.getRange(writeRow, 9).getValue(); //9=I列(SlackID)
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
- const message = slackId + '\n' + staffName + '\n' + staffErrorEmail + temphireId;
|
196
|
+
|
197
|
+
- postToSlack(message);
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
}
|
84
202
|
|
85
203
|
```
|
86
|
-
|
87
|
-
function writeMailAddress() {
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
const ss = SpreadsheetApp.openById("書き込み先のスプレッドシートID");
|
92
|
-
|
93
|
-
const sh = ss.getSheetByName("errordata_gmail");
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
// 書き込むメールアドレス
|
98
|
-
|
99
|
-
const mailAddress = "aa@aaa.com";
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
// 書き込み先の行番号(ここでは簡便のため固定値(10)にしているが、forループを使っている場合はその変数に読み替えてもよい)
|
104
|
-
|
105
|
-
const writeRow = 10;
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
// メールアドレスを「writeRow行目、D列」に書き込む
|
110
|
-
|
111
|
-
sh.getRange(writeRow, 4).setValue(mailAddress);
|
112
|
-
|
113
|
-
}
|
114
|
-
|
115
|
-
```
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
これを使ってSlackに投稿したいなら、以下のように、**上記の続きに、Slack投稿用のコードを継ぎ足してみてはいかがでしょうか**?
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
(先頭が「+」となっている行は追加、「-」となっている行は削除)
|
124
|
-
|
125
|
-
```diff
|
126
|
-
|
127
|
-
//送付エラーのタイムスタンプ/件名/本文/メールIDをスプレッドシートに吐き出す
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
function getGmailToSS() {
|
132
|
-
|
133
|
-
const ss = SpreadsheetApp.getActiveSpreadsheet();
|
134
|
-
|
135
|
-
const sheet = ss.getSheetByName('errordata_gmail');
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
const searchlabel = '"送付エラー"';
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
const threads = GmailApp.search('label:(' + searchlabel + ') -label:処理済み');
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
const msgIdArray = sheet.getRange("D:D").getValues().filter(String).flat();
|
148
|
-
|
149
|
-
let lastRow = msgIdArray.length + 1;
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
for (const n in threads) {
|
154
|
-
|
155
|
-
const thread = threads[n];
|
156
|
-
|
157
|
-
const msgs = thread.getMessages();
|
158
|
-
|
159
|
-
msgs
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
for (m in msgs) {
|
164
|
-
|
165
|
-
const msg = msgs[m];
|
166
|
-
|
167
|
-
const id = msg.getId();
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
if (msgIdArray.includes(id)) continue; //IDがD列に既に存在する場合はスルー
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
const msgData = [[msg.getDate(), msg.getSubject(), msg.getPlainBody(), id]];
|
178
|
-
|
179
|
-
sheet.getRange(lastRow, 1, 1, 4).setValues(msgData); //まとめて書き込み
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
+ // スプレッドシートから必要なデータを読み取り、スラックに投稿する。
|
186
|
-
|
187
|
-
+ const staffErrorEmail = sheet.getRange(lastRow, 5).getValue(); //5=E列(送付エラーアドレス)
|
188
|
-
|
189
|
-
+ const staffName = sheet.getRange(lastRow, 6).getValue(); //6=F列(スタッフ名)
|
190
|
-
|
191
|
-
+ const temphireId = sheet.getRange(lastRow, 7).getValue(); //7=G列(ID)
|
192
|
-
|
193
|
-
+ const slackId = sheet.getRange(lastRow, 9).getValue(); //9=I列(SlackID)
|
194
|
-
|
195
|
-
+ const message = slackId + '\n' + staffName + '\n' + staffErrorEmail + temphireId;
|
196
|
-
|
197
|
-
+ postToSlack(message);
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
lastRow++
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
const label = GmailApp.getUserLabelByName('処理済み');
|
210
|
-
|
211
|
-
thread.addLabel(label);
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
- // スプレッドシートから必要なデータを読み取り、スラックに投稿する。
|
220
|
-
|
221
|
-
- const staffErrorEmail = sh.getRange(writeRow, 5).getValue(); //5=E列(送付エラーアドレス)
|
222
|
-
|
223
|
-
- const staffName = sh.getRange(writeRow, 6).getValue(); //6=F列(スタッフ名)
|
224
|
-
|
225
|
-
- const temphireId = sh.getRange(writeRow, 7).getValue(); //7=G列(ID)
|
226
|
-
|
227
|
-
- const slackId = sh.getRange(writeRow, 9).getValue(); //9=I列(SlackID)
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
- const message = slackId + '\n' + staffName + '\n' + staffErrorEmail + temphireId;
|
232
|
-
|
233
|
-
- postToSlack(message);
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
}
|
238
|
-
|
239
|
-
```
|
3
修正
test
CHANGED
@@ -120,96 +120,120 @@
|
|
120
120
|
|
121
121
|
|
122
122
|
|
123
|
-
|
124
|
-
|
125
|
-
f
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
const
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
const s
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
123
|
+
(先頭が「+」となっている行は追加、「-」となっている行は削除)
|
124
|
+
|
125
|
+
```diff
|
126
|
+
|
127
|
+
//送付エラーのタイムスタンプ/件名/本文/メールIDをスプレッドシートに吐き出す
|
128
|
+
|
129
|
+
|
130
|
+
|
131
|
+
function getGmailToSS() {
|
132
|
+
|
133
|
+
const ss = SpreadsheetApp.getActiveSpreadsheet();
|
134
|
+
|
135
|
+
const sheet = ss.getSheetByName('errordata_gmail');
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
const searchlabel = '"送付エラー"';
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
const threads = GmailApp.search('label:(' + searchlabel + ') -label:処理済み');
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
const msgIdArray = sheet.getRange("D:D").getValues().filter(String).flat();
|
148
|
+
|
149
|
+
let lastRow = msgIdArray.length + 1;
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
for (const n in threads) {
|
154
|
+
|
155
|
+
const thread = threads[n];
|
156
|
+
|
157
|
+
const msgs = thread.getMessages();
|
158
|
+
|
159
|
+
msgs
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
for (m in msgs) {
|
164
|
+
|
165
|
+
const msg = msgs[m];
|
166
|
+
|
167
|
+
const id = msg.getId();
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
if (msgIdArray.includes(id)) continue; //IDがD列に既に存在する場合はスルー
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
const msgData = [[msg.getDate(), msg.getSubject(), msg.getPlainBody(), id]];
|
178
|
+
|
179
|
+
sheet.getRange(lastRow, 1, 1, 4).setValues(msgData); //まとめて書き込み
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
+ // スプレッドシートから必要なデータを読み取り、スラックに投稿する。
|
186
|
+
|
187
|
+
+ const staffErrorEmail = sheet.getRange(lastRow, 5).getValue(); //5=E列(送付エラーアドレス)
|
188
|
+
|
189
|
+
+ const staffName = sheet.getRange(lastRow, 6).getValue(); //6=F列(スタッフ名)
|
190
|
+
|
191
|
+
+ const temphireId = sheet.getRange(lastRow, 7).getValue(); //7=G列(ID)
|
192
|
+
|
193
|
+
+ const slackId = sheet.getRange(lastRow, 9).getValue(); //9=I列(SlackID)
|
194
|
+
|
195
|
+
+ const message = slackId + '\n' + staffName + '\n' + staffErrorEmail + temphireId;
|
196
|
+
|
197
|
+
+ postToSlack(message);
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
lastRow++
|
202
|
+
|
203
|
+
}
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
const label = GmailApp.getUserLabelByName('処理済み');
|
210
|
+
|
211
|
+
thread.addLabel(label);
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
- // スプレッドシートから必要なデータを読み取り、スラックに投稿する。
|
220
|
+
|
221
|
+
- const staffErrorEmail = sh.getRange(writeRow, 5).getValue(); //5=E列(送付エラーアドレス)
|
222
|
+
|
223
|
+
- const staffName = sh.getRange(writeRow, 6).getValue(); //6=F列(スタッフ名)
|
224
|
+
|
225
|
+
- const temphireId = sh.getRange(writeRow, 7).getValue(); //7=G列(ID)
|
226
|
+
|
227
|
+
- const slackId = sh.getRange(writeRow, 9).getValue(); //9=I列(SlackID)
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
- const message = slackId + '\n' + staffName + '\n' + staffErrorEmail + temphireId;
|
232
|
+
|
233
|
+
- postToSlack(message);
|
172
234
|
|
173
235
|
|
174
236
|
|
175
237
|
}
|
176
238
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
function postToSlack(message) {
|
182
|
-
|
183
|
-
const postToMDS = "通知先のWebhooksURL";
|
184
|
-
|
185
|
-
const jsonData = {
|
186
|
-
|
187
|
-
"text": message,
|
188
|
-
|
189
|
-
};
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
const payload = JSON.stringify(jsonData);
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
const options = {
|
198
|
-
|
199
|
-
"method": "post",
|
200
|
-
|
201
|
-
"contentType": "application/json",
|
202
|
-
|
203
|
-
"payload": payload,
|
204
|
-
|
205
|
-
};
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
// リクエスト
|
210
|
-
|
211
|
-
UrlFetchApp.fetch(postToMDS, options);
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
```
|
239
|
+
```
|
2
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
コメントでの質問に対する回答によると、今回I列への文字入力は「手動入力ではない」とのことですが、どのよう
|
15
|
+
コメントでの質問に対する回答によると、今回I列への文字入力は「手動入力ではない」とのことですが、どのような手段を用いて自動入力しているのかについての詳細が開示されておりませんので、質問者さんの使用状況で「変更時」でも検知できるかどうかはこちらではわかりかねます。
|
16
16
|
|
17
17
|
|
18
18
|
|
1
追記
test
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
-
コメントでの質問に対する回答によると、今回I列への文字入力は「手動入力ではない」とのことですが、どのように自動入力されるのかという詳細が開示されておりませんので、質問者さんの使用状況で「変更時」でも検知できるかどうかはこちらではわかりかねます。
|
15
|
+
コメントでの質問に対する回答によると、今回I列への文字入力は「手動入力ではない」とのことですが、どのように自動入力されるのかという詳細が開示され「ておりませんので、質問者さんの使用状況で「変更時」でも検知できるかどうかはこちらではわかりかねます。
|
16
16
|
|
17
17
|
|
18
18
|
|
@@ -58,8 +58,158 @@
|
|
58
58
|
|
59
59
|
postToSlack(message);
|
60
60
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
```
|
61
|
+
```
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
--------
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
# コメントを受けて追記
|
70
|
+
|
71
|
+
「GASを使ってD列にメールアドレスを書き込んでいる」とのことなので、
|
72
|
+
|
73
|
+
アプローチを変えて、その**書き込むGASの方を改造**すればよいと思います。
|
74
|
+
|
75
|
+
(書き込まれるスプレッドシートの方で書き込まれたことを検知するのではなく、
|
76
|
+
|
77
|
+
書き込んでいるGASを使って最終的なSlackの投稿処理まで行う、ということです)
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
具体的には、書き込み用のGASでD列にメールアドレスを書き込んだ後、続けて数式が入っているセル(E列~I列まで)を読み取ってSlackに投稿する、という流れです。
|
82
|
+
|
83
|
+
たとえば、現状、書き込み用のGASが下のようになっていると仮定します。
|
84
|
+
|
85
|
+
```
|
86
|
+
|
87
|
+
function writeMailAddress() {
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
const ss = SpreadsheetApp.openById("書き込み先のスプレッドシートID");
|
92
|
+
|
93
|
+
const sh = ss.getSheetByName("errordata_gmail");
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
// 書き込むメールアドレス
|
98
|
+
|
99
|
+
const mailAddress = "aa@aaa.com";
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
// 書き込み先の行番号(ここでは簡便のため固定値(10)にしているが、forループを使っている場合はその変数に読み替えてもよい)
|
104
|
+
|
105
|
+
const writeRow = 10;
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
// メールアドレスを「writeRow行目、D列」に書き込む
|
110
|
+
|
111
|
+
sh.getRange(writeRow, 4).setValue(mailAddress);
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
```
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
これを使ってSlackに投稿したいなら、以下のように、**上記の続きに、Slack投稿用のコードを継ぎ足してみてはいかがでしょうか**?
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
```
|
124
|
+
|
125
|
+
function writeMailAddress() {
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
const ss = SpreadsheetApp.openById("書き込み先のスプレッドシートID");
|
130
|
+
|
131
|
+
const sh = ss.getSheetByName("errordata_gmail");
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
// 書き込むメールアドレス
|
136
|
+
|
137
|
+
const mailAddress = "aa@aaa.com";
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
// 書き込み先の行番号(ここでは簡便のため固定値(10)にしているが、forループを使っている場合はその変数に読み替えてもよい)
|
142
|
+
|
143
|
+
const writeRow = 10;
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
// メールアドレスを「writeRow行目、D列」に書き込む
|
148
|
+
|
149
|
+
sh.getRange(writeRow, 4).setValue(mailAddress);
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
/**************以下 追加部分*****************/
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
// スプレッドシートから必要なデータを読み取り、スラックに投稿する。
|
158
|
+
|
159
|
+
const staffErrorEmail = sh.getRange(writeRow, 5).getValue(); //5=E列(送付エラーアドレス)
|
160
|
+
|
161
|
+
const staffName = sh.getRange(writeRow, 6).getValue(); //6=F列(スタッフ名)
|
162
|
+
|
163
|
+
const temphireId = sh.getRange(writeRow, 7).getValue(); //7=G列(ID)
|
164
|
+
|
165
|
+
const slackId = sh.getRange(writeRow, 9).getValue(); //9=I列(SlackID)
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
const message = slackId + '\n' + staffName + '\n' + staffErrorEmail + temphireId;
|
170
|
+
|
171
|
+
postToSlack(message);
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
}
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
function postToSlack(message) {
|
182
|
+
|
183
|
+
const postToMDS = "通知先のWebhooksURL";
|
184
|
+
|
185
|
+
const jsonData = {
|
186
|
+
|
187
|
+
"text": message,
|
188
|
+
|
189
|
+
};
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
const payload = JSON.stringify(jsonData);
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
const options = {
|
198
|
+
|
199
|
+
"method": "post",
|
200
|
+
|
201
|
+
"contentType": "application/json",
|
202
|
+
|
203
|
+
"payload": payload,
|
204
|
+
|
205
|
+
};
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
// リクエスト
|
210
|
+
|
211
|
+
UrlFetchApp.fetch(postToMDS, options);
|
212
|
+
|
213
|
+
}
|
214
|
+
|
215
|
+
```
|