Google Forms
22 min
the google forms connector integrates with swimlane turbine, facilitating to get response of a form prerequisites the google forms connector can be authenticated in one of two ways access to the gcp console using admin privileges on the domain you’re looking to manage access to the gsuite admin console using admin privileges on the domain you’re looking to manage asset setup scope get form response of a google forms requires one of the following oauth scopes https //www googleapis com/auth/drive https //www googleapis com/auth/drive file https //www googleapis com/auth/forms responses readonly capabilities this connector provides the following capabilities get form response gcp project creation log in to gcp console here https //console cloud google com/ navigate to this link to create a new project https //console cloud google com/projectcreate name your project and click create we recommend specific and recognizable project names navigate to your projects, and select your new project enable the google forms api go to the api & services dashboard in the cloud console click on the "enable apis and services" button search for "google forms api" and enable it for your project asset configuration configuring a service account google forms connector requires a google service account to authenticate open https //console developers google com/iam admin/serviceaccounts select the appropriate project click + create new service account assign a name for the service account and add a description, click create and continue click the select a role dropdown and type “owner” in the filter choose owner and click continue for the menu specifying grant users access to this service account (optional) you may select users or skip and click done this is not required for the connector click on the newly created service account email navigate to the keys menu click add key , select create new key , select json format, and click create make sure you download the json file presented this file will be needed when configuring the asset in swimlane navigate to the details menu at the top of the screen copy down the unique id to be used in the setting api scopes step below delegating domain wide authority (recommended) in order to support accessing multiple user's accounts, domain wide authority must be enabled before creating a service account choosing not to delegate domain wide authority will heavily limit the scope of what this connector can do if the connector will only operate against a single account, the next section (setting api scopes) can be skipped setting api scopes after creating a service account, the necessary api scopes required to be authorized must be set from https //admin google com/ , navigate to security > api controls and then click manage domain wide delegation at the bottom of the window click add new in the client id field, enter the unique id from the service account details menu enter the following csv value into the oauth scopes (comma delimited) input https //www googleapis com/auth/drive,https //www googleapis com/auth/drive file,https //www googleapis com/auth/forms responses readonly click authorize credentials the contents of the json credentials key file downloaded when creating a service account must be base64 encoded when creating the google forms asset for linux and mac $ cat \<path to credentials json> | base64 for windows using powershell \[convert] tobase64string((get content path "your file path" encoding byte)) now copy the base64 encoded string and paste it into the service account json field delegate account the delegate account value is used to determine which account to operate as when running actions this value should be the email address for the target account (the mailbox you are trying to read/write) some actions provide an optional input to override the asset value in most if not all cases an admin account of the google workspace should be used it should not be the service account email customer id the unique id for the customer's google workspace account as an account administrator, you can also use the my customer alias to represent your account's customerid the customerid is also returned as part of the users resource in order to get this value, navigate to https //admin google com then go to account account settings , and you will find it listed oauth 2 0 to configure oauth 2 0 for the google forms connector, follow these steps navigate to the https //console cloud google com/ select your project from the top menu in the left sidebar, select "apis & services" > "credentials " click the "+ create credentials" button and select "oauth 2 0 client id " under "application type," select "web application " enter a name for the oauth 2 0 client click "create " a dialog with your client id and client secret will appear click "ok" to close the dialog next to the oauth 2 0 client you just created, click on the pencil icon to edit the client under "scopes for google apis," add the necessary scopes that are required for your connector (as specified in the "setting api scopes" section of this readme) click "save " your oauth 2 0 client is now configured and ready to be used with the google forms connector once this is configured, you need to provide the refresh token in the asset if you dont know how to achieve this, swimlane will provide you with a script that will help you to get the refresh token notes https //developers google com/workspace/guides/create credentials https //developers google com/forms/api/reference/rest/v1/forms responses/get configurations google forms authentication authenticates google forms using google credentials configuration parameters parameter description type required client id the client id for the oauth 2 0 application string required client secret the client secret for the oauth 2 0 application string required refresh token oauth 2 0 refresh token used to obtain new access tokens if using a refresh token, you must also provide a client id and secret string required scope permission scopes for this action array optional google forms service account authentication authenticates google forms using service account configuration parameters parameter description type required credentials base64 encoded contents from service account json credentials file see readme for setup instructions string required delegate account account to execute integrations under if not specified, the integration will run as a service account using a service account will introduce limitations see readme string required scope permission scopes for this action array optional actions get form response get one response from the form input argument name type required description formid string required unique identifier responseid string required unique identifier input example {"formid" "1ywm8f14oskhavumjch8pg21bmk37m1no9pldswnkfrs","responseid" "acydbnj6gvgmzybgcpp hfsxtzfa1cgasxc2euomodq0fjnf8ugxkf0v uwldno1of075oy"} output parameter type description status code number http status code of the response reason string response reason phrase response object output field response response formid string unique identifier response responseid string unique identifier response createtime string time value response lastsubmittedtime string time value response respondentemail string output field response respondentemail response answers object output field response answers response answers questionid string unique identifier response answers grade object output field response answers grade response answers textanswers object output field response answers textanswers response answers fileuploadanswers object output field response answers fileuploadanswers response totalscore number score value output example {"status code" 200,"response headers" {},"reason" "ok","response" {"formid" "1ywm8f14oskhavumjch8pg21bmk37m1no9pldswnkfrs","responseid" "acydbnj6gvgmzybgcpp hfsxtzfa1cgasxc2euomodq0fjnf8ugxkf0v uwldno1of075oy","createtime" "2024 03 15t11 50 57 255z","lastsubmittedtime" "2024 03 15t11 50 57 255312z","respondentemail" "abc\@gmail com","answers" {"questionid" "","grade" {},"textanswers" {},"fileuploadanswers" {}},"totalscore" 0}} list form responses list a form's responses input argument name type required description formid string required id of the form whose responses to list parameters filter string optional which form responses to return currently, the only supported filters are timestamp > n, timestamp >= n timestamp > n which means to get all form responses submitted after (but not at) timestamp n timestamp >= n which means to get all form responses submitted at and after timestamp n parameters pagesize number optional the maximum number of responses to return the service may return fewer than this value if unspecified or zero, at most 5000 responses are returned parameters pagetoken string optional a page token returned by a previous list response if this field is set, the form and the values of the filter must be the same as for the original request input example {"parameters" {"filter" "timestamp > 2024 05 20t01 35 04 061199z","pagesize" 1,"pagetoken" "atwmts0+9ekxqjzum7/foylxwciffyzo2kdxfradvqp29wff1vgg+shslufwyjt01bznqglc3gjsa+wgtfvtzspc5b2zmykrtgoi8iqiwc2jmwvhh/xhk0ldekqovorq5h6kc82i3ejpbdum11ms4eqg3wi1gjb8/hokhyhgj0umjdugwjb2spwcjomidj5kvsaafwcdbtlnomtqnmqjdblamjwm/eji/kr+qicrnghjmiafanguh3+4x0pelupap+whui5amxwqn1t9thuxvmyyzj7m5nhzn9x2ltieu/e4djy/7zf/vonns"},"formid" "1okccjzxlmfze6lohtbrrjgxjoaxdued1nw kpd lnpg"} output parameter type description status code number http status code of the response reason string response reason phrase response object output field response response responses array output field response responses response responses responseid string unique identifier response responses createtime string time value response responses lastsubmittedtime string time value response responses answers object output field response responses answers response responses answers 72d3dca7 object output field response responses answers 72d3dca7 response responses answers 72d3dca7 questionid string unique identifier response responses answers 72d3dca7 textanswers object output field response responses answers 72d3dca7 textanswers response nextpagetoken string output field response nextpagetoken output example {"status code" 200,"response headers"\ null,"reason" "ok","response" {"responses" \[{}],"nextpagetoken" "atwmts0n2xbpyqm2nd55wddz3zs2uy+bmhgy9fqeml5g9h+rigs7nptdupjrtlvnnu13cuu1uu6nh+ig "}} response headers header description example content type the media type of the resource application/json date the date and time at which the message was originated thu, 01 jan 2024 00 00 00 gmt