UNPKG

@awesomate/hosting-mcp

Version:

Awesomate MCP server — lets Claude manage your Awesomate WordPress hosting, plan, limits, n8n automations, and build Node/static apps + databases

67 lines (54 loc) • 3.97 kB
# Hold for a decision: a person's OK before an automation acts Use this when a workflow is about to do something a person should approve first: send a quote, give a refund or a discount, reply to a customer in words it wrote. The automation files a decision for a role on the business map; it goes to whoever answers for that role (or to the owners when the role is empty), waits in their Tasks in the hub and in an email, and the run carries on only when they answer. Nothing is ever approved on silence: after the deadline the run is resumed with `expired`. Check the map first: `awesomate_business_map` action `roles` gives each role's key (its slug). The decision has to name one. ## The shape ``` … → Hold for a decision (POST to the hub) → Wait (On Webhook Call) → IF approved → do the thing └ else → stop, or tell the customer "we'll be in touch" ``` 1. **Hold for a decision.** Use the Awesomate node's **Task: Hold for a Decision** (`holdForDecision`; see [awesomate-node.md](awesomate-node.md)): it reads the run's own resume address and id. Where their node does not have it yet (check its Operation list), use an HTTP Request node with the account's **Awesomate Hub** credential (check `hubNodeCredential` in `awesomate_n8n_context`: when it is missing, add it with `awesomate_n8n_hub_credential` (or the owner presses "Add it to my n8n" on the hub); when their n8n has no Awesomate node, use Generic Credential Type, Header Auth, **Awesomate Hub Key**, if the credential inventory has it): - `POST https://hub.awesomate.ai/api/hub-key/v2/<account>/decisions` - JSON body: ```json { "role": "quotes-and-follow-up", "title": "Refund $80 to a customer", "type": "yes_no", "context": "Their order arrived damaged.", "facts": { "amount": 80, "discount_pct": null, "new_customer": false }, "draft_field": "reply", "draft_node": "Write the reply", "workflow_name": "Refunds", "resume_url": "{{ $execution.resumeUrl }}", "execution_id": "{{ $execution.id }}" } ``` - `type` is `yes_no`, `approve_draft` (a message the person may edit: name the field and the node whose output holds it with `draft_field` and `draft_node`; the hub reads that one field live from the paused run and never stores it) or `pick_one` (with `options`, 2 to 5, each up to 60 characters). - `title` (up to 120) and `context` (up to 500) are plain text in your own words, never a customer's message. `facts` are numbers only; the card says they are as the automation reported them. - `expires_in_hours` is optional: 48 by default, 1 to 168. 2. **Wait.** A Wait node, Resume: On Webhook Call, HTTP Method POST, Authentication: Header Auth with the credential **Awesomate decision resume** (the hub places it on the instance the first time a decision is filed; the filing's answer names it). Limit the wait to the deadline plus an hour (49 hours for the default). 3. **IF** `{{ $json.body.decision }}` equals `approved`. The body also carries `edited_text` (the words the person approved, for `approve_draft`) and `pick` (the option chosen, for `pick_one`): use those, not your draft. Anything else (`rejected`, `expired`, or the Wait timing out) means do nothing. ## Rules - One decision per run, ever: the hub refuses a second one for the same execution. - A run of a workflow Awesomate built (an agent's actions gateway, a library install) cannot be held this way; agents already hold their own actions. - The Hub Key files only. It can never approve, read the answer, or cancel: the answer comes back only through the Wait. Never build a workflow that approves its own decision. - The account needs decisions switched on; until then the hub answers 403 `not_on`. Say so plainly. - The answers 4xx carry a sentence: relay it, don't guess around it.