Custom integrations
Build and sync custom integrations from a private Git repository into Tracecat.
Get started by cloning the custom-integrations-starter-kit template repo.
Git sync is the recommended way to sync custom integrations into Tracecat in production. For development,
Tracecat uses YAML to define inputs and configurations for actions and workflows. YAML is a human-readable configuration language that is easy to write and read. It is also more concise than JSON and more customizable than HTML forms.
If you’re new to YAML, you can learn more here. YAML is also widely used in DevOps tools like Ansible, GitHub Actions, and Docker Compose.
By the end of this tutorial, you’ll learn how to:
- Sync custom integrations into Tracecat
- Build custom integrations in YAML and Python
Prerequisites
- Access to a private Git repository (e.g. GitHub, GitLab)
- Basic knowledge of Python,
pip
, and YAML
Sync remote git repository
In this section, we’ll walk through the process of securely syncing custom integrations into Tracecat.
Create new repo
The first step is to create a new repo from the custom-integrations-starter-kit template.
Configure remote repo URL
Go to the Git Repository
section in Organization
settings and configure the remote repo URL to point to your private repository.
GitHub SSH deploy key
Create a SSH public / private key pair (without a passphrase) and store the public key in GitHub. Store the public key in GitHub.
Private key in Tracecat
Go to the SSH Keys
section in Organizations
settings and add the private key with the name github-ssh-key
.
Do not change the key name. The github-ssh-key
key name works for both GitHub and GitLab.
Refresh repos in Tracecat
Go to the Repositories
section in the Registry
page and refresh the repos.
Your custom repo should now be visible.
Sync custom repo
In the same Repositories
section, select your custom repo and press the Sync from remote
.
Your custom integrations should now be visible in your Tracecat instance’s registry.
View custom integrations
Go to the Actions
view in the Registry
page and filter by Origin
to view synced actions.
🎉 That's it!
Feel free to add your own custom Python UDFs and YAML templates to the custom integrations repo.
Just push to your changes to the git repo and press sync in Tracecat Registry. Updates and new actions will show up immediately.
Action Templates
If you find yourself using a generic action (e.g. core.http_request
) with the same parameters in multiple workflows, we recommend creating a YAML action template.
Check out Tracecat’s open source Action Templates on GitHub for examples. More information on when and how to build effective templates can be found in the integrations best practices.
Action Templates are custom integrations built on Tracecat’s YAML-based DSL (domain specific language). A template comprises of the following elements:
- A unique
title
,description
, anddisplay group
- A
namespace
(e.g.tools.falconpy
) andname
(e.g.call_command
) for the action - Inputs defined in the
expects
section - Steps defined in the
steps
section - An optional
secrets
section
Steps consist of 1-2 commonly used actions, such as core.http_request
, configured to call an external API.
These steps are also parameterized with the inputs defined in the expects
section.
Only data specified in the returns
field of the template is logged in Tracecat workflows.
Outputs between steps are not logged unless specified in returns
.
Every template follows the same structure:
Actions in templates
Templates support all actions defined in the Tracecat Registry.
Actions, such as core.http_request
and tools.falconpy.call_command
, can all be used in templates by specifying the steps.action
field.
Expressions in templates
Templates support the following expressions:
inputs
: Reference inputs into the action as defined in theexpects
section.steps
: Reference results from previous steps in the same template.SECRETS
: Reference secrets.FN
: Reference functions.
inputs
and steps
are expressions specific to templates.
SECRETS
and FN
are used in the same way as in workflows.
This means that templates have full support for Tracecat’s powerful inline functions. For example:
Secrets in templates
Secrets used in templates must be defined in the secrets
section.
You must specify the secret’s name
, key
, and (if applicable) optional_keys
.
Secrets stored in the secrets manager can be accessed using the SECRETS
context: ${{ SECRETS.<name>.<key> }}
.
For example:
Tracecat will automatically replace the expression with the secret value at runtime. Retrieved secrets are removed from memory, i.e. garbage collected, after the action is executed.
Python UDFs
Check out Tracecat’s open source core actions and Python integrations on GitHub for examples.
Tracecat makes it easy to turn your Python scripts into no-code workflow actions, which we call user-defined functions (UDFs). All you need is a:
- Single Python decorator
from typing import Annotated
from typing_extensions import Doc
Secrets used in UDFs must be defined as RegistrySecret
objects in the secrets
argument of the @registry.register
decorator.
They are retrieved from Tracecat’s secrets manager at runtime and garbage collected after the action is executed.
For example:
Next steps
- Join our Discord community and meet other Tracecat users and contributors.
- Have integrations you’d like to share with the community? Open up an issue on GitHub and start contributing to open source!
- Check out integrations best practices.
Was this page helpful?