Xero

Create Xero Draft Invoice

Creates a draft sales invoice with one line for an existing contact.

Unverified

Add this first. This tool needs an access token, so add Get Xero Access Token to the same bot. The bot calls it first and passes the token in.

What the model is told

Create a draft sales invoice in Xero for an existing contact. Get a Xero access token first if you do not already have one. You need the ContactID from Get Xero Contact by Email or Create Xero Contact. Confirm the description, quantity and unit price with the customer first. The invoice is left as a draft for staff to review and approve, and nothing is sent. Tell the customer it will be reviewed.

Request

PUThttps://api.xero.com/api.xro/2.0/Invoices

Headers

  • Content-Typeapplication/json
  • AuthorizationBearer {{accessToken}}
  • xero-tenant-idYOUR_XERO_TENANT_ID
  • Acceptapplication/json

Body

{
  "Type": "ACCREC",
  "Status": "DRAFT",
  "Contact": {
    "ContactID": "{{contactId}}"
  },
  "LineItems": [
    {
      "Description": "{{description}}",
      "Quantity": "{{quantity}}",
      "UnitAmount": "{{unitAmount}}",
      "AccountCode": "{{accountCode}}"
    }
  ]
}

Parameters

  • contactId stringThe Xero ContactID.
  • description stringWhat the line is for.
  • quantity numberHow many units, as a number.
  • unitAmount numberThe price of one unit as a number, without a currency symbol.
  • accountCode stringThe sales account code from your chart of accounts.
  • accessToken stringThe access_token value returned by Get Xero Access Token. Reuse it for the rest of the conversation.

Engage payload

{
  "source": "VOICE_AI",
  "tool": {
    "id": "f544411a-eb60-4d6f-a5fb-a6133f846b23",
    "type": "HTTP_REQUEST",
    "label": "Create Xero Draft Invoice",
    "name": "create_xero_draft_invoice",
    "customName": false,
    "description": "Create a draft sales invoice in Xero for an existing contact. Get a Xero access token first if you do not already have one. You need the ContactID from Get Xero Contact by Email or Create Xero Contact. Confirm the description, quantity and unit price with the customer first. The invoice is left as a draft for staff to review and approve, and nothing is sent. Tell the customer it will be reviewed.",
    "parameters": [
      {
        "name": "contactId",
        "type": "string",
        "description": "The Xero ContactID."
      },
      {
        "name": "description",
        "type": "string",
        "description": "What the line is for."
      },
      {
        "name": "quantity",
        "type": "number",
        "description": "How many units, as a number."
      },
      {
        "name": "unitAmount",
        "type": "number",
        "description": "The price of one unit as a number, without a currency symbol."
      },
      {
        "name": "accountCode",
        "type": "string",
        "description": "The sales account code from your chart of accounts."
      },
      {
        "name": "accessToken",
        "type": "string",
        "description": "The access_token value returned by Get Xero Access Token. Reuse it for the rest of the conversation."
      }
    ],
    "config": {
      "endpoint": {
        "method": "PUT",
        "url": "https://api.xero.com/api.xro/2.0/Invoices"
      },
      "headers": [
        {
          "name": "Content-Type",
          "value": "application/json"
        },
        {
          "name": "Authorization",
          "value": "Bearer {{accessToken}}"
        },
        {
          "name": "xero-tenant-id",
          "value": "YOUR_XERO_TENANT_ID"
        },
        {
          "name": "Accept",
          "value": "application/json"
        }
      ],
      "body": "{\n  \"Type\": \"ACCREC\",\n  \"Status\": \"DRAFT\",\n  \"Contact\": {\n    \"ContactID\": \"{{contactId}}\"\n  },\n  \"LineItems\": [\n    {\n      \"Description\": \"{{description}}\",\n      \"Quantity\": \"{{quantity}}\",\n      \"UnitAmount\": \"{{unitAmount}}\",\n      \"AccountCode\": \"{{accountCode}}\"\n    }\n  ]\n}",
      "timeout": null
    }
  }
}

IDs are regenerated on every copy.