Subscription
We provide a subscription service that allows you to receive notifications when a Google Spreadsheet is updated
or new Spreadsheet is created
.
- Obtain the OAuth URL and complete the OAuth process.
- Subscribe to the Google Spreadsheet.
- Delete the subscription.
1. Google Spreadsheet OAuth
To subscribe to the Google Spreadsheet, you need to complete the 1. Obtain OAuth URL
step.
By following the instructions below, you will receive the OAuth URL.
[Request]
curl --location 'http://localhost:1290/v1/service/googlesheets/oauth?userId={{yourUserId}}' \
--header 'api_key: default'
[Response]
https://accounts.google.com/o/oauth2/v2/auth?prompt=consent&access_type=offline&include_granted_scopes=true&response_type=code&redirect_uri=https%3A%2F%2Fproxy.interactor.com%3A4443%2Fplatform%2FUNLICENSED%2Foauth&state=XCP.jp_lM3LyKyQK8EabFJYThEvVCTPNZ4j9CWRkjfGnk6ha0GEJyluMXXulJLsl0y71v_lPRK9peDN_PIEcq6dodL70tjOQ67wiRTVfLIos6HSiiC8&client_id=859731562219-6vjoh4d3ovfpihfs0hrti7s5f651c1l7.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.readonly+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.file+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fspreadsheets
2. Subscribe to the Google Spreadsheet
2-1 Example - spreadsheet.created
trigger
When a new Spreadsheet is created, you will receive a webhook notification.
[Request]
curl --location 'http://localhost:1290/v1/subscription?userId=a6e9ba54-2a4f-43e3-b02f-c3f29438ba68' \
--header 'api_key: default' \
--header 'Content-Type: application/json' \
--data '{
"platform": "interactor",
"service": "googlesheets",
"trigger": "spreadsheet.created",
"url": "{{your webhook URL}}", // The URL to receive the webhook notification
"variables": { // this field is empty in this trigger
}
}'
After you send the request, you will receive the following response. SubscriptionId will be used to delete the subscription.\
[Response]
{
"id": "eef07b36-2afc-411e-a0d1-d0363d677930", // The subscription ID
"url": null // This field is null in this service
}
When you successfully subscribe to the Google Spreadsheet, you will receive a webhook notification when a new Spreadsheet is created in your URL.
2-2 Example - spreadsheet.updated
trigger
When a Spreadsheet is updated, you will receive a webhook notification.
This trigger requires the spreadsheet
variable that you want to monitor.
2-2-1 Get the Spreadsheet ID
To get the Spreadsheet ID, you need to execute the Retrieve the values of the spreadsheet to be monitored
step.
The Request Body parameter is optional.
If it is not provided, values will be retrieved from the default location, My Drive
, in Google Drive.
[Request]
curl --location 'http://localhost:1290/v1/service/googlesheets/datatype/GoogleSpreadsheet/execute?userId={{yourUserId}}' \
--header 'api_key: default' \
--header 'Content-Type: application/json' \
--data '{
}'
[Response]
The values are retrieved from My Drive.
{
"input": {},
"output": {
"data": [
{
"label": "Test Sheet",
"value": {
"id": "1oFClVS4x12312zcTDL5IeJrg9GaasdqavY", // {{SheetId}}
"name": "Test Sheet"
}
},
...
]
}
}
2-2-2 Subscribe to the Spreadsheet
It is necessary to include the spreadsheet
variable in the Request Body to subscribe to the Spreadsheet.
[Request]
curl --location 'http://localhost:1290/v1/subscription?userId={{yourUserId}}' \
--header 'api_key: default' \
--header 'Content-Type: application/json' \
--data '{
"platform": "interactor",
"service": "googlesheets",
"trigger": "spreadsheet.updated",
"url": "",
"variables": {
"spreadsheet": {
"id": "16TNDVMOjLEC2tc1iFeBq5wPX7l-oxVvcs71IFtCymVI" // <-- Spreadsheet ID to monitor from the previous step
}
}
}'
After you send the request, you will receive the following response. [Response]
{
"id": "eef07b36-2afc-411e-a0d1-d0363d677930", // The subscription ID
"url": null // This field is null in this service
}
When you successfully subscribe to the Google Spreadsheet, you will receive a webhook notification when the Spreadsheet is updated in your URL.
3. Delete the subscription
To delete the subscription, you need to provide the subscription ID. This is the ID you received when you subscribed to the Google Spreadsheet.
[Request]
curl --location --request DELETE 'http://localhost:1290/v1/subscription/{{subscriptionId}}?userId={{yourUserId}}' \
--header 'api_key: default'
There is no response when you delete the subscription.