Guide How-to recipes

How-to recipes

On this page

Step by step, in the panel. Each step can also be done with an API key holding the matching section (see the API reference).

Answer questions from your documents

  1. Resources → New resource → Folder. Name ("Help centre"), summary ("Product FAQ, user manual and pricing questions for the PayNest app"). Create.
  2. Open it. Under Documents, Add documents: choose the files, keep Read on. Wait until each shows Read (minutes for large files).
  3. Access rules → Add rule: the folder, everything inside, Read, no conditions.
  4. Ask a question on any channel. The thread shows which document the answer came from.

Tips: one topic per folder; write summaries in your users' words; split huge documents if they mix unrelated subjects; a scanned PDF needs a text layer (run it through OCR first).

Hand over a file on request

  1. Upload the document with Shareable on (Read can be off for a file that only needs to be sent, such as a brochure PDF).
  2. Make sure a rule allows Read on it for the users who may get it.
  3. Users can now ask "send me the brochure". Telegram gets the file, email gets an attachment, the API gets a link in the reply. Too large for the channel: a download link (Company → Download links).

Connect your API

  1. Resources → New resource → API. Name, summary ("Order status and delivery tracking for shop customers"), base URL, and headers (such as Authorization: Bearer ...). Who decides access: usually Determesh, from the access rules.
  2. Add method for each endpoint: name (get_order_status), kind (Read), HTTP method and path (GET /orders/{order_id}), what it does ("Use when the customer asks where their order is"), what it returns, and parameters (order_id, STRING, path, required).
  3. Test each method with sample arguments.
  4. Access rules: allow Read on it, for everyone or for users with an attribute.
  5. Your API must be reachable from the internet. Determesh decides whether a user may use a method; it sends the method only the arguments, not who the user is. For data that belongs to one person, mark the parameter that identifies the person as filled by Determesh: see Keep each user to their own data.

Connect your database safely

  1. Create a read-only database login with access to only the tables needed.
  2. New resource → Database, then on its page the connection: engine, host, port, database, login, password, TLS. Allow our server's address in your firewall (ask hi@determesh.com for it).
  3. Add method: one SQL statement each, with :name parameters: SELECT day, status FROM attendance WHERE employee_id = :employee_id AND day >= :from Kind Read for queries (run read-only, they cannot change data); Write for INSERT/UPDATE.
  4. Test, then add rules. For personal data, mark the identifying parameter (such as :employee_id) as filled by Determesh: see Keep each user to their own data.

Run your own code

  1. New resource → Code, with the hosts it may reach (or none).
  2. On its page, write the script: export one function per method; use npm: or jsr: imports if needed; Save and build.
  3. Add Secrets for API keys it needs (read with Deno.env.get("NAME")).
  4. Add a method per exported function, test, add rules.

Keep payslips to staff, verified by email

  1. Identities: set attributes on each employee: role = staff, employee_id = 1042, and their work email if you want to match it (or let your HR system set them through the API).
  2. A verifier: an API or code resource with purpose Verifier, with two methods: one that emails a one-time code to the address given (it can use sendEmail in its answer), and one that checks the code and, when right, answers {"verified": {"channel": "EMAIL", "externalId": "<the email>"}}.
  3. The payslips resource (API, code or database) with a method get_payslip(employee_id, month), where employee_id is filled by Determesh from the user's attribute employee_id (or email from the email linked to the user).
  4. Access rules → Add rule: the payslips resource, Read, role is staff, Also verified by the verifier, 1 hour.
  5. In chat the assistant now asks for the work email, sends the code, checks it, and only then may use the payslips resource. Test with Identities → a user → What they can reach.
  6. Because employee_id is filled by Determesh, each person only ever gets their own payslip, whatever they ask for.

Keep each user to their own data

Access rules decide whether a user may use a resource or method. To make sure a method returns only that user's records, have Determesh fill the identifying parameter itself:

  1. Make sure each user carries the identifier your system uses: set an attribute such as employee_id on each identity (Identities page, or from your HR system through the API), or rely on the email linked by a verifier.
  2. On the method, tick filled by Determesh for that parameter (such as employee_id) and choose from an attribute of the user → employee_id (or the email linked to the user).
  3. Your system just uses the value it receives: GET /payslips?employee_id=…&month=…, or WHERE employee_id = :employee_id.

The AI never sees or sets that parameter, so a user cannot get someone else's records by asking. A user with no value gets told it cannot be done for them yet. See Parameters filled by Determesh.

Let managers approve requests

  1. A leave resource with apply_leave (Write) whose answer includes {"sendMessage": {"channel": "TELEGRAM", "to": "<manager's Telegram ID>", "text": "Ravi asks for leave on 3 Dec. Approve?", "awaitReply": true}}, and a method to record the decision.
  2. The manager must have opened a chat with your bot once. Their reply ("yes") comes back to the leave resource's assistant, which records it; the employee is told.
  3. Watch it on the Requests page.

Receive webhooks from another service

On an API or code resource, add a method with one OBJECT parameter named call, then Webhooks → Make webhook with that method. Give the URL (shown once) to the other service (a payment provider, a form tool). Each call it makes is passed to your method.

Set up Telegram

  1. @BotFather → /newbot → copy the token.
  2. Channels → Connect a bot with the token and a summary.
  3. Optionally limit it to allowed user IDs or groups.
  4. In groups, users mention the bot or reply to it.

Answer a support mailbox

  1. Create an app password for the mailbox (Gmail and Microsoft 365 need one).
  2. Channels → Connect a mailbox with IMAP and SMTP details; optionally only senders from your domains.
  3. New mail from then on is answered from the mailbox's own address.

Add chat to your own app

  1. Channels → Issue a key with the Chat section and your webhook URL; save the three secrets.
  2. Your backend signs POST /v1/messages with your user's ID and text, and receives the reply on the webhook (or reads the thread). See the Developer API.
  3. Never call the API from the browser or app directly: keep the key on your server.

Put a chat box on your website

  1. Channels → Website widgets → Add a widget: the sites it runs on (such as https://shop.example.com), its title, colour and greeting. Save the signing secret on your server.
  2. Add a route on your site, such as GET /determesh-widget-token, that answers a token for the signed-in visitor: their ID, name and attributes, signed with the secret, expiring in an hour. See Website widget for Python and Node.js.
  3. Paste the snippet from the panel into your pages. Visitors chat at the bottom of the page; their conversations are under Threads as "Website widget".

Let your HR system keep attributes up to date

Issue a key with the Identities section only. From your HR system: find each user (GET .../identities/lookup by channel ID) and set attributes (PUT .../identities/{identityId}/attributes) when people join, move or leave.

Give a colleague limited access

Sub users → Add a sub user with their email, the sections they need (such as Resources and Threads) and the folders (such as HR, Manage). They set their own password and authenticator.

Top up credits

Write to hi@determesh.com naming the credit package. Credits are added when the payment arrives. See Payments and invoices.

This page is made from /docs/v1/recipes.md, the Markdown that AI assistants read. Questions: hi@determesh.com.