Webhooks returning null
-
I am wanting to run code contained within a plugin I have created when a webhook is triggered by a POST request on a webofrm. All of my code works except “null” is always returned, or rather, some blank space and newline characters followed by null. My abridged code is as follows:
`
add_filter(‘wpwhpro/run/actions/custom_action/return_args’, ‘CreateInvoice’, 10, 3);function CreateInvoice($return_args, $identifier, $response_body){
//Some code to perform the task I want (which does work)
if( $identifier === ‘student-invoice’ ){
$return_args = array(
‘success’ => true,
‘msg’ => ‘The call was successful’,
‘data’ => array()
);return $return_args;
}
}
}When implemented as a code snippet the response is fine but not when implemented as a plugin. For my code to function, it must be implemented as a plugin and not a snippet. I was wondering if you know any reason why the response would be null when I use your custom_action webhooks within a plugin?
Many thanks,
John
- The topic ‘Webhooks returning null’ is closed to new replies.