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

Fix meeting ended webhook #111

Merged
merged 7 commits into from
May 22, 2020
Merged

Fix meeting ended webhook #111

merged 7 commits into from
May 22, 2020

Conversation

mickmister
Copy link
Contributor

Summary

Zoom seems to have completely changed their webhook payloads to be application/json instead of application/x-www-form-urlencoded. https://marketplace.zoom.us/docs/api-reference/webhook-reference#notification-structure

This PR fixes this on our end by supporting the new payload format.

Ticket Link

Fixes #72
https://mattermost.atlassian.net/browse/MM-20656

@mickmister mickmister added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels May 9, 2020
@mickmister mickmister requested review from larkox and hanzei May 9, 2020 00:44
Copy link
Collaborator

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

I'm quite surprised that Zoom breaks there API like this. Is there any legacy mode? Or a mailing list to get this changes early?

server/http.go Outdated
b, appErr := p.API.KVGet(key)
if appErr != nil {
if appErr != nil && !strings.Contains(appErr.Error(), "not found") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the key is not found, does the server send down an error? Is this by design?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll look into this. It is a pattern we have in mscalendar, but it may be custom functionality bubbled up from the store layer there.

Copy link
Collaborator

Choose a reason for hiding this comment

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

From looking at the test cases in mattermost-server, KVGet returns (nil, nil) is no value is found.

@mickmister
Copy link
Contributor Author

@hanzei

I'm quite surprised that Zoom breaks there API like this.

I am very shocked too. I don't see anything in their documentation about the change nor do I see anything in the docs about the old implementation. It's very strange. Here's a changelog where I would expect to see this info outlined https://support.zoom.us/hc/en-us/articles/204758419-New-updates-for-Web

I did not previously have a webhook setup for testing, so I had to set one up for this task. I'm wondering if someone from the team that does can verify that pre-existing webhook setups have had their payload structure changed. I posted in the Zoom channel to ask for help on this.

Is there any legacy mode? Or a mailing list to get this changes early?

I'm not seeing anything about the change, so I don't think they have any docs on the legacy setup. However, it could be on their site somewhere I haven't found.

There is a Follow button on the main release notes page to subscribe to updates. I assume this is for subscribing via email, but it does not make it clear what the Follow feature entails.
https://support.zoom.us/hc/en-us/sections/201214205-Release-Notes

@hanzei
Copy link
Collaborator

hanzei commented May 11, 2020

Does the WaybackMachine report any changes on the documentation page in the last few month?

@mickmister mickmister requested a review from hanzei May 11, 2020 14:42
@mickmister
Copy link
Contributor Author

@hanzei There doesn't seem to be any relevant info on docs changes from my search on the WaybackMachine.

I see that one of the archive snapshots was triggered by outlinks-from-tweets. I'm not sure if this means people were linking to the zoom site in general, or specifically to the docs page. Searching for tweets around that time, I'm not finding anyone linking to the docs on twitter. I would expect to see someone complaining to zoom about the sudden change, if it was triggered by a link to the docs.

image

Copy link
Contributor

@larkox larkox left a comment

Choose a reason for hiding this comment

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

LGTM

@hanzei hanzei removed the 2: Dev Review Requires review by a core committer label May 13, 2020
@hanzei hanzei requested a review from DHaussermann May 13, 2020 04:16
@hanzei hanzei added this to the v1.4.0 milestone May 13, 2020
@DHaussermann
Copy link

DHaussermann commented May 21, 2020

@mickmister I set this up locally and I'm not seeing this work. My zoom post does not get updated via the subscription when the meeting ends.

  • The Zoom app otherwise works
  • Double checked URL and secret in the Event notification endpoint URL fileld
  • As per documentation End Meeting is the selected event.
  • On my ngrok tunnel I can see POST /plugins/zoom/webhook 400 Bad Request but don't know what's in the payload

Any thoughts?
Also in case it's relevant, I notice that Zoom app provides a Verification Token but there is nowhere to set it in Mattermost plugin UI.
ZoomToken

@larkox
Copy link
Contributor

larkox commented May 21, 2020

Looking at the code, @mickmister is not using the verification token. Actually, as far as I have checked, the authorization token is only provided for published apps in the marketplace, so I would say the best would be to just use the Webhook secret, since it does a similar function.

Regarding why this may not be working, I have no idea. Everything looks fine in the code. I will let @mickmister answer that part.

@mickmister
Copy link
Contributor Author

Quote from one of my comments above:

I did not previously have a webhook setup for testing, so I had to set one up for this task. I'm wondering if someone from the team that does can verify that pre-existing webhook setups have had their payload structure changed.

@DHaussermann Did you already have the webhooks set up in Zoom?

To view the body of a request in the ngrok interface, select the request on hte left side, then use the right side of the page to view the body. You can use the Raw tab to view the entire request. Here's an example of viewing a request:

image

Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

Tested and passed

  • Zoom posts get update to remove join button and set meeting summary
  • This is working following GitBook directions for the leave meeting event
  • No further issues found

Huge thanks @mickmister for resolving this! There are a couple follow-up concerns to test in Master

  1. I'd like to see this work with an oAuth app as well
  2. In master, the posts are now made on behalf of the user rather than the Zoom Bot so these posts updating should be re-tested.

Are you able to merge this now? I can create a follow-up issue if I find any problms with the points above.

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels May 22, 2020
@mickmister mickmister merged commit 37a1b57 into master May 22, 2020
@mickmister mickmister deleted the fix-meeting-ended branch May 22, 2020 21:14
@hanzei hanzei mentioned this pull request May 25, 2020
@larkox larkox mentioned this pull request Jun 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
4 participants