See real questions answered, with the page each answer came from.

See the case studies
Start free

[ Developers ]

Four steps
to connect your product

Have your server sign a token (a pass) for each user, upload your OpenAPI file (the list of things your software can do), mark how careful each task is, then paste one script tag, a short line of code, into your web app.

fig 1. A token, then one script tag.

Step 1

[ Step 1 ]

Give each user a token
from your server

Orrin never sees your users’ passwords or sessions. Instead, your server signs a token for the signed in user: a short lived pass that proves who they are, signed with your account’s private key. The assistant checks the token on every request: its signature against your active keys, who it is for, when it expires and that it lasts no more than fifteen minutes.

What goes in the token

kid
Header. The key id shown in the console when you generated the key
sub
The user’s id in your system. Required
aud
orrin. Required
iat, exp
Required. exp at most fifteen minutes after iat
scopes
What the user may do, as an array or a space separated string
role
The user’s role in your product, shown when a preview is refused
company
The customer company the user belongs to. Optional
JavaScriptNode, jose
// Node with jose. Your route, behind your own sign in. The token lives ten minutes.
import { SignJWT, importPKCS8 } from "jose";
const privateKey = await importPKCS8(process.env.ORRIN_PRIVATE_KEY, "EdDSA");

app.get("/api/orrin-token", requireSession, async (req, res) => {
  const token = await new SignJWT({ company: req.user.companyId, role: req.user.role, scopes: req.user.scopes })
    .setProtectedHeader({ alg: "EdDSA", kid: ORRIN_KEY_ID })
    .setSubject(req.user.id)
    .setAudience("orrin")
    .setIssuedAt()
    .setExpirationTime("10m")
    .sign(privateKey);
  res.type("text/plain").send(token);
});
PythonFastAPI, PyJWT
# FastAPI with PyJWT (pip install pyjwt cryptography). The token lives ten minutes.
import time
import jwt

@app.get("/api/orrin-token", response_class=PlainTextResponse)
def orrin_token(user: User = Depends(current_user)):
    now = int(time.time())
    claims = {"sub": str(user.id), "company": user.company_id, "role": user.role, "scopes": user.scopes,
              "iat": now, "exp": now + 600, "aud": "orrin"}
    return jwt.encode(claims, ORRIN_PRIVATE_KEY, algorithm="EdDSA", headers={"kid": ORRIN_KEY_ID})

Steps 2 and 3

[ Step 2 ]

Upload
your OpenAPI file

Upload your OpenAPI file in the console, or link to it. Each item in it becomes a task Orrin could fill in, with a name, a description and the details it needs, all taken from your file. Nothing is exposed until you choose it.

[ Step 3 ]

Mark
each task’s level

Mark each task you turn on as Read (looks something up), Write (changes one record) or Sensitive (money, messages, or many records at once), and try a preview in the console. In your product, a preview is filled in only when the user’s scopes, the list of things that user may do, cover the task: resource:read for a Read task, resource:write for Write and Sensitive, where the resource is the first part of its path. POST /work-orders needs work_orders:write, and *:read or *:write cover every resource.


Step 4

[ Step 4 ]

Add the assistant
to your product

Paste in two tags and a button appears in the corner of your web app. It opens the assistant in a panel. The panel asks your page for the user’s token through orrinSettings.getToken, answers from your help pages with the source shown, and fills in task previews only within what that user may do. It loads only on the websites you approved in the console, and your workspace id is on its Embed and theme page.

HTMLAny web app
<!-- On every page where signed in users should see the assistant -->
<script src="https://orrin.live/embed.js" data-workspace="YOUR_WORKSPACE_ID" defer></script>
<script>
  window.orrinSettings = {
    // Called whenever the assistant needs a token: return the one your route signs.
    getToken: () => fetch("/api/orrin-token").then((response) => response.text()),
  };
</script>
JavaScriptOptional controls
// Optional, once the page has loaded
window.Orrin.open();   // also .close() and .toggle()

// Optional attributes on the script tag
// data-label="Help"          the button text (default "Ask")
// data-position="left"       the corner it sits in (default right)
// data-accent="#28e99f"      the button colour until your workspace's accent loads

Optional

[ Optional ]

Open a preview
in your own app

A preview never calls your API, and Orrin does not carry out the task. If your product should carry it out, set orrinSettings.onPreview to a function. Each task preview in the panel then shows an Open in your app button. When the user clicks it, your function receives the preview: the task’s name, method, path and level, the details Orrin filled in (proposed), the required details still missing (missing), and anything the user gave that no field can hold (unplaced, a list of text and reason, such as 10am with the reason that the task has no time field). Nothing the user said is dropped quietly: every detail is in proposed or in unplaced.

JavaScriptOptional, in the page that embeds the assistant
window.orrinSettings = {
  getToken: () => fetch("/api/orrin-token").then((r) => r.text()),
  // Optional: adds "Open in your app" to every action preview
  onPreview: (preview) => {
    // { name, method, path, level, summary, proposed, missing, unplaced }
    openWorkOrderForm({
      operation: preview.name,
      values: preview.proposed, // read from the request
      missing: preview.missing, // required, not read
      unplaced: preview.unplaced, // [{ text, reason }] supplied, but no field can hold it
    });
  },
};

What your product does

Open your own form for that task with the details filled in and the missing ones marked, and let the user confirm there, under your own checks. The preview goes only to the page that holds the assistant, and the panel sends it only after the user clicks.

See the host app where a preview opens that app’s own form.


Support

[ Support ]

Help when
you need it

Everyone with an Orrin account can reach the Orrin team from Contact Orrin in the console. The articles explain what to get ready before you connect your product.