This is part 16 of the ByteChef Embedded series. Read the original guide on the ByteChef blog.

Your integration catalog grows faster than your customers' plans do. Salesforce is a premium add-on, HubSpot isn't cleared for EU customers yet, and a beta automation is meant for a handful of accounts. Yet the Integration Marketplace, the Automation Hub and your own catalog pages show everything to everyone, because nothing has told them otherwise.

Workflow inputs have a smaller version of the same problem. A workflow may need an account ID or region that you, the vendor, set once, but the Connect dialog renders every input as a field the user can edit.

This post covers the two switches that fix this in ByteChef Embedded: permission expressions and internal-only inputs.

TL;DR

  • A permission expression on an integration, automation project or workflow decides which connected users are offered it, based on metadata you attach to each user.
  • Anything other than a clean true hides the resource. Typos fail closed.
  • The same expressions, used as an assignment rule, pick which configuration a new user lands on.
  • Internal-only inputs keep values you own out of the Connect dialog, and the server enforces it.

Three questions, three settings

Question Setting Where you set it Who reads it
Should this user be offered this integration, automation or workflow? Permission expression Integration, project and workflow dialogs The server, every time it builds a user's catalog
Which configuration should a new user get? Assignment rule Integration and automation configuration dialogs The server, once, when the user is first placed
Should the user fill in this input, or should I? Internal only Workflow editor → Workflow Inputs The Connect dialog, which leaves the input out

All three are Enterprise Edition features of ByteChef Embedded.

Where an expression lives

Every gateable resource has a Permission Expression text box in its dialog. Empty means no restriction.

Resource Where What false hides
Integration Embedded → Integrations → New / Edit Integration The integration and all its workflows
Integration workflow Embedded → Integrations → workflow row menu → Edit That one workflow
Automation project Embedded → Automations → New / Edit Project The project and all its templates
Automation workflow Automation editor → Create / Edit Workflow That one template

The Edit Integration dialog with metadata['plan'] == 'pro' in the Permission Expression box

Levels nest: a resource is offered only if every level above it passes. That lets you ship broadly and still hold one piece back, for example Salesforce for every paying customer, but its "bulk export" workflow only for enterprise accounts.

The Edit Workflow dialog with metadata['tier'] == 'gold' in its Permission Expression field

When changes take effect: integration, project and automation workflow expressions apply on the next catalog request, no publish needed. Integration workflow expressions are the exception: they live in the integration's draft and reach users at the next publish.

What an expression can see

Variable Type Holds
metadata map of string → string Key/value metadata on the user (plan, region, flags)
externalId string The user's ID in your system (the JWT sub)
email string or null The user's email, if set
name string or null The user's display name, if set
environment string DEVELOPMENT, STAGING or PRODUCTION

That's the entire surface, on purpose. ByteChef doesn't need to understand your entitlement model; you mirror the parts that matter onto each user as metadata.

environment is the one you don't set. Since integrations are shared across environments, environment != 'PRODUCTION' keeps a half-finished integration visible to test users and hidden from real customers.

Writing expressions

Expressions use ByteChef's expression language (SpEL with a locked-down context). Each of these is true for a user with plan: pro, region: eu, seats: 5 and email jane@acme.com:

metadata['plan'] == 'pro' metadata['plan'] matches 'pro|enterprise' metadata['region'] == 'eu' and !(metadata['plan'] == 'free') equalsIgnoreCase(metadata['region'], 'EU') int(metadata['seats']) > 3 contains(email, '@acme.com') environment != 'PRODUCTION' || metadata['plan'] == 'pro' 

Three rules worth memorizing:

  1. No method calls. email.endsWith('@acme.com') is rejected before it runs. Use matches or formula functions like contains(...) instead. T(...) and new are rejected too.
  2. Metadata values are always strings. Send "beta": true and ByteChef stores "true". Compare with == 'true' and wrap numbers in int(...).
  3. Comparisons are case-sensitive. Normalize values when you write them, or use equalsIgnoreCase(...).

Fail closed, on purpose

Expression Result
Blank Visible
true Visible
false Hidden
Anything else (e.g. a string) Hidden
Syntax error, method call, type error Hidden, with a hiding (fail closed) warning in the server log

One trap fail-closed can't catch: metadata['plan'] != 'free' is true for a user with no plan at all, because a missing key reads as null. Prefer positive checks like == 'pro'.

Where ByteChef applies them

Expressions are evaluated server-side, per request, on every catalog path:

  • Listing integrations and automation projects leaves hidden resources out.
  • Fetching a hidden integration returns 404, not 403, so its existence doesn't leak.
  • Connecting, enabling a workflow, copying or provisioning a template all return 404 for hidden resources.
  • Admin provisioning in Embedded → Connected Users only offers what that user can see.

Disabling isn't gated, so users can still turn off a workflow you've since hidden.

Assignment rules: staged rollouts for free

Both configuration dialogs have an Assignment rule box. It takes the same expressions but answers a different question: which configuration should a new user be placed on? It's checked once, at placement.

The Edit Configuration dialog with metadata['beta'] == 'true' in the Assignment rule field

Among the enabled configurations whose rule passes, ByteChef picks the highest version (ties go to the newest). That gives you a clean rollout pattern:

  • Configuration on v3, empty rule → everyone
  • Configuration on v4, rule metadata['beta'] == 'true' → beta users

When v4 is ready, widen the rule. Existing users stay where they are until you move them, because rules don't re-run when metadata changes.

Giving users metadata

An expression is only as good as the metadata behind it. You have three options.

1. In the admin UI. Embedded → Connected Users lets you create users with metadata rows, bulk-import from CSV, or edit an existing user. Saving replaces the user's metadata with exactly what's in the form.

The Edit connected user dialog with plan = pro and region = eu

2. With the user's token. PATCH /api/embedded/v1/me merges keys into the metadata of the user the JWT belongs to:

PATCH /api/embedded/v1/me Authorization: Bearer <connected user's JWT> X-Environment: DEVELOPMENT Content-Type: application/json { "plan": "pro", "region": "eu", "email": "jane@acme.com" } 

Keep the body flat, always send X-Environment (it defaults to PRODUCTION), and note that null doesn't delete a key; write a new value instead.

3. From your backend. The natural place is the route that already signs your users' tokens:

const account = await lookUpAccount(externalUserId); await fetch(`${process.env.BYTECHEF_APP_BASE_URL}/api/embedded/v1/me`, { method: 'PATCH', headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json', 'X-Environment': 'DEVELOPMENT', }, body: JSON.stringify({ email: account.email, name: account.name, plan: account.plan, region: account.region, }), }); return {token}; 

Doing this on every mint means a plan change in your system reaches ByteChef at the next session refresh.

Why not put the plan in the JWT? ByteChef only reads sub, the optional environment claim and connectionDialogAllowed from the token. A plan claim does nothing for your expressions.

Setting expressions from code

If you manage your catalog from code, the admin API exposes every field. One warning stands out: updating an integration with PUT /api/embedded/internal/integrations/{id} replaces the whole object, so an update without permissionExpression clears the gate. It's the one failure here that doesn't fail closed.

Internal-only inputs

Some inputs aren't questions for your users at all: your account ID, a fixed API region, a default your support team relies on.

To mark one: open the integration's workflow editor → Workflow Inputs → New Input (or edit one) → set Internal only to True → Save.

The Create a new Input dialog for accountId with Internal only set to True

The definition stores it as a flag:

{ "inputs": [ {"name": "accountId", "label": "Account ID", "type": "string", "internalOnly": true}, {"name": "channel", "label": "Channel", "type": "string"} ] } 

What happens next:

  • You fill internal-only inputs once per configuration in Embedded → Integration Configurations.
  • Users only see the rest in the Connect dialog (@bytechef/embedded 0.4.0+) and in the MCP Tools tab.
  • At run time the configuration's value always wins for internal-only inputs, and it never leaves the server.
  • The server enforces it: a hand-crafted request that sends an internal-only key has that key dropped.

For automations, the equivalent is a provided input on an Automation Configuration. Trying to override one returns 409.

Gotchas

  • Metadata is writable from the user's token, which lives in the browser. Treat expressions as a catalog filter, enforce anything paid for on your side, and rewrite metadata from your backend on every token mint.
  • Expressions aren't a security boundary. The AI builders don't read them, and tenant isolation is what keeps customers' data apart.
  • Method calls fail closed and hide the resource from everyone.
  • Negative checks pass on missing keys.
  • Numbers and booleans are strings.
  • Assignment rules don't re-run. Move existing users yourself.

Before you go to production

  • [ ] Document your metadata keys and values, with exact spelling and case
  • [ ] Write metadata from your backend on every token mint, with an explicit X-Environment
  • [ ] Backfill existing users via CSV import before the first expression goes live
  • [ ] Prefer short, positive expressions
  • [ ] Test each expression with two users: one who should see the resource and one who shouldn't
  • [ ] Watch the log for hiding (fail closed) warnings
  • [ ] Publish after changing a workflow-level gate
  • [ ] Fill every internal-only input in each environment's configuration

Try it in five minutes

In Embedded → Connected Users, give your sample app's demo user plan = free. Put metadata['plan'] == 'pro' on one integration and reload the Integrations page: it's gone. Change the plan to pro and it's back. Then mark one workflow input Internal only and watch it move from the Connect dialog to the configuration dialog.

Next up, part 17: Embedding Securely, covering which sites may frame your embedded pages, how the embed handshake checks origins, and who can run the admin side.

📖 Read the full guide on the ByteChef blog · ⭐ ByteChef on GitHub