Discussions

Ask a Question
Back to All

Servicem8 Verify Webhook Callback URL

(edited)

Hello Team,

We are using below official document url of servicem8 to subscribe to the webhook.

https://developer.servicem8.com/reference/post_webhook_subscriptions

We found that, we have to Authenticate webhook callback url to receive post data using Oauth 2.0 process.
We used this url : https://developer.servicem8.com/docs/authentication
We did it and we are getting Access token using App Id and Client service Id but after that how to verify our server callback url to receive post data ? We are stuck here. Can you guide us or provide us with any reference url?
While subscribing to the webhook callback url we are getting "Authorization Required" every time. Can you help what I'm missing here?

Note : Below official servicem8 link to handle the verification step is not working
https://developer-beta.servicem8.com/docs/overview
So please provide the steps so we can move ahead.


MY PHP CURL CODE :


$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.servicem8.com/webhook_subscriptions',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('object' => 'Company','fields' => 'Active','callback_url' => 'https://safety.clouddownunder.com.au/public/admin/webhookcallback'),
CURLOPT_HTTPHEADER => array(
'Authorization: bearer 68128-apse2-REMOVED',
'Accept: application/json',
'Content-Type: application/x-www-form-urlencoded'
),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;


OUTPUT : Authorization Required