Create watch as notification for response in Google Forms
@vinay-google đang làm issue này rồi.
Từ ngày 28/7/2022.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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?
- Ngôn ngữ chính
- JavaScript
- Star
- 5.2k
- Fork
- 2k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của googleworkspace/apps-script-samples
-
Alvin Litana MirasolĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 1/100
googleworkspace/apps-script-samples#659 · 1 bình luận · 1 reaction ·
-
Password resetĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
googleworkspace/apps-script-samples#654 · 2 reaction ·
-
cod gsĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
googleworkspace/apps-script-samples#651 · 1 reaction ·
-
tespogromeĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 1/100
googleworkspace/apps-script-samples#624 · 1 reaction ·
-
Get_order_manually.gsCó thể làm lại được @vinay-google đã nhận 244 ngày trước và không có pull request nào đang mở. Đang mở
googleworkspace/apps-script-samples#616 · 1 người được giao ·
Tất cả issue của googleworkspace/apps-script-samples
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
t0ggles
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
nolimits4web/swiper#8240 · 1 bình luận ·
-
netbox status: backlog topic: testing type: housekeeping
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
netbox-community/netbox#23395 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[scanner] check:spelling skips blog/ — posts and author metadata are never spell-checkedCó thể đã có người làm @hivecommons-hive đã nhận hôm nay. Đang mởagent/scanner bug hive/covered-by-pr hive/hosted-available-lke648397-260827-5n31
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
cncf/endusers#1452 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày