Serving webhooks the right way: Flatten JSON for Workflow Builder

Share

Sometimes, what looks like a straightforward automation turns out to have a few hidden layers. In this case, a teammate needed to create an automation that would take data from a webhook and post a message to a Slack channel. Using Workflow Builder seemed like the clear solution—after all, it can take webhooks as triggers, send messages, and chain other steps without writing code.

When we set up the webhook trigger, Workflow Builder prompted us to define variables based on the payload example we had from the third-party service. But no matter how we tried to map them, no data appeared in the variable preview.

After some debugging, we discovered why: Workflow Builder can only extract variables from top-level JSON keys in the payload. The third-party service was sending deeply nested JSON, so the trigger couldn’t access most of the data.

Initially, we thought it was a formatting problem. We considered creating a custom function to reformat the data, but because the problem was happening at the trigger level, even a custom step wouldn’t have received the data we needed. The only real fix was to flatten the payload before it ever reached Slack.

That’s where Pancake Studio came in. This open-source service receives the JSON payloads, flattens all keys so they’re at the top level, and then sends the payload to Slack’s webhook trigger—making variables accessible for testing and development.

Important: Pancake Studio is an unofficial Slack project. While it’s extremely useful for development and testing, we don’t recommend using the hosted version in production, due to occasional downtime and hosting limitations. For production apps, you can self-host the open-source version: GitHub – Pancake Studio

 

Here’s how you can use it for testing:

1. In Slack, go to Tools → Workflow Builder and create a new workflow.

2. Choose Webhook as the trigger type.

  • The modal that opens lets you:
    • Set up variables: define what data you want to use in later steps.
    • Preview an example HTTP body.
    • Copy the Web request URL (it looks like https://hooks.slack.com/triggers/***).
  • Change the host to use Pancake Studio:

https://pancake.studio/triggers/***

(Or paste your Slack webhook URL into pancake.studio to get the updated version.)

3. Use this new URL in your third-party webhook settings.

When setting up variables for flattened data:

  • Replace dots in key names with underscores (key1.keyAkey1_keyA).
  • Include array indexes (data[0].titledata_0_title).
  • If the payload starts with an array, you might see keys like 0_data_0_title.

Once the payload is flattened, Workflow Builder can extract all the data you need, and you can use those variables in your steps—whether that’s sending a message, creating a record, or anything else your workflow requires.

If you’re working with nested JSON in Slack’s Workflow Builder, Pancake Studio is a great development and testing tool to help you verify variable mapping without writing extra code. And if you need it for production, you can self-host using the open-source repo.

More Reads