Transform an inbound webhook before calling an API Action

This recipe normalizes a provider-neutral webhook and then uses the transformed output in a GitHub Custom API Request.

Text
Webhook Source → JSON Patch Transformation → GitHub: Custom API Request

Example input

Send a controlled request that represents a ticket to create:

JSON
{
  "repository": { "owner": "acme", "name": "support" },
  "ticket": { "subject": "Login fails", "details": "Customer sees a 403." },
  "internal_debug": "remove before the API call"
}

Confirm the exact payload location in the Trigger preview before creating the patch.

1. Normalize the payload

Add a Transformation → JSON Patch Step. Use the JSON tree to select paths from the real Step input, then test operations such as:

JSON
[
  { "op": "copy", "from": "/repository/owner", "path": "/github_owner" },
  { "op": "copy", "from": "/repository/name", "path": "/github_repository" },
  { "op": "copy", "from": "/ticket/subject", "path": "/issue_title" },
  { "op": "copy", "from": "/ticket/details", "path": "/issue_body" },
  { "op": "remove", "path": "/internal_debug" },
  { "op": "add", "path": "/normalized", "value": true }
]

JSON Patch uses JSON Pointer paths. Test the patch in the builder and verify that the Result panel contains the new fields and no internal_debug field.

2. Configure the API Action

  1. Add GitHub → Custom API Request after the Transformation.
  2. Select the GitHub App account with access to the target repository.
  3. Choose POST.
  4. Set the API path to /repos/{owner}/{repository}/issues, inserting github_owner and github_repository from the Transformation output with the picker.
  5. Set the request body to valid JSON using issue_title and issue_body from that same output.

Conceptually, the body is:

JSON
{
  "title": "{{steps.normalize.issue_title}}",
  "body": "{{steps.normalize.issue_body}}"
}

Use the picker-generated saved paths rather than manually copying the illustrative Step ID.

3. Test the full route

Activate the Workflow and send a new test event. In Audit, verify the original Trigger payload, the Transformation output, the exact API method/path/body, and the GitHub response. Confirm that the issue appears in the intended repository.

Failure handling

Connect an error route to the Transformation when missing input paths should be recorded. Connect a separate error route to the API Action for authentication, permission, validation, and provider failures.

See Workflow transformations, GitHub integration, and Error handling.