Alya Books

    Help centre

    Guides for Alya Books and UAE e-invoicing

    Mailbox and file sources: let an agent file what arrives

    Connect a mailbox and a folder of a file store, choose what may be read, allow an agent, and review on the Sources list what it filed as draft bills and expenses, what it held and what it ignored. Every read is recorded, and nothing is accepted, posted, paid or sent by itself.

    A source is a mailbox, or a folder of a file store, that Alya Books looks into for you. Every 15 minutes it lists what is new there, and each new message or file appears under Purchases → Sources as an item: the sender, the title, the date and a short snippet. Filing an item copies its files into the document hub and reads them: a bill or a utility bill becomes a draft bill with its lines, a receipt becomes a draft expense, anything else stays a hub document. A person files, holds or ignores items by hand; an agent you allow does the same by itself. Nothing is accepted, posted, paid or sent by itself: every draft waits for a person.

    Where to find it:

    • Settings → Connections → Cloud storage: the cloud stores and, under them, the Mailboxes card. Click a connection's name to open its own page with the cards Scope, Agents allowed, Poll and Reads.
    • Purchases → Sources: what the sources found, with the status chips All, New, Filed, Held, Ignored and Failed, the Source filter and the search by title or sender.
    • Accounting → Agents: the library agent Inbox filer.

    Walkthrough: a week of bills from the purchasing mailbox

    Steps 1 to 6 need an owner or admin. An accountant can do the rest.

    1. Connect the mailbox. Open Settings → Connections → Cloud storage and click Connect Microsoft 365 on the Mailboxes card. Microsoft's consent screen opens: sign in with the mailbox that receives your suppliers' bills and accept. You come back to the tab with the notice Mailbox connected. Choose what may be read, then allow an agent. The consent asks for reading only: Alya Books never sends mail, changes a message or writes a file through this connection. The same consent adds a reading connection to that account's OneDrive, and to the SharePoint libraries it can open, in the list of cloud stores.
    2. Choose what may be read from the mailbox. Click the mailbox's name. On the Scope card fill in Folders, Senders (addresses or domains, separated by commas) and Since (the start date), and tick Attachments only when the message text should be left alone. Click Save scope. A typical scope is the folder your supplier invoices land in, since the first day of the month, attachments only.
    3. Choose the folder of the file store. Click the store's name in the list of cloud stores, name the folder under Folders on its Scope card and click Save scope. A store with no folder named lets nothing be read. See Folders an agent may read.
    4. Add the agent. Open Accounting → Agents, the Library tab, and click From the library on Inbox filer. The editor opens with its instructions and its five tools. Click Save agent.
    5. Allow the agent to read. On each connection's page, the Agents allowed card has a button that reads No agent. Click it, then Allow beside Inbox filer. The card now lists the agent with May read and who allowed it. Allow beside The assistant lets the AI assistant read the same source when a member asks it to.
    6. Decide whether the agent files without asking. Filing falls under the action policy Create a document, which is Review by default: the agent then holds each item it would have filed, with the reason "Waiting for a person to file it", and you file it yourself. To let the agent file by itself, open Settings → AI → Action policies and set Create a document to Auto for the source Agent. What it files is still only a draft.
    7. Wait for the poll, or click Poll now. The sources are listed every 15 minutes. Poll now on the connection's page lists one at once. New items appear under Purchases → Sources with the status New. A message shows how many files are attached.
    8. The agent runs. It starts by itself a few minutes after a poll that found something new, and once a day while items still wait as New; Run now on the Agents page starts it at once. It reads each new item, files what is a bill or a receipt, holds what it cannot place and ignores what is neither, each with its reason. After a week the list might read: nine attachments Filed as draft bills, one receipt as a draft expense, two messages Held, three newsletters Ignored. The run under Agents → Runs ends with the same counts.
    9. Review what it filed. Click the chip Filed and open a row. The panel shows the Text, the Attachments with a status each, What it became (a link such as Draft bill, which opens the draft), Handled (who, when and the reason) and Who read this. Open the draft, check the supplier, the dates and the lines against the file, and accept it as you accept any bill.
    10. Review what it held. Click the chip Held. Each row shows the agent's reason under the title. Open one and click File to file it yourself (tick the attachments to file only some; with none ticked, every attachment that is not filed yet is filed), Ignore when there is nothing to file, or Reopen to put it back to New. To work on several rows, tick them: the bar offers Hold, Ignore and Reopen, and afterwards Undo, which asks for a reason and puts every item back to the status it had.
    11. Undo one filing. Every filing is one change batch. Open Compliance → Batches (or the Batches of the agent's run), open the batch and click Undo with a reason. The draft is removed, its file goes to the Bin of the document hub, and the item reads New again. The item's panel marks the file In the Bin. If you want the file back without the draft, open Accounting → Documents, the Bin tab, and click Restore.

    On a test stack no provider is needed: Connect a mailbox offers Stub (local stack), a mailbox with sample mail, and Connect the local stub adds a test store.

    What an agent can never do

    • Accept, approve, post, pay or send. The Inbox filer has five tools: list the items, read one, file, hold and ignore. Accepting a bill, approving, posting an entry, recording a payment and sending a document are not among them, so every draft waits for a person. A draft made by an agent meets the same validation, rules and approval tiers as one you typed.
    • Read without a grant. An agent reads a source only while it holds a grant on that connection. Stop on the Agents allowed card ends the grant, and the agent's next read is refused. The assistant needs a grant of its own, and the member it acts for must be an owner, admin or accountant.
    • Read outside the scope. Only what lies inside the scope is listed. When you narrow the scope later, the items that were listed under the wider scope are refused too.
    • Read the whole mailbox. A listing carries the envelope and a snippet of at most 500 characters. The full text of a message is fetched only when someone opens that item, and that read is recorded.
    • Connect a source, change a scope or allow itself. Owners and admins do this in the app. The assistant has no tool for any of it, and no token is ever shown or returned.
    • Hold or ignore without a reason. An agent must say why. The reason is kept with the item and shown under its title.

    Who read what

    Every listing, read, filing, hold and ignore is recorded, whoever did it.

    • On the connection's page, the Reads card lists them newest first with Who, What and When. What is one of Listed the source, Read an item, Filed an item, Held an item and Ignored an item, with a link to the item. Who is the member, the agent (with Open the run), The assistant, An API key or The scheduled poll.
    • On an item, the panel's Who read this lists the same rows for that item. Opening the panel is itself a read and is recorded under your name.
    • The rows cannot be edited or deleted. Each filing, hold and ignore is also in the audit log, with the agent and its run.

    The poll and a paused source

    The Poll card of a connection shows Last listed, Failures in a row, the Items found and the Interval in minutes. The interval is 15 minutes unless you set another one, from 15 to 1,440 (24 hours), with Save interval.

    When the provider refuses a listing, the connection reads Error with the provider's message, and the person who connected it gets the notification Source could not be read. After three failed listings in a row the source is Paused and nothing more is listed. Fix the cause, then click Resume on the connection's page.

    Plans and roles

    • Mailbox and file sources belong to the Professional and Enterprise plans. On another plan the Sources page says that sources are not part of your plan, and the Mailboxes card names the plan that carries them, for example In Professional. Connecting a new mailbox needs the plan as well: on another plan the connection is refused, in the app, through the API and at the Microsoft sign-in, and so is a read scope with folders on a file store.
    • Owners and admins connect and disconnect a source, set its scope and its interval, allow and stop an agent, and use Poll now and Resume.
    • Owners, admins and accountants work the Sources list: open, file, hold, ignore, reopen and undo. A person needs no grant, only the role, and every read is still recorded.

    Troubleshooting

    • The source reads Paused. Three listings in a row failed. The Poll card shows the Last error from the provider: a consent that was withdrawn, a folder of the scope that was deleted, a sign-in that expired. Connect the mailbox again or correct the scope, then click Resume.
    • An item is refused as out of scope (source_out_of_scope). The scope was narrowed after the item was listed, so its folder, sender or date no longer lies inside it. An owner or admin widens the scope on the Scope card, or you leave the item alone.
    • The agent or the assistant is refused (source_not_granted). It holds no grant on that connection, or the grant was stopped. An owner or admin clicks Allow on the Agents allowed card. For the assistant, the member asking must also be an owner, admin or accountant.
    • The agent held everything with "Waiting for a person to file it". The action policy Create a document is on Review. File the items yourself, or set the policy to Auto for agents (step 6).
    • Nothing arrives. Check the scope: a store with no folder named lists nothing, and a Since date or a sender list may shut everything out. Click Poll now and look at the Reads card: each poll adds a row Listed the source.
    • A filed file says "Waiting to be read." The file was copied into the hub but could not be read yet, for example because AI reading is not enabled or the AI credits are used up. No draft was made; the item reads Filed because the file is in the hub. The file is tried again automatically: first at the next quarter of an hour, then at growing intervals, eight tries over about a day and a half. The item's panel and the file's preview in the hub show the tries made and the next one, for example Waiting to be read. Tried 2 of 8 times; next try …. When the file is read, its draft bill or draft expense is made by itself, inside the same filing, so undoing the filing (step 11) still takes the file and the draft back as one. You do not have to wait: open the file in the hub and click Read with AI; when it is read as an invoice, Create a bill makes the draft.
    • A filed file says "Could not be read after 8 tries." The eighth try failed, and the file is not tried again. The notification A file could not be read says so and opens the file. Open the file in the hub and click Read with AI to try now, or enter the bill by hand.
    • An old Word or Excel file was not filed. Files ending in .doc and .xls are not read. Ask the sender for .docx, .xlsx, CSV or PDF.
    • Microsoft shows "Need admin approval". Your Microsoft 365 tenant restricts what users may consent to. Ask your Microsoft 365 administrator to approve the application, then connect again.

    Through the API and an assistant

    • Items: GET /sources/items (filters sourceKind, connectionId, status, search), GET /sources/items/{id} (the item with its text, its attachments, what it became and who read it), POST /sources/items/{id}/file (with attachmentIds to file only some), /hold and /ignore (with reason), /reopen, and POST /sources/items/status for several items in one batch.
    • Connections: GET /connections/{kind}/{id} with kind mailbox or store, PATCH /connections/{kind}/{id}/poll (pollIntervalMinutes, resume), POST /connections/mailboxes/{id}/poll and POST /connections/storage/{id}/poll (Poll now), and GET /connections/source-reads (the read audit). The poll routes need an owner or admin, also behind an API key.
    • AI assistants use list_source_items, read_source_item, file_source_item, hold_source_item and ignore_source_item. Filing asks you to confirm first. Holding and ignoring need a reason. Each tool is refused with source_not_granted until The assistant is allowed on the connection.

    Still stuck? Contact support