Knowledge

Keep each bot's knowledge up to date: documents under your own IDs, websites and files, or your own API for content that stays on your side.

A bot answers from three kinds of knowledge. Pick by how your content changes and where you want it to live.

KindBest forUpdate and delete
DocumentsMany separate items you manage in your own system: stories, articles, a bio, product pages.Push again under the same external_id to replace; delete by ID. Stored and indexed by Heyllo.
SourcesA website to crawl, PDFs and other files, one text block, a Q&A set.The same URL or file name replaces; delete by URL, file name or source.
ActionsContent you do not want copied into Heyllo, a search across all of your users, or live data such as orders.Nothing to sync: the bot calls your own API during the conversation.

Documents

A document is one piece of content under an ID of yours (external_id, up to 191 letters, digits and . _ : @ + = -). Pushing the same ID again replaces that document and nothing else. Pushing it unchanged does nothing and costs no ingested words. Each document is indexed on its own, so the bot can cite it by its title and url.

Create or replace one document
curl -X PUT https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2/knowledge/documents/story-1042 \
  -H "Authorization: Bearer $HEYLLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Sailing to Lamu by dhow",
    "content": "We left Malindi at dawn...",
    "url": "https://stories.example.com/s/1042",
    "metadata": { "author_id": "u_381" }
  }'

Send up to 100 at a time with POST /bots/{id}/knowledge/documents and {"documents": [...]}. The response lists every document with its status and, when something needed indexing, a knowledge job. A document is processing until its job ends, then ready or failed (with an error). One failing document does not fail the others; only words of indexed documents count towards your usage.

Delete documents
curl -X DELETE https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2/knowledge/documents/story-1042 \
  -H "Authorization: Bearer $HEYLLO_API_KEY"

curl -X DELETE https://api.heyllo.co/v1/bots/bot_k3x9q2m7v1p8z4w6t5r0y2/knowledge/documents \
  -H "Authorization: Bearer $HEYLLO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "external_ids": ["story-7", "story-9"] }'
Deletes take effect at once, even while a document is still being indexed. To keep a bot in step with your system, push on create and edit, delete on removal, and re-push documents whose status is failed.

Websites, files, text and Q&A

Each add call replaces by a key, and has a matching DELETE:

AddSending it againRemove
POST /knowledge/urlThe same URL is crawled again and replaces the old copy. A different URL is added.DELETE /knowledge/url?url=...
POST /knowledge/filesA file with the same name replaces the old one. A new name is added.DELETE /knowledge/files?name=...
POST /knowledge/textReplaces the bot's single text block.DELETE /knowledge/text
POST /knowledge/qaReplaces the whole Q&A set.DELETE /knowledge/qa
A bot has one text block. Sending many separate texts with /knowledge/text keeps only the last one; use documents instead.

GET /knowledge/sources lists what was added this way (paginated), and DELETE /knowledge/sources/{source_id} removes a whole source.

Common setups

A bot per user that knows only that user's content

  • Hosted: push each of the user's items to their bot as a document, one document per item, in batches of up to 100. There is no limit on the number of documents.
  • Your API: link the user's bot to your search action with params such as {"author_id": "u_381"}, and filter on it in your API (or use {{workspace.external_id}}, which Heyllo fills in).

One bot that searches across all of your users

An action belongs to your organisation, not to a workspace, so any bot in any of your workspaces can use it. Create a bot for your site-wide search and link the same action without params; your API then searches everything. Nothing is copied into Heyllo.

Which key you need

No key needs every scope. The agent's calls to your API use your action's own headers, not a Heyllo key.

ToScopeKey binding
Push and delete documents and sourcesknowledge:writeAny (organisation, workspace or bot)
Create, change, test or delete an actionactions:manageOrganisation
Link actions to a bot, set its paramsbots:writeOrganisation
Create or rename workspacesworkspaces:writeOrganisation