回答編集履歴
5
a
answer
CHANGED
@@ -32,4 +32,28 @@
|
|
32
32
|
curl -X POST --data-urlencode "payload={\"channel\": \"#general\", \"username\": \"webhookbot\", \"text\": \"これは webhookbot という名のボットから #general に投稿されています。\", \"icon_emoji\": \":ghost:\"}" https://hooks.slack.com/services/XXXXXXXXXXXXXX
|
33
33
|
```
|
34
34
|
|
35
|
-
問題を切り分けるために、まずはcurlでPost出来ないかを確認してみて下さい。「XXXXXXXXXXXXXX」の部分をご自身の値に変更して下さい。(#general宛にpostされるはずです)
|
35
|
+
問題を切り分けるために、まずはcurlでPost出来ないかを確認してみて下さい。「XXXXXXXXXXXXXX」の部分をご自身の値に変更して下さい。(#general宛にpostされるはずです)
|
36
|
+
|
37
|
+
# 5
|
38
|
+
|
39
|
+
公式ドキュメントに載っていたコードなので、送信するオプションの指定の参考にしてください。
|
40
|
+
JSONのところがとりあえず、怪しい気がします。
|
41
|
+
|
42
|
+
```
|
43
|
+
// Make a POST request with a JSON payload.
|
44
|
+
var data = {
|
45
|
+
'name': 'Bob Smith',
|
46
|
+
'age': 35,
|
47
|
+
'pets': ['fido', 'fluffy']
|
48
|
+
};
|
49
|
+
var options = {
|
50
|
+
'method' : 'post',
|
51
|
+
'contentType': 'application/json',
|
52
|
+
// Convert the JavaScript object to a JSON string.
|
53
|
+
'payload' : JSON.stringify(data)
|
54
|
+
};
|
55
|
+
UrlFetchApp.fetch('https://httpbin.org/post', options);
|
56
|
+
|
57
|
+
```
|
58
|
+
|
59
|
+
[https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app?hl=fr-FR#fetch](https://developers.google.com/apps-script/reference/url-fetch/url-fetch-app?hl=fr-FR#fetch)
|
4
"#general
answer
CHANGED
@@ -32,4 +32,4 @@
|
|
32
32
|
curl -X POST --data-urlencode "payload={\"channel\": \"#general\", \"username\": \"webhookbot\", \"text\": \"これは webhookbot という名のボットから #general に投稿されています。\", \"icon_emoji\": \":ghost:\"}" https://hooks.slack.com/services/XXXXXXXXXXXXXX
|
33
33
|
```
|
34
34
|
|
35
|
-
問題を切り分けるために、まずはcurlでPost出来ないかを確認してみて下さい。「XXXXXXXXXXXXXX」の部分をご自身の値に変更して下さい。
|
35
|
+
問題を切り分けるために、まずはcurlでPost出来ないかを確認してみて下さい。「XXXXXXXXXXXXXX」の部分をご自身の値に変更して下さい。(#general宛にpostされるはずです)
|
3
a
answer
CHANGED
@@ -9,7 +9,6 @@
|
|
9
9
|
[https://api.slack.com/incoming-webhooks
|
10
10
|
](https://api.slack.com/incoming-webhooks)
|
11
11
|
|
12
|
-
`"payload" : '{"text":"' + "テスト" + '"}',`の部分が怪しそうなので、`"payload": JSON.stringify({text: "テスト"})`で試してみると良いかもしれません。(未確認)
|
13
12
|
|
14
13
|
# 2
|
15
14
|
> (応答の全文を見るには muteHttpExceptions オプションを使用してください)
|
@@ -25,4 +24,12 @@
|
|
25
24
|
以下を参照下さい。
|
26
25
|
|
27
26
|
- [https://script.google.com/dashboard](https://script.google.com/dashboard)
|
28
|
-
- [https://developers.google.com/apps-script/guides/services/quotas](https://developers.google.com/apps-script/guides/services/quotas)
|
27
|
+
- [https://developers.google.com/apps-script/guides/services/quotas](https://developers.google.com/apps-script/guides/services/quotas)
|
28
|
+
|
29
|
+
# 4
|
30
|
+
|
31
|
+
```
|
32
|
+
curl -X POST --data-urlencode "payload={\"channel\": \"#general\", \"username\": \"webhookbot\", \"text\": \"これは webhookbot という名のボットから #general に投稿されています。\", \"icon_emoji\": \":ghost:\"}" https://hooks.slack.com/services/XXXXXXXXXXXXXX
|
33
|
+
```
|
34
|
+
|
35
|
+
問題を切り分けるために、まずはcurlでPost出来ないかを確認してみて下さい。「XXXXXXXXXXXXXX」の部分をご自身の値に変更して下さい。
|
2
JSON.stringify({text: "テスト"})
answer
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
[https://api.slack.com/incoming-webhooks
|
10
10
|
](https://api.slack.com/incoming-webhooks)
|
11
11
|
|
12
|
+
`"payload" : '{"text":"' + "テスト" + '"}',`の部分が怪しそうなので、`"payload": JSON.stringify({text: "テスト"})`で試してみると良いかもしれません。(未確認)
|
12
13
|
|
13
14
|
# 2
|
14
15
|
> (応答の全文を見るには muteHttpExceptions オプションを使用してください)
|
1
a
answer
CHANGED
@@ -4,9 +4,10 @@
|
|
4
4
|
以下を参照下さい。
|
5
5
|
|
6
6
|
> HTTP 400 Bad Request
|
7
|
-
invalid_payload
|
7
|
+
`invalid_payload` typically indicates that received request is malformed — perhaps the JSON is structured incorrectly, or the message text is not properly escaped. The request should not be retried without correction.
|
8
8
|
|
9
|
+
[https://api.slack.com/incoming-webhooks
|
9
|
-
|
10
|
+
](https://api.slack.com/incoming-webhooks)
|
10
11
|
|
11
12
|
|
12
13
|
# 2
|