Comments (12)
2 things can be done
- Either use node as a runtime
or - Somehow figure out the actual post request being sent
from bounty-hook.
@hkirat thoughts?
from bounty-hook.
@hkirat thoughts?
I already have that working. But have some questions with it.
from bounty-hook.
oof.
can we dump somewhere else?
Like some other sheet? Notion?
from bounty-hook.
Whats ur question @SujithThirumalaisamy ?
from bounty-hook.
Yeah notion looks promising
from bounty-hook.
Whats ur question @SujithThirumalaisamy ?
It was just a api call. I made it working in the vanila worker as well. But the only thing is we need to generate a refresh oauth token and add it to the env when deploying. It is working so. Is'nt it optimal. Or we can use a service account based authentication. Because the native google sheets api access with the API_KEY will not provide full functionality in the api.
from bounty-hook.
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
if (request.method !== 'POST') {
return new Response('Only POST requests are supported!', { status: 405 });
}
const bounty: { name: string; pr: string; amount: string; isDispensed: boolean } = await request.json();
const requestOptions = {
method: 'POST',
redirect: 'follow',
};
const res = await fetch(
`https://oauth2.googleapis.com/token?client_id=${env.CLIENT_ID}&client_secret=${env.CLIENT_SECRET}&refresh_token=${env.REFRESH_TOKEN}&grant_type=refresh_token`,
requestOptions
);
const access_token = await res.json();
const dataToWrite = JSON.stringify({
range: 'Sheet1!A1:E1',
majorDimension: 'ROWS',
values: [[bounty.name, bounty.pr, bounty.amount, bounty.isDispensed || false]],
});
const myHeaders = new Headers({
'Content-Type': 'application/json',
Authorization: `Bearer ${access_token.access_token}`,
});
const sheetData = {
method: 'POST',
headers: myHeaders,
body: dataToWrite,
redirect: 'follow',
};
try {
const done = await fetch(
`https://sheets.googleapis.com/v4/spreadsheets/${env.SPEADSHEET_URL}/values/Sheet1!A1:E1:append?valueInputOption=RAW`,
sheetData
);
} catch (e) {
// Handle error if necessary
}
return new Response('Data successfully written to Google Sheets!');
},
};
from bounty-hook.
If notion is easier lets just go with notion
from bounty-hook.
If notion is easier lets just go with notion
That should also use the http2 api underthe hood. Sargam is trying to do that. I am looking if it possible to authenticate with the api using a service account
from bounty-hook.
@hkirat Sargam came up with the notion thing. I also setup the google sheets things. Can raise a PR if wanted. Notion PR LGTM.
from bounty-hook.
Notion is good enuf for now
from bounty-hook.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bounty-hook.