Dec 27, 2023 04:21 AM - edited Dec 27, 2023 04:22 AM
Hi,
I am trying to register my localhost rest API endpoint as a notification URL for the Airtable webhook. I am hitting a roadblock with the server sending the following response:
[body] => {"error":{"type":"INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND","message":"Invalid permissions, or the requested model was not found. Check that both your user and your token have the required permissions, and that the model names and/or ids are correct."}}
[raw] => HTTP/1.1 403 Forbidden
Now my questions are:
1) Can we register our localhost endpoint as a notification URL?
2) I am using the pated below php code. Is it a problem with the code?
$headers = array(
'Content-Type' => 'application/json',
'Authorization' => 'Bearer ' . $airtable_api_key,
);
$body = wp_json_encode(
array(
'notificationUrl' => $webhook_url,
'specification' => array(
'options' => array(
'filters' => array(
'dataTypes' => array( 'tableData' ),
'recordChangeScope' => 'tblgR4tt66WVctY11',
),
),
),
)
);
$response = wp_remote_post(
$airtable_api_url,
array(
'headers' => $headers,
'body' => $body,
)
);
Looking forward to help.
Regards,
Nisit
Dec 28, 2023 01:25 AM
Try using ngrok.com to expose your localhost to the internet.
Dec 28, 2023 08:55 AM
Thanks, Steve. I moved my setup to https and I was able to register the endpoint. I will soon test whether the Webhook is able to send my local endpoint changes made on the database. I will update this thread after that.
Regards,
Nisit