8000 feat(api): send webhook to cx when doc query is complete by Goncharo · Pull Request #250 · metriport/metriport · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat(api): send webhook to cx when doc query is complete #250

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

Merged
merged 4 commits into from
Apr 24, 2023

Conversation

Goncharo
Copy link
Member
@Goncharo Goncharo commented Apr 23, 2023

refs. #242

Dependencies

N/A

Description

send webhook to cx when doc query is complete + update docs accordingly.

Release Plan

nothing special

@Goncharo Goncharo changed the title [WIP] feat(api): send webhook to cx when doc query is complete feat(api): send webhook to cx when doc query is complete Apr 23, 2023

Webhook requests contain the relevant information on the body of the HTTP request.

There are three types of messages you can expect to recieve:
Copy link
Member

Choose a reason for hiding this comment

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

nit receive

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member
@leite08 leite08 left a comment

Choose a reason for hiding this comment

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

Some questions that could be worth reviewing the solution and a couple nitpicks. 😄

But good to merge if you prefer to leave as is and/or address later.

Comment on lines +259 to +261
// if this is for MAPI:
// silently ignore this since this is just a notification for ease-of-use
// and won't result in data loss
Copy link
Member

Choose a reason for hiding this comment

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

Is there a benefit of not enabling retries for doc references? Just trying to gauge the cost/effort of doing it vs the added complexity to the API by having diff behaviors based on the API the customer is using.

If we keep like this, I think we should document it on the retry section of webhook docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

So the logic here is that:

  • this is only not enabled if the cx doesn't have the WH URL set
  • if they don't have it set, that means they don't have the endpoint implemented yet
  • there should be no benefit of retrying these payloads after they implement the WH, as they will be able to get the same data using the mechanism they previously used, and only new data will be sent

Lmk what you think

Copy link
Member Author

Choose a reason for hiding this comment

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

^ to be explicit, the retries will still function as expected if the cx has the WH url setup

Copy link
Member
@leite08 leite08 Apr 24, 2023

Choose a reason for hiding this comment

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

if they don't have it set, that means they don't have the endpoint implemented yet

One might delete the API key after setting it up.

there should be no benefit of retrying these payloads after they implement the WH, as they will be able to get the same data using the mechanism they previously used, and only new data will be sent

That assumes they would implement GET /document, but in theory customers could only implement webhook, as it sends all the document references we have for a given patient, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed offline:

  • We will retry doc refs, if the failure reason is for something other than them not having a WH url set on the dash. The logic here is that if they don't initially (let's say they choose not to implement WH in their flow), when they turn the switch on, they'll get a bunch of old doc refs that they should have already processed, so they'll have to filter those out or something - trying to avoid those situations.
  • Good point as to what if they change/remove the URL after it has already been setup once though - will document this limitation for now and iterate based on cx feedback

Copy link
Member
@leite08 leite08 left a comment

Choose a reason for hiding this comment

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

:shipit:

@Goncharo Goncharo added this pull request to the merge queue Apr 24, 2023
Merged via the queue into develop with commit bbc73c0 Apr 24, 2023
@Goncharo Goncharo deleted the 242-wh-doc-query branch April 24, 2023 20:00
@github-actions
Copy link

🎉 This PR is included in version 4.4.0-develop.8 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0