Developers

Multiple hits to webhook from deleted spaces

Comments

2 comments

  • Avatar
    Vitalijus Rudzinskas

    When you add your app to space and set it to receive events, events will be sent until your app responds to the Watson Workspace server it has received the event. 200 OK.

    What it means is that you you can add an app to space, shut down the app, generate some events, Watson workspace will try to contact your app and keep trying to resend events until it receives message from your app it has received it.

    You can start your app TWO DAYS later and your app will get hit by avalanche of events Watson Workspace tried to send you for the last 2 days in increased time intervals.

    This is not a BUG, this is a FEATURE.

    My advice is make your app respond to every event that comes in and if you try to do something based on event, move it to new THREAD so it would not be in the way of quickly respond to events coming from Watson Workspace.

    If you are doing it in JAVA, it's something like this:

    @RequestMapping(value = "webhook", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public ResponseEntity webhookCallback(@RequestHeader(X_OUTBOUND_TOKEN) String outboundToken, @RequestBody WebhookEvent webhookEvent)
    {

    //LOGGER.info(webhookEvent.getUserId());

    //return
    processWebhook(webhookEvent, outboundToken);

    return buildVerificationResponse(webhookEvent);
    }


    Where buildVerificationResponse(webhookEvent) responds to the Watson Workspace, so it would stop trying to hit your app with an event.

    Yes it seems strange and painful first, but you get used to it. Soon you will debugging and "bleeding out" the events in case Exception has prevented your app from responding and stuff like that.




  • Avatar
    Aman Shah

    Thank you so much for the response. I was not handling the hits to webhook properly and so "webhook retry logic" came into picture. It is resolved now!

    Thanks again.

Please sign in to leave a comment.