Jump to content

How to send Success 200 response to sender in webhook?


psy
 Share

Recommended Posts

I've set up a page to receive responses to events from another app's webhooks and it's working fine.

The sending server needs to receive a http response of 200 before retrying. When the set number of retries fail, the web hook will be disabled by the sending host. From what I've read, often the 200 response will be returned auto-magically by the receiving host (in this case, PW). Doesn't appear to be happening. The sending host keeps retrying.

I'd like to deliberately send the success response back to the sending host and I suspect https://processwire.com/api/ref/wire-http/send-status-header/ will be in the mix somewhere. Just not sure how to set it up. So far I have:

<?php namespace ProcessWire:

$phpInput = @file_get_contents("php://input");
$payload = json_decode($phpInput);

if(!$payload->scope) exit(); // not valid BC webhook
// need to send the 200 response here to let BC know the response was received successfully

Guidance much appreciated.

Cheers
psy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...