67P / hubot-kredits

Kosmos Kredits chat/service integrations
https://wiki.kosmos.org/Kredits
MIT License
2 stars 1 forks source link

Zoom integration #34

Closed raucao closed 4 years ago

raucao commented 5 years ago

I think it would be great if we automatically tracked attendance of our Kosmos weekly calls and issued a small contribution for everyone present. I found out how we can do this easily via the API:

https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/pastmeetingparticipants

Screenshot from 2019-04-28 12-37-18

As unregistered users don't have a Zoom ID, we'll probably want to use the name field for the contributor profile (although we can add both, of course).

raucao commented 4 years ago

@bumi Any news on this? Is there still a blocker?

raucao commented 4 years ago

They changed a few things about the API, and the new way to go for our use case is a JWT app with webhooks configured. I created just that and tested it successfully. Here's the webhook payload of an ended meeting:

{
  "event": "meeting.ended",
  "payload": {
    "account_id": "123456789",
    "object": {
      "duration": 30,
      "start_time": "2020-01-23T17:40:32Z",
      "timezone": "Europe/Berlin",
      "end_time": "2020-01-23T17:42:54Z",
      "topic": "Kosmos Weekly Call",
      "id": "414901303",
      "type": 3,
      "uuid": "HUO2bnTGQh6x/Y+nmnuyng==",
      "host_id": "go8yD3bYTmyXfKuqU2MZvw"
    }
  }
}

(That date/time string is actually the correct UTC time, so we can ignore the "timezone" property entirely. No idea what it's for, or where it comes from.)

There's an active subscription configured for the end-meeting events, requests for which you can inspect at https://webhook.site/#!/49d390e8-b8dd-4bbe-befc-3d161e46671a/

The second step is then just getting the list of participants, as documented above already, and configure and use the JWT token for those requests:

https://marketplace.zoom.us/docs/api-reference/zoom-api/meetings/pastmeetingparticipants

raucao commented 4 years ago

Oh, I also had the idea to only automatically propose kredits for ended meetings with 3 or more participants. This way, we can still use the same ID for e.g. pair programming and such, without having to think about potential kredits entries.