You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
π I have found these related issues/pull requests
Not found related issues.
π·οΈ Feature Request Type
New notification-provider, Change to existing notification-provider
π Feature description
I need to keep notifications on Google Spreadsheet.
It can be done via HTTP POST (Webhook). But require a time-limited token (to use as a variable at webhook).
βοΈ Solution
Use Google Scripts middleware (see second comment).
β Alternatives
Google API OAuth2 working with limited by 60 minutes ACCESS_TOKEN that can be received with e.g. curl:
curl --request POST \
--data "client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&grant_type=refresh_token&refresh_token=$REFRESH_TOKEN" \
https://oauth2.googleapis.com/token
I obtained CLIENT_ID and CLIENT_SECRET at Google Console Spreadsheet API and REFRESH_TOKEN exchanged at OAuth 2.0 Playground (select Spreadsheets v3 for "Authorize APIs" button.)
With such POST a new line will be added to the spreadsheet by curl:
If request difficult to achieve with Kuma, it can be solved with Google Scripts as middleware.
functiondoPost(e){try{Logger.log('doPost function called');if(!e.postData||!e.postData.contents){thrownewError('No POST data received');}Logger.log('POST data received: '+e.postData.contents);varparams=JSON.parse(e.postData.contents);varsecret=params.secret;if(secret!=='<secret>'){thrownewError('Unauthorized: Invalid secret key');}deleteparams.secret;varstatus=params.status||'No Status';varmessage=params.message||'No Message';Logger.log('Status: '+status+', Message: '+message);varspreadsheet=SpreadsheetApp.openById('<table_id>');//var spreadsheet = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/<or_such _ink>/edit');varsheet=spreadsheet.getSheets()[0];// example, not adjusted for message from Kuma sheet.appendRow([newDate(),status,message]);Logger.log('Data appended to sheet');varresponse={result: 'success'};Logger.log('Returning response: '+JSON.stringify(response));returnContentService.createTextOutput(JSON.stringify(response)).setMimeType(ContentService.MimeType.JSON);}catch(error){Logger.log('Error occurred: '+error.toString());varresponse={result: 'error',error: error.toString()};Logger.log('Returning error response: '+JSON.stringify(response));returnContentService.createTextOutput(JSON.stringify(response)).setMimeType(ContentService.MimeType.JSON);}}// Example for test from Script editor// function testDoPost() {// var e = {// postData: {// contents: JSON.stringify({// status: 'Test Status',// message: 'Test Message',// secret: '<secret>'// }),// type: 'application/json'// }// };// var result = doPost(e);// Logger.log(result.getContent());// }
Publish on every save and use resulted link with Webhook notification at Kuma with Custom Body as
π I have found these related issues/pull requests
Not found related issues.
π·οΈ Feature Request Type
New notification-provider, Change to existing notification-provider
π Feature description
I need to keep notifications on Google Spreadsheet.
It can be done via HTTP POST (Webhook). But require a time-limited token (to use as a variable at webhook).
βοΈ Solution
Use Google Scripts middleware (see second comment).
β Alternatives
Google API OAuth2 working with limited by 60 minutes
ACCESS_TOKEN
that can be received with e.g.curl
:curl --request POST \ --data "client_id=$CLIENT_ID&client_secret=$CLIENT_SECRET&grant_type=refresh_token&refresh_token=$REFRESH_TOKEN" \ https://oauth2.googleapis.com/token
I obtained
CLIENT_ID
andCLIENT_SECRET
at Google Console Spreadsheet API andREFRESH_TOKEN
exchanged at OAuth 2.0 Playground (selectSpreadsheets v3
for "Authorize APIs" button.)With such POST a new line will be added to the spreadsheet by
curl
:The text was updated successfully, but these errors were encountered: