Skip to content

Webhook Status Code Definitions #814

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

Open
robotdan opened this issue Aug 13, 2020 · 5 comments
Open

Webhook Status Code Definitions #814

robotdan opened this issue Aug 13, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@robotdan
Copy link
Member

robotdan commented Aug 13, 2020

Webhook Status Code Definitions

Problem

Currently a webhook treats all 2xx as a success, and anything else as a failure.

There are times where you may intentionally fail a webhook response because you want to block the request using the TX.

Solution

Support specific status codes to indicate the webhook behavior. For example :

  • 2xx success / normal
  • 4xx fail the request, log a debug event log if the Webhook has debug enabled, log any JSON response if available
  • 5xx webhook failed, create an error event log in FusionAuth and log any JSON response if available

In the 4xx case, we could define a known response value that would allow the webhook to provide a description of cause of the failure to be shown to the end user.

This would not change the behavior of the webhooks, but it would allow FusionAuth to log the failure differently, and optionally provide different messages to the end user if this is during an interactive user workflow.

Related

How to vote

Please give us a thumbs up or thumbs down as a reaction to help us prioritize this feature. Feel free to comment if you have a particular need or comment on how this feature should work.

@ewoutquax
Copy link

A webhook can respond to a event with a message. It would be nice to show that message on the frontend.

That way, our code can inform the user what happened, eg: "invalid login-type", instead of the generic "one or more webhooks failed, please try something else."

Even better would be if the webhook can return a code in the http-body, that can be translated via defaultMessages.txt in the theme.

@mooreds
Copy link
Collaborator

mooreds commented Dec 14, 2021

@ewoutquax thanks for the feedback! What you wrote sounds really interesting, but would probably be better captured as a separate feature request. Would you mind filing one in this repo? https://github.com/FusionAuth/fusionauth-issues/issues/new?assignees=&labels=&template=feature_request.md is the link.

@glen-84
Copy link

glen-84 commented Apr 22, 2022

@mooreds,

Do you still need a separate issue for displaying localized error messages from webhooks, or is it sufficiently covered by this issue?

{
    "error": {
        "code": "abc123", // optional code
        "message": "Show this message in the UI.", // optional non-localized message
        "messageId": "access-denied", // look up localized message, and optionally fall back to "message" (when present)
        "context": "..." // optional additional context (stack trace, etc.) to be logged
    }
}

I suppose this is also tangentially related to #1696 (the idea of returning data from webhooks).

@mooreds
Copy link
Collaborator

mooreds commented May 9, 2022

@glen-84 A separate issue is almost always a good idea. Please feel free to open one.

@andrewpai
Copy link

It would be nice to be able to respond to specific codes with certain actions, such as backing off on webhook rate when we get 429s, or retrying on certain 5** codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants