Passing & Accessing Data in Webhooks

Data Flow in Webhooks
Retrieving Data in Code
Best Practices


Understanding how to pass and access data between webhooks is crucial for effectively managing the flow of information in Canonic workflows. This capability enables you to build dynamic and responsive workflows based on the data processed at each step.

Data Flow in Webhooks

Data in Canonic workflows flows sequentially from one webhook to the next, allowing each webhook to access and manipulate the data passed from its predecessors.

Passing Data

  • Data can be passed to a webhook either as direct input from the user or from the output of a previous webhook in the workflow.
  • The structure of the data being passed depends on the configuration and purpose of each webhook.

Accessing Data

  • In each webhook, you can access the data passed to it using specific parameters or the predefined data structure in Canonic.
  • For instance, you can access input data or the output from the previous webhook in the workflow for further processing or decision making.


Consider a workflow where you have a series of webhooks: UserInput, DataProcessing, and FinalAction.

  1. UserInput Webhook: This webhook gathers data from the user, such as a form submission.
  2. DataProcessing Webhook:

    • This webhook receives the user input as its data.
    • It processes this data, perhaps applying some business logic or data transformation.
    • The processed data is then passed on to the next webhook.
  3. FinalAction Webhook:

    • This webhook accesses the processed data from the DataProcessing webhook.
    • It performs the final actions based on this data, such as sending an email or updating a database.

Retrieving Data in Code

When using the Code Editor or scripting within webhooks:

module.exports = function (params) {
  // Accessing input data
  const inputData = params.input

  // Accessing data from the previous webhook (if applicable)
  const previousData = params["1"].output // Assuming it's the second webhook in the sequence

  // Process and return data
  // ... your code logic ...

Best Practices

When working with webhooks in Canonic, it's essential to adhere to the following best practices to ensure efficient and error-free data flow:

  • Consistent Data Structures: Maintain consistency in the data structures used throughout your workflow. This consistency helps prevent errors when webhooks access or modify data.
  • Individual Webhook Testing: Test each webhook separately to confirm it correctly handles the data it receives and passes on. This step is crucial for identifying and resolving any issues early in the workflow design.
  • Simplicity in Data Logic: Strive to keep your data manipulation logic as simple and clear as possible. Simplified logic aids in maintenance and debugging, making your workflows more robust and easier to understand.

Note: A thorough understanding of how data flows and is manipulated in your workflows is crucial for creating efficient and error-free automations in Canonic.

Did you find what you were looking for?
What went wrong?
Need more help?We have a thriving Discordcommunity that can help you with all things Canonic. β†’