Watson Workspace will no longer be available after February 28, 2019. Learn more.

Developers

Webhooks triggered twice for one message

Comments

6 comments

  • Avatar
    Bernd Gewehr

    Did you confirm the received message with statuscode 200? If you do not, the service resends the message.

  • Avatar
    Miguel Estrada

    Also,  you can use the event index and retry count values to verify if they are new events or retry attempts.  See this which I will some day remove and  re-publish as sample in github.com/watsonwork

    https://gist.github.com/miguelestrada/e172c49fe0e122833eb0a96833cfd317

     

     

  • Avatar
    Job Cuppen (Edited )

    I'm writing a java application. and as soon as the webhook triggers my servlet I call: response.setStatus(HttpServletResponse.SC_OK);

    According to the documentation this is supposed to respond to the webhook with 200 OK. yet I still receive duplicates of my webhooks.

    edit: using ngrok.exe I have confirmed that every webhook results in a 200 OK but sometimes it is still called twice

  • Avatar
    Miguel Estrada

    use the event index and retry count values to verify if they are new events or retry attempts

  • Avatar
    Job Cuppen

    I've confirmed it is a retry.

    in my chat I typed my command once but it is received and handled twice, despite me calling response.setStatus(HttpServletResponse.SC_OK);

    chat:

    log:

    the second line is the retry count printed with:

    System.out.println(request.getHeader("X-OUTBOUND-RETRY-COUNT"));



  • Avatar
    Miguel Estrada

    Hi Job,

    "despite me calling response.setStatus(HttpServletResponse.SC_OK)"

    Are you certain your ack is being sent over the wire to the back end in the right order? 

Please sign in to leave a comment.