googleapis / googleapis/google-api-nodejs-client
How can I find out which event was added, changed or deleted from Google Calendar in my webhook?
- Vorherrschende Sprache
- TypeScript
- Sterne
- 12.2k
- Forks
- 2k
- Ø Merge
- 1 T. 9 Std.
- Gemergte PRs (30 T.)
- 24
Beschreibung
I added a watcher to events
```
calendar.events.watch({
calendarId: 'primary',
requestBody: {
id: 'my-unique-id',
type: 'web_hook',
address: 'https://my-server.com/api/events/calendar/webhook'
}
})
```
This returns me a data object as in the documentation.
```
{
"kind": "api#channel",
"id": string,
"resourceId": string,
"resourceUri": string,
"token": string,
"expiration": long
}
```
So, it works I think.
Then, I created a route for the webhook.
```
router.post('/calendar/webhook', async ctx => {
try {
console.log(ctx.request);
ctx.ok();
} catch (err) {
ctx.bad(400);
}
});
```
When I add a new event to the Google Calendar, I can see next in the console
This is the `ctx.request`
```
{
method: 'POST',
url: '/api/events/calendar/webhook',
header: {
host: 'my-server.com',
'user-agent': 'APIs-Google; (+https://developers.google.com/webmasters/APIs-Google.html)',
'content-length': '0',
accept: '*/*',
'accept-encoding': 'gzip, deflate, br',
'x-forwarded-for': '',
'x-forwarded-proto': 'https',
'x-goog-channel-expiration': 'Fri, 31 Mar 2023 14:56:37 GMT',
'x-goog-channel-id': 'my-unique-id',
'x-goog-message-number': '9712313484225',
'x-goog-resource-id': 'resource-id',
'x-goog-resource-state': 'exists',
'x-goog-resource-uri': 'https://www.googleapis.com/calendar/v3/calendars/primary/events?alt=json'
}
}
```
How do I find out what exactly was changed in Google Calendar? whether an event was added or deleted or changed, what exactly the event was, such as its id?
I would be grateful for any help.
Beitragsleitfaden
Rechercherichtung
Keine Repository-Datei und kein Test sind genannt. Beginne mit der Google Calendar events.watch-Dokumentation und der gezeigten Webhook-Route, ermittle anschließend die dokumentierte Vorgehensweise, um betroffene Ereignisse zu identifizieren, und definiere done als eine klare Erklärung, die Hinzufügungen, Änderungen und Löschungen abdeckt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, nodejs
- Bereich
- api, backend
- Issue-Typ
- Dokumentation
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100