googleapis / googleapis/google-api-nodejs-client

Calendar - node - Can I send an event update email to new attendees only?

Open
#3,310 4 comments 1 reaction 0 assignees View on GitHub
priority: p3 type: question
Dominant language
TypeScript
Stars
12.2k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
24

Description

## What you're trying to do

I'm trying to create an app on which users can subscribe to an event.

My plan is to create an event, then update it every time a user wants to attend by updating or patching the event attendees.

I would like the users to receive the google email with the event details when they register.

## What code you've already tried
Using this code, all the attendees will receive an email every time a new attendee is added. In this scenario, I would like only new attendees to receive the email.

```typescript
// [...] abridged auth and calendar setup

authWithImpersonation.getClient().then((auth: any) => {
getEvent().then((ev: any) => {
const newAttendees = ev.data.attendees
? [
...ev.data.attendees,
{
email: 'user@domain.com',
},
]
: [
{
email: 'user@domain.com',
},
];

let eventPatch = {
attendees: newAttendees,
};

calendarWithImpersonation.events.patch({
auth,
eventId: ev.data.id,
calendarId: GCP_CALENDAR_CALENDAR_ID,
resource: eventPatch,
sendUpdates: 'all', // Hello there
});
});
});

```

Is there a way to dynamically choose who gets notified?

If you have any other suggestion on how to achieve my goal I'm open to it, this is a greenfield project.

Thank you

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.