Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: automatic no show #16727

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open

feat: automatic no show #16727

wants to merge 40 commits into from

Conversation

Udit-takkar
Copy link
Contributor

@Udit-takkar Udit-takkar commented Sep 19, 2024

What does this PR do?

Screenshot 2024-09-24 at 4 24 00 PM

  • Hosts need to be logged in to cal.com when they join cal video meeting so that we can detect whether they joined the meeting or not.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have added a Docs issue here if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  1. Go to any event type webhooks page
  2. Create webhook with two trigger events "After hosts doesn't join cal vide" , "After guest doesn't join cal video" and select time as 5 minutes.

Tasker is disabled at the moment

3) you can test the task triggerNoShowHost by importing this function in packages/features/bookings/lib/handleNewBooking/scheduleNoShowTriggers.ts and

~triggerHostNoShow(JSON.stringify({ bookingId:booking.id, webhook: subscribersHostsNoShowStarted[0])}~

and try booking a meeting.

  1. Make a POST request to http://localhost:3000/api/cron/calVideoNoShowWebhookTriggers to trigger the webhooks.
    You can comment this code
 const apiKey = req.headers.authorization || req.query.apiKey;
  if (process.env.CRON_API_KEY !== apiKey) {
    res.status(401).json({ message: "Not authenticated" });
    return;
  }

  await prisma.webhookScheduledTriggers.deleteMany({
    where: {
      startAfter: {
        lte: dayjs().subtract(1, "day").toDate(),
      },
    },
  });

and change the startAfter date to past date like 26th sept so that these jobs are executed when you make the POST request

Copy link

linear bot commented Sep 19, 2024

@github-actions github-actions bot added enterprise area: enterprise, audit log, organisation, SAML, SSO High priority Created by Linear-GitHub Sync ✨ feature New feature or request labels Sep 19, 2024
@keithwillcode keithwillcode added the core area: core, team members only label Sep 19, 2024
@Udit-takkar Udit-takkar added this to the v4.6 milestone Sep 19, 2024
Copy link

vercel bot commented Sep 20, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 7:06pm
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Oct 9, 2024 7:06pm

Copy link
Contributor

github-actions bot commented Oct 8, 2024

E2E results are ready!

Comment on lines +23 to +31
const subscriberHostsNoShowStarted = {
userId: triggerForUser ? organizerUser.id : null,
eventTypeId,
triggerEvent: WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW,
teamId,
orgId,
};

const subscribersHostsNoShowStarted = await getWebhooks(subscriberHostsNoShowStarted);
Copy link
Member

@zomars zomars Oct 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Extracting this to a constant implies that this is being used elsewhere which it doesn't.

Suggested change
const subscriberHostsNoShowStarted = {
userId: triggerForUser ? organizerUser.id : null,
eventTypeId,
triggerEvent: WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW,
teamId,
orgId,
};
const subscribersHostsNoShowStarted = await getWebhooks(subscriberHostsNoShowStarted);
const subscribersHostsNoShowStarted = await getWebhooks({
userId: triggerForUser ? organizerUser.id : null,
eventTypeId,
triggerEvent: WebhookTriggerEvents.AFTER_HOSTS_CAL_VIDEO_NO_SHOW,
teamId,
orgId,
});

Comment on lines +52 to +60
const subscriberGuestsNoShowStarted = {
userId: triggerForUser ? organizerUser.id : null,
eventTypeId,
triggerEvent: WebhookTriggerEvents.AFTER_GUESTS_CAL_VIDEO_NO_SHOW,
teamId,
orgId,
};

const subscribersGuestsNoShowStarted = await getWebhooks(subscriberGuestsNoShowStarted);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here


export function checkIfUserJoinedTheCall(userId: number, allParticipants: Participants): boolean {
return allParticipants.some(
(participant) => participant.user_id && parseInt(participant.user_id) === userId
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not getting the host inside participants, even when I join cal video logged in as the host, participants shows the attendee's name

@zomars
Copy link
Member

zomars commented Oct 9, 2024

Tasker is disabled at the moment

Just double checked and tasked is indeed running. It is just that is not being used ciurrently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bookings area: bookings, availability, timezones, double booking core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ✨ feature New feature or request High priority Created by Linear-GitHub Sync ❗️ migrations contains migration files ready-for-e2e Urgent Created by Linear-GitHub Sync webhooks area: webhooks, callback, webhook payload
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CAL-4357] Auto no show detection for Cal Video hosts
6 participants