Storing complex webhook JSON data into database

Hi,

Is it possible to store complex JSON data received from a webhook with (Detect request data) into the database?

If it is impossible, can this be achieved with a custom plugin? I need to iterate thru nested arrays…

Thanks,

Do the service you receive the webhook have an API?
Most of the time, the solution is just to create a call in API Connector and Get data from API instead of working with webhook directly.

webhook is mandatory… aynch response is a must. synch request and response is not an option.

The question is to know if the service that send the webhook have an API ?
If yes, in the webhook (you continue to use it) instead of working from the Webhook payload, you do a get request to have the payload sent and store it in DB.

1 Like

I received async responses from many 3rd party servers. Api request and response is not an option.

So you will need to consider using another tool like Integromat.
It doesn’t matter if you use multiple response for me. I guess you probably have a different endpoint for each of them too because they probably also have a different payload. But you don’t provide a lot of informations so It’s hard to really help you.

My initial question is clear: Is it possible to store complex JSON data received from a webhook into the database from an endpoint using Detect request data?

Yes or No? If Yes, how?

In case you don’t understand what I am talking about, I am talking about this:

image

No. Detect request data will provide a parsed version of the json. You have no access to raw payload and this is not possible like you can do with API Connector DATA.

Now… if you want to stop there. That’s fine. You will have no chance to get a solution for your case.

I know this will work but my response is asynchronous. Still waiting for other bubblers opinion on this. I am looking for a good workaround too.

What do you mean by your “response”?
An example:
If you use Cloudconvert, you will create a PDF from page. You send a request to Cloud Convert API and when the conversion is done, you get a webhook from Cloud convert with the file. This is asynch because the result (response) is not available right after the first API Call request. you make a request and this take time to process, so you need to wait a webhook to get the result.

I mean what you just described.

So my solution wait for the webhook. But in the webhook, instead of working directly with the Data sent, you use API Connector to get the data.
So the webhook trigger like it should, and instead of trying to use the payload directly, you use the API Connector to get data.
Example:
Stripe send a webhook once an invoice is paid. The invoice contain line items (5 lines). With webhook, you cannot get the JSON as DATA like in API Connector and store JSON. You will need to manipulate each field one by one. So instead of working with the webhook payload, but in the webhook, I will Call invoices API Endpoint of Stripe to get the same thing (payload) using the ID provided into the original webhook. If you set your API Connector to “DATA”, this will be available exactly if you have created a Bubble DB. So you can store the whole payload into a single field in your DB.

4 Likes

Wooow This is brillant!!! Awesome man! Got the trick finally :sweat_smile: :heart_eyes:

In a nutshell, I use the webhook asynch call as trigger and then I call the sender with session-id to get the JSON data with API Connector.

The assumption is that the sender will have a mechanism to cache the asynch response. Since I have a full control over the webhook notifier, it is not a problem.

Thanks a lot.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.