Although we recommend using one of our pre-built destinations, you can also customize them and build your own.
Customizing payload
You can template destination output using curly braces {}.
For example, given this PostHog event:
You can create a template like:
You could use this approach to set parameters in a webhook destination’s URL:
Or to construct a custom JSON payload that conforms to an existing API specification:
Global object
Below is the structure of the global variables available whenever templating a destination.
Modifying destinations with Hog
For most cases, we recommend using one of the templates. These take care of most logic under the hood, exposing simple inputs for you to configure.
You can, however, modify any destination by clicking show source code. From here you can modify the inputs – for example marking an input as secret so that it is encrypted as rest – or changing the implementation of the destination itself.
Destinations are written in our Hog language. Most destinations are wrappers around fetch - a function for safely performing async, retry-able HTTP calls.
For more details and inspiration, you can always view the source code of any destination.
Guidelines for modifying a destination
- Start from an existing template: Check out existing templates that are close to the problem you’re solving and work from there. 
- Rely on filters: Offload as much as possible to the built in - filtersand- inputs. This will make modifying your destination later much simpler (as well as being more performant).
- Use - inputswherever possible: These are great for things like API credentials. You can even mark them as secret: they will not be returned to the UI in the future and will be stored encrypted.
- Keep it short: We have tight controls on execution time, memory usage. 
- Do not perform more than 5 - fetchcalls: The function will error if you do. If you need to do more than 5 calls, please contact support.