Self-host : Webhook response format

The format of the response from the webhook is different from the sample payload, not in the proper json format:
Expected :
{
“type”: “records.after.update”,
“id”: “0dfaf789-af0d-4308-a6eb-4b469e3be8ca”,
“data”: {
“table_id”: “m2z1nlvrokw36p4”,
“table_name”: “Expenses - Approval”,
“view_id”: “vwixnh0wkrshtxlo”,
“view_name”: “Expenses - Approval”,
“previous_rows”: [
{
“Id”: 1,
“Company”: “Simplability”,
“CreatedAt”: “2024-07-30T05:29:50.678Z”,
“UpdatedAt”: “2024-07-30T05:29:50.678Z”,
“Amount”: “$123”,
“Approver”: “Sikander”,
“Receipt”: [
{
“url”: “https://nocodb.com/dummy.png”,
“title”: “image.png”,
“mimetype”: “image/png”,
“size”: 0
}
],

Response payload :
{
‘table_id’: ‘m2z1nlvrokw36p4’,
‘table_name’: ‘Expenses - Approval’,
‘previous_rows’: [
{
‘Id’: 232,
‘Company’: ‘Beyond Zero’,
‘Amount’: 1477,
‘Approver’: ‘Saurabh’,
‘Receipt’: [
{
‘title’: ‘Wed Jul 24 2024.png’,
‘mimetype’: ‘image/png’,
‘size’: 471258
}
]

Issue : The expected one has a “data” wrapper but the response payload has no data wrapper,
Expected json’s keys are in “Key” : “Value” while the response in coming in single inverted comma ‘Key’ : ‘Value’.

1 Like

@Krish1015

  • Are you trying it out in Cloud? Or in self hosted?
  • If Self hosted, please provide base information for us to look into the issue.

I tried in app.nocodb.com & the response received in webhook.site was the following

{
  "type": "records.after.update",
  "id": "48a358ef-1a47-491c-8275-ceadc68eb30c",
  "data": {
    "table_id": "mbvv6c7gs74rr0k",
    "table_name": "Sample Views",
    "previous_rows": [
      {
        "Id": 6,
        "Album": "Light Switch",
        "Status": "Research",
        "Length (minutes)": 520,
        "Budget": 26000,
        "Platform": null,
        "Release": "2023-06-29 06:10:00+00:00",
        "CreatedAt": "2023-10-09 06:57:38+00:00",
        "UpdatedAt": "2024-07-30 06:19:42+00:00",
        "Sample Views1": null
      }
    ],
    "rows": [
      {
        "Id": 6,
        "Album": "Light Switch",
        "Status": "Research",
        "Length (minutes)": 520,
        "Budget": 26000,
        "Platform": "Spotify",
        "Release": "2023-06-29 06:10:00+00:00",
        "CreatedAt": "2023-10-09 06:57:38+00:00",
        "UpdatedAt": "2024-07-30 06:20:14+00:00",
        "Sample Views1": null
      }
    ]
  }
}

The server receiving the payload is hosted on AWS, but the trigger is being done from the app.nocodb.com the base info of my laptop is :

NocoDB version details:
Node: Latest
Arch: x64
Platform: windows
Docker: false
RootDB: pg
Please help.

What is your trigger for webhook? Have you configured Body explicitly? Please check what is present in the Webhook BODY configuration. Should be {{ json event }}

the body is same as {{ json event }} sir, I checked it several time.

@Krish1015 Update trigger with a condition, I tried again. I did get proper payload. Can you confirm if payload is incorrect still even if you change Webhook link to the one from webhook.site?

with webhook.site I am also getting proper payload,
While for my custom API endpoint , the format is not proper, while It was working fine 2 days back.

Is it a bug from nocodb side, or should it be from our end?

Something that you need to investigate on the receiving end. Please check your code at the receiving end if you are accessing response.data instead of response.

But what about the single quote and boule quote?
For the single quote the URLs are vanishing after 'https: (last after that “//” is taking as a comment while I am using request.get_data())

Please help, Sir. Do You need any more information?

Google it out @Krish1015. The webhook payload sent from NocoDB is same irrespective of webhook URL destination. The processing at your receiving end will depend on the packages & libraries that you are using for post processing.

Thanks, its solved, The payload was in byte format, so I had to decode it with “utf-8” and then it was fine,

2 Likes