Webhook built in Test fails; but record appears in OttoReceiver

I’ve set up the Webhook and when using the built in Test – Send Webhook receive a response ‘Failed’ and the body is just an empty object.

When I copy the Webhook URL and send a test from Postman I’m receiving the following response:
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 07 Aug 2024 20:00:03 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 2
Connection: close
Cross-Origin-Opener-Policy: same-origin
Origin-Agent-Cluster: ?1
Referrer-Policy: no-referrer
Strict-Transport-Security: max-age=15552000; includeSubDomains
X-Content-Type-Options: nosniff
X-DNS-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 0
ETag: W/“2-vyGp6PvFo4RvsFtPoIWeCReyIC8”
Access-Control-Allow-Origin: *
Cross-Origin-Resource-Policy: cross-origin

In both cases I also do see the new record in the OttoReceiver table with the expected body.

I seems like the OttoReceiver script isn’t getting called because this is using the result configured in the default addOn; but not sure. What is the best way to verify the webhook is calling the script?

Thanks!
Colleen

Hey Colleen,

Welcome to the community! Which version of OttoFMS are you running? Did you register the webhook in the UI or via the developer API?

I just got this error while I as testing, it looks like I mis-spelled receiver at some point in the code and it saves an invalid webhook. Is the word “receiver” mis-spelled in the url that OttoFMS gives you?

If your issue is with the mis-spelling, you should be able to fix it by removing and re-adding the webhook via the OttoFMS console.

In version 4.6.0 this mis-spelling is in place in the “Register Webhook” endpoint on the OttoFMS Developer API. I will include a fix for this in our next version.

I am now aware of anywhere else that this error occurs. If your issue is not with the mis-spelling, could you send along your webhook url? If you don’t want to send it publicly, feel free to DM it to me.

-Kyle

As another debugging thought, if you open up the browser console and go the the “Network” tab when you test the webhook, what response are you getting back?

Thanks Kyle!

FMS Version: 21.0.2
OttoFMS Version: 4.5.0.240712399

I registered the webhook in the UI

Will DM you the webhook url

I believe this is what you are looking for:

[
{
“result”: {
“data”: [
{
“id”: 1,
“url”: “/otto/receiver/API_integrations.fmp12/channel_dbemail”,
“label”: “for Outlook Database Email”,
“created_at”: “2024-07-31 13:10:23”,
“updated_at”: “2024-08-08 08:06:17”,
“last_used”: “2024-08-08 08:06:17”,
“last_result”: “success”,
“last_result_is_error”: 0,
“active”: 1,
“number_of_times_used”: 3,
“bytes_received”: 564
}
]
}
}
]

Huh, strange that the test is failing. I’ll look into this on my side. the webhook itself is working though, correct?

If you want some more debugging information, OttoFMS 4.6.0 has a “DEBUG” flag you can set that will do significantly more logging for webhook receiving which should tell you exactly what is going on. If you are able to upgrade and turn on the flag the otto-debug.log would be extremely helpful for my debugging.

Thank you Colleen!
-Kyle

it does seem like the receiver script is getting called since the records are being created, but if you want to debug the script you can try out OttoFMS Application Logging.

Thanks for the links Kyle - we’ve updated to the latest OttoFMS version & I’ll give the logging a try.

Good morning Kyle-

I’ve tried out the OttoFMS Application Logging - nice tool! I’ve got it working when I manually fire the script as the ‘first step’ in the OttoReceiver script however, it’s not running when I hit the webhook.

I can see the record created when hitting the webhook from Postman; but the OttoReceiver script is not firing. Also I noticed two things this morning:
I cannot ‘delete’ the just created record in OttoReceiver table and the ‘FMDAPI - FileMaker Data API Engine 21.0.2’ user session is not terminating – I’m assuming that OttoFMS is handling the logout… but that seems to not be happening.

As soon as I manually disconnect the client from the Server I can then delete the newly created record in the table.

What am I missing here to ensure that DAPI session ends?

Thanks!
Colleen

Hey @chammersely! Actually OttoFMS will not auto-logout the session. It turns out to be more efficient this way so we don’t have to grab a new Data API session token if another requests comes in right away. And there’s currently no way to tell OttoFMS to force-logout that session, but something we may consider adding in the future.

It sounds to me that you maybe just need a Commit Records step in your script to release the record lock from the Data API user. Have you tried that?

1 Like

Hi @eric.luce :slight_smile:

Yep, the commit solved the problem – thank you!!

However, the first thing the script does is to perform the ‘log’ script, and when fired by the webhook that isn’t running. [If I manually execute the script the log script does create an entry in the ‘app-info’ log.

Also – the Webhook Test, from OttoFMS dashboard continues to fail.

I’d like to get all this ‘working as expected’ before I head down the MSGraph subscription route.

Thanks again for any suggestions!
-Colleen

Hey Colleen,

The issue with the webhook test failing for custom responses is fixed in version 4.6.2. Let me know if you have any issues with the test after upgrading!

-Kyle