Last active
February 19, 2023 00:07
-
-
Save 5un/02c7906429274d73a6657f36f769a8be to your computer and use it in GitHub Desktop.
post-google-forms-nodejs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('superagent'); | |
// https://docs.google.com/forms/d/<form-id>/edit | |
var formId = 'YOUR_FORM_ID'; | |
var fields = { | |
size: 'entry.1721541334', | |
sizeOther: 'entry.1721541334.other_option_response', | |
email: 'entry.1414359800', | |
mobile: 'entry.1534391001', | |
delivery_method: 'entry.1215248009', | |
address: 'entry.1445466410' | |
} | |
request | |
.post(`https://docs.google.com/forms/d/e/${formId}/formResponse`) | |
.type('form') | |
.send({ | |
[fields.size]: 'M', | |
[fields.sizeOther]: 'SS', | |
[fields.email]: '[email protected]', | |
[fields.delivery_method]: 'post', | |
[fields.mobile]: '0811111111', | |
[fields.address]: '66 Test Street Bangkok' | |
}) | |
.end(function(err, res){ | |
if (err || !res.ok) { | |
console.error(err); | |
} else { | |
console.log(res.body); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to login for a form that requires login?
It needs a "token" properties