Forum Academy Marketplace Showcase Pricing Features

API Workflow - How to properly save JSON data received from external service to Database?

Hello!
I’m using the API Workflows feature to receive data from an external service (JIRA) which sends a webhook containing JSON formatted data (example below).
The call gets saved in the DB and contains only dates as I can’t figure out how to save the rest of the data from the body of the call.

I would appreciate some help in figuring out how to stucture the DB and how to configure the workflow to enable this.

The JSON data is (simplified):
{
“transition”: {
“workflowId”: 35968,
“workflowName”: “PPROJ: Service Request Fulfilment workflow for JIRA Service Desk”,
“transitionId”: 1,
“transitionName”: “Create issue”,
“from_status”: “”,
“to_status”: “Waiting for support”
},
“comment”: “”,
“user”: {
“self”: “https://somedomain.net/rest/api/2/user?username=user.name”,
“name”: “user.name”,
“key”: “user.name”,
“emailAddress”: "[email protected]",
“avatarUrls”: {
“48x48”: “https://somedomain.net/secure/useravatar?avatarId=11525”,
“24x24”: “https://somedomain.net/secure/useravatar?size=small&avatarId=11525”,
“16x16”: “https://somedomain.net/secure/useravatar?size=xsmall&avatarId=11525”,
“32x32”: “https://somedomain.net/secure/useravatar?size=medium&avatarId=11525
},
“displayName”: “John Snow”,
“active”: true,
“timeZone”: “Europe/Warsaw”
},
“issue”: {
“id”: “34566”,
“self”: “https://somedomain.net/rest/api/2/issue/34566”,
“key”: “PPROJ-13”,

},
“timestamp”: 1488559413306
}

Thanks in advance!

It’s a nested JSON payload, and currently Bubble doesn’t support reading nested objects via the API endpoint. Sadly, I’m in the same boat, but there is hope for the future!

I’ve seen discussions elsewhere on the forum about using an external service to flatten the JSON so Bubble can accept it.

Blockspring has a flattener:

I think people also use https://www.built.io/ for this sort of thing. Honestly, the more we can do within Bubble the better. I hope someone writes a plugin for parsing JSON. Maybe I will, when I have some time.

1 Like

This isn’t doable currently, community plugins are only client side, and API endpoints run server side.

I haven’t delved into the plugin-documentation yet, that’s unfortunate though. Maybe the future will allow Bubble-certified server-side plugins :slight_smile: (community development vs. sponsored add ons).

If Plugins allow external API calls, then it should not be hard to call a flattening microservice.

Info from Bubble after installing Blockspring and trying to add this flattener: “This block doesn’t have an identified type and cannot be used in Bubble yet. Sorry about this.”

After googling a but I managed to solve the problem with Zapier (“Send data from a webhook through a new webhook”) and now I receive the correctly formatted data in Bubble.is!
The solution in Zapier is “Send data from a webhook through a new webhook” and by default it flattens all payloads which then can be optionally unflattened when send.
Easy to configure (took me 10 mins) and it works like a charm!

3 Likes