---
title: text
description: "Make a string from literal text and Effect secrets, as a tagged template: `` text`Token ${secret(\"x\")}` ``."
---

# `text`

Function, in `@jr2/orchestrator/src/http-effect.ts`. It is an export of `@jr2/orchestrator`, on the [Authoring surface](../authoring-surface.md) page, in Effects.

```ts
function text<
  const V extends Array<Secret | OpenSecret | string>,
>(
  strings: TemplateStringsArray,
  ...values: V,
): MarkedIf<V[number], Text>
```

Make a string from literal text and Effect secrets, as a tagged template:
`` text`Token ${secret("x")}` ``. The Effector puts in the value of each secret when it makes
the call. Use it for a url with a secret in its path, or for a header value. Use it also for
`auth`, where it is the whole `Authorization` header, or for a part of `basic`.

It refuses a `${…}` that is not a `secret(...)` or a string: `` text`…`: a value is a
secret("name") or a string, got <value> ``.

**Parameters**

- `strings`: The literal text of the template.
- `values`: The `${…}` values, each a `secret(...)` or a string.

**Returns**: The string, which the Effector makes.

**Example**

```ts
import { http, jr2Setup, secret, text } from "@jr2/orchestrator";

export const machine = jr2Setup({
  actors: {
    notify: http({
      method: "POST",
      url: text`https://api.telegram.org/bot${secret("telegram")}/sendMessage`,
      headers: { "x-run-source": text`jr2` },
      request: () => ({ json: { chat_id: "12345", text: "The run is done." } }),
    }),
  },
}).createMachine({
  id: "notify",
  initial: "notifying",
  states: {
    notifying: { invoke: { src: "notify", onDone: "done" } },
    done: { type: "final" },
  },
});
```

**See also**

- [Run a command or call a URL with an Effect](../../guides/run-a-command-or-call-a-url.md)
- [Secrets and trust](../../concepts/secrets-and-trust.md)
- [ADR-0068: An Effector holds an Effect's secrets and signs its wire](../decisions/0068-an-effector-holds-an-effects-secrets-and-signs-its-wire.md)
