Create watch as notification for response in Google Forms
@vinay-google がすでに取り組んでいます。
2022年7月28日 から。
評価
この issue はまだ評価されていません。
説明
Hi!
I'm trying to reproduce a sample in AppsScript that has been published in the Google Documentation for python and Node.
It is this method: https://developers.google.com/forms/api/guides/push-notifications#create_a_watch
So basically, I have a topic created in the Cloud Pub/Sub feature for my project and want to have some kind of notification process as when a new response of Google Form has been submitted. I cannot use an email notification but I'm open to any other solution that provides me the functionality of triggering a subprocess of a Node app.
Here's the use case: For MVP reasons and getting quick results, I have embedded the form as an iframe in my Node app. When users complete the form I need to start a new process with the information provided in the form as the input.
For the time being, I thought about having set up an AppsScript in the form that publishes to a Pub/Sub topic to which the app is subscribed.
However, using the following code:
function createWatch() {
Logger.log('Calling the Forms API!');
var formId = FORMID';
// Get OAuth Token
var OAuthToken = ScriptApp.getOAuthToken();
Logger.log('OAuth token is: ' + OAuthToken);
var formsAPIUrl = 'https://forms.googleapis.com/v1beta/forms/' + formId + '/' + 'watches';
Logger.log('formsAPIUrl is: ' + formsAPIUrl);
var watchRequest = JSON.stringify({
"watch": {
"target": {
"topic": {
"topicName": "projects/xxx/topics/xxx"
}
},
"eventType": "RESPONSES"
}
});
var options = {
'headers': {
Authorization: 'Bearer ' + OAuthToken,
Accept: 'application/json'
},
'method': 'post',
'muteHttpExceptions': true,
'payload': watchRequest
};
var response = UrlFetchApp.fetch(formsAPIUrl, options);
Logger.log('Response from forms.responses was: ' + response);
}
... I get the following response:
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"{\"watch\":{\"target\":{\"topic\":{\"topicName\":\"projects/fachmarkt-manager/topics/employee-onboarding\"}},\"eventType\":\"RESPONSES\"}}\": Cannot bind query parameter. Field '{\"watch\":{\"target\":{\"topic\":{\"topicName\":\"projects/fachmarkt-manager/topics/employee-onboarding\"}},\"eventType\":\"RESPONSES\"}}' could not be found in request message.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"description": "Invalid JSON payload received. Unknown name \"{\"watch\":{\"target\":{\"topic\":{\"topicName\":\"projects/fachmarkt-manager/topics/employee-onboarding\"}},\"eventType\":\"RESPONSES\"}}\": Cannot bind query parameter. Field '{\"watch\":{\"target\":{\"topic\":{\"topicName\":\"projects/fachmarkt-manager/topics/employee-onboarding\"}},\"eventType\":\"RESPONSES\"}}' could not be found in request message."
}
]
}
]
}
}
I have also tried to drop the stringify of the payload but it results in the same error.
Any chances of fixing this?
- 主要言語
- JavaScript
- スター
- 5.2k
- フォーク
- 2k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleworkspace/apps-script-samples のほかの issue
-
Alvin Litana Mirasolオープン
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
googleworkspace/apps-script-samples#659 · コメント 1 件 · リアクション 1 件 ·
-
Password resetオープン
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
googleworkspace/apps-script-samples#654 · リアクション 2 件 ·
-
cod gsオープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
googleworkspace/apps-script-samples#651 · リアクション 1 件 ·
-
tespogromeオープン
難易度 5/5 1週間以上 初心者へのやさしさ 1/100
googleworkspace/apps-script-samples#624 · リアクション 1 件 ·
-
Get_order_manually.gs再び着手できるかも @vinay-google が 244 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
googleworkspace/apps-script-samples#616 · 担当者 1 名 ·
googleworkspace/apps-script-samples の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
-
t0ggles
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
nolimits4web/swiper#8240 · コメント 1 件 ·
-
netbox status: backlog topic: testing type: housekeeping
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
netbox-community/netbox#23395 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
[scanner] check:spelling skips blog/ — posts and author metadata are never spell-checked対応中かも @hivecommons-hive が今日担当しました。 オープンagent/scanner bug hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
cncf/endusers#1452 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信