Awesomate docs v0.27.0

Guides

Ask by text

A help box in your app that answers from the business's own content, with sources, as the person who is signed in.

app.ask() puts a question to the account's agent and gets back an answer from the business's content, with the sources it came from. Use it for a help box in a customer portal: "What time do you open on Saturday?", "Do you cover Tweed Heads?".

It needs Agents in your app on the account (Support Plus and above), an app (Pro and above), and the account's Knowledge switched on.

1. Set it up

The agent is the one the account picked for the app, the same one Talk by voice uses:

  1. An agent. In the hub, Agents: make or pick one, switch on In your app, and make your changes live.
  2. Pick it for the app. On the app's page (Website, Apps, then the app), choose it under Talk by voice. Or ask Claude Code: awesomate_crm_apps, update with voice_agent_id.

2. Ask

const form = document.querySelector('#help') as HTMLFormElement;
form.addEventListener('submit', async (e) => {
  e.preventDefault();
  const q = (form.elements.namedItem('q') as HTMLInputElement).value;
  const a = await app.ask(q);
  console.log(a.answer);                                      // the answer
  for (const s of a.sources) console.log(s.title, s.url);     // where it came from
  if (a.questionNotice) console.log(a.questionNotice);        // show this with the first answer
});

status is answered when the business's content had the answer, with at least one source. It's none when it didn't, and then answer says so. Show the sources with the answer, so people can check it.

Show questionNotice when it comes. It's the platform's sentence about keeping questions it couldn't answer, and it comes with a person's first answer only. It isn't repeated after that.

What the agent answers from

  • Only the business's content, through the agent's published settings, with sources. Nothing is made up, and no other AI rewrites the answer.
  • Only what this person may see. If the account uses customer groups in Knowledge, the agent answers from that person's groups. If none are theirs, the answer is "I can't answer that here."
  • Not the voice persona. The greeting by name and the brief about the person's recent records are for Talk, not for text.

Nothing anyone types is stored by the hub. The account's Conversations shows how many questions each person asked in a day, and how many had no answer.

Limits

One person 30 questions a day
One agent, per day Support Plus 300, Pro 1,000, Embedded 3,000
Each answer also counts toward the account's monthly Knowledge answers

When a question is refused

ask() throws an AwesomateError. Its serverCode says why, and its personMessage is a sentence to show:

serverCode Means
no_agent The app has no agent picked.
channel_off, unpublished The agent's In your app is off, or it has no live version.
person_daily, agent_daily A daily limit above is reached.
answers_used_up The account's Knowledge answers for the month are used.
plan_required, consent_required The account's plan or Knowledge switch doesn't allow it.