The base64Encode Handlebars helper encodes a string or field value as a base64 string. Builders use it inside Handlebars templates — including field mappings, response mappings, HTTP request bodies, file content, and dynamic API paths — most often to build HTTP basic authentication headers. The input is read as UTF-8, and the output is a base64-encoded string.
Because the helper produces raw encoded output, use triple braces ({{{ }}}) so that integrator.io doesn't automatically quote or format the result.
base64Encode accepts a single string argument and no character-set or format options. To encode multiple values together, combine them first with the join helper, as shown in the basic authentication example.
Usage
{{{base64Encode base64String}}}
base64String -- The string or field value to encode, for example connection.http.unencrypted.apiKey. Required.
Examples
Single field
{{{base64Encode record.email}}}
If record.email is jane.doe@example.com, the result is amFuZS5kb2VAZXhhbXBsZS5jb20=.
Username and password for basic authentication
{{{base64Encode (join ":" connection.http.unencrypted.username connection.http.encrypted.secret)}}}
This example uses the join helper to combine the username and the secret with a colon separator — the format HTTP basic authentication requires — and then encodes the combined string. If username is alice and secret is hunter2, the result is YWxpY2U6aHVudGVyMg==, which is the base64 encoding of alice:hunter2.
Notes and constraints
- Always use triple braces (
{{{ }}}). Double braces let integrator.io quote or escape the encoded value, which produces an invalid result. - Provide a valid string as input. If the input is empty or isn't a string, the helper can return an error or an unexpected value.