| name | morning-invoice |
| description | Create invoices via Morning API. Use for: create invoice, batch invoices, tax invoices. |
Morning Invoice Skill
Generate invoices using the Morning (Green Invoice) API for workshop participants and course customers.
Overview
This skill integrates with Morning (greeninvoice.co.il) to:
- Create individual invoices (ืืฉืืื ืืช ืืก / ืงืืื)
- Batch process invoices from a customer table
--preview flag โ real PDF preview via Morning's /documents/preview endpoint (does NOT issue)
- Track processed customers to avoid duplicates
Mandatory workflow: preview โ confirm โ issue
Every single-invoice issuance MUST be a two-step flow:
- Run with
--preview first โ opens real PDF for review (not issued, not in Morning's records)
- User confirms the PDF looks right
- Re-run with the exact same args minus
--preview โ issues the binding tax invoice
A tax invoice (ืืฉืืื ืืช ืืก) is irreversible once issued. Never skip step 1.
Setup
Prerequisites
- Morning Account: Active account at morning.co.il or greeninvoice.co.il
- API Credentials: Get API key and secret from Morning dashboard
Installation
cd /Users/aviz/architect-workshops/.claude/skills/morning-invoice/scripts
npm install
Environment Variables
Create .env file in the scripts folder:
cp .env.example .env
Required variables:
| Variable | Description |
|---|
MORNING_API_KEY | Your Morning API key (UUID format) |
MORNING_API_SECRET | Your Morning API secret |
MORNING_BASE_URL | API endpoint (production or sandbox) |
MORNING_ENVIRONMENT | production or sandbox |
API URLs:
- Production:
https://api.greeninvoice.co.il/api/v1
- Sandbox:
https://sandbox.d.greeninvoice.co.il/api/v1
Usage
Commands
npx ts-node invoice.ts test
npx ts-node invoice.ts dry-run
npx ts-node invoice.ts create-single --name "Test Customer" --email "test@example.com" --phone "0501234567" --amount 500 --description "Workshop" --preview
npx ts-node invoice.ts create-single --name "Test Customer" --email "test@example.com" --phone "0501234567" --amount 500 --description "Workshop"
npx ts-node invoice.ts create-single \
--name "Company Ltd" --tax-id "517093746" \
--emails "contact@company.co.il,dokka@company.co.il" \
--phone "0501234567" --amount 500 \
--payment "ืืขืืจื ืื ืงืืืช" --date "2026-03-15" \
--description "ืกืื ืช AI" --preview
npx ts-node invoice.ts batch --file customers.md
npx ts-node invoice.ts batch --file customers.md --start 5 --limit 10
Options
| Option | Description | Default |
|---|
--file | Path to customer markdown table | Required for batch |
--start | Start from customer ID | 1 |
--limit | Max invoices to create | All |
--dry-run | Preview only, don't create | false |
--skip-existing | Skip already processed customers | true |
Customer Table Format
Create a markdown file with this table structure:
| # | Name | Phone | Email | Amount | Title | Description | Payment Method |
|---|------|-------|-------|--------|-------|-------------|----------------|
| 1 | ืืฉืจืื ืืฉืจืืื | 0501234567 | israel@email.com | 500 | ืกืื ื | ืงืืจืก | ืืื |
| 2 | ืฉืจื ืืื | 0521234567 | sarah@email.com | 400 | ืกืื ื | ืงืืจืก (ืฉืืชืฃ) | ืืขืืจื ืื ืงืืืช |
Payment Methods:
ืืื / ืืคืืืงืฆืืืช ืชืฉืืื โ Type 10 (App payment)
ืืขืืจื ืื ืงืืืช โ Type 4 (Bank transfer)
Business Invoices (Company Clients)
For B2B invoices to companies, create-single supports:
--tax-id <HP> โ company ื.ืค. (tax ID). Required for a valid Israeli tax invoice to a business.
--emails "a@b.com,c@d.com" โ comma-separated list of recipients. Morning sends the PDF to all of them. Use this for companies that have a dedicated doc-intake inbox (e.g. dokka.co.il) alongside the contact person.
VAT is calculated automatically: pass the gross amount (VAT included) via --amount. Morning splits it using the current rate (18% as of 2025).
Invoice Details
The skill creates Type 320 invoices (ืืฉืืื ืืช ืืก / ืงืืื with VAT):
| Field | Value |
|---|
| Type | 320 (Invoice/Receipt) |
| Language | Hebrew (he) |
| Currency | ILS |
| VAT | Included in price |
| Payment Terms | 30 days |
| Signed | Yes |
| Email Attachment | Yes |
API Reference
Authentication
Morning uses JWT token authentication:
POST /account/token
Body: { id: API_KEY, secret: API_SECRET }
Response: { token: "jwt...", expires: timestamp }
Authorization: Bearer <token>
Create Invoice
POST /documents
{
type: 320,
lang: 'he',
currency: 'ILS',
vatType: 0,
client: {
name: "Customer Name",
emails: ["email@example.com"],
phone: "0501234567",
add: true
},
income: [{
description: "Workshop",
quantity: 1,
price: 500,
vatType: 1
}],
payment: [{
date: "2025-01-01",
type: 10,
price: 500
}]
}
Workflow
Single Invoice
- User provides: name, email, phone, amount, description
- Skill authenticates with Morning API
- Creates invoice with customer details
- Returns invoice ID and number
Batch Processing
- User provides customer table file
- Skill parses markdown table
- Loads previously processed customers (from
processed-customers.json)
- For each new customer:
- Creates invoice
- Waits 1 second (rate limiting)
- Logs result
- Saves results to
invoice-results-{timestamp}.json
- Updates processed customers list
Integration with Workshop Updates
When creating invoices for a workshop:
- Read
workshop.md to get participant list
- Create customer table from registrations
- Run batch invoice creation
- Update workshop.md with invoice status
Examples
Create Invoice for Workshop Participant
User: Create an invoice for David Cohen, david@email.com, 0501234567, 500 NIS for the Claude Code workshop
Claude: I'll create the invoice using Morning API.
[Runs: npx ts-node invoice.ts create-single --name "David Cohen" --email "david@email.com" --phone "0501234567" --amount 500 --description "Claude Code Workshop"]
Invoice created successfully:
- Invoice ID: abc123
- Invoice Number: 1234
- Amount: 500 NIS (including VAT)
- Email sent to: david@email.com
Batch Dry-Run
User: Show me what invoices would be created for workshop participants
Claude: Running dry-run to preview invoices...
[Runs: npx ts-node invoice.ts batch --file participants.md --dry-run]
Dry run results:
1. David Cohen - 500 NIS
2. Sarah Levi - 500 NIS
3. Michael Ben - 400 NIS (affiliate)
Total: 3 invoices, 1,400 NIS
Output Files
| File | Description |
|---|
processed-customers.json | List of customers who already have invoices |
invoice-results-{timestamp}.json | Results from batch run |
Error Handling
| Error | Solution |
|---|
| 401 Unauthorized | Check API key and secret |
| 400 Bad Request | Verify customer data format |
| Rate limit | Automatic 1-second delay between requests |
| Duplicate | Skipped if in processed-customers.json |
Notes
- MANDATORY: every
create-single issuance is preceded by a --preview run. The PDF opens for the user to verify, only then re-run without --preview to issue.
- For batch jobs,
--dry-run shows the customer list as text (no PDFs). Use that before a batch.
- Production invoices are sent to customer email automatically
- Use sandbox for testing (different API URL)
- Keep API credentials secure - never commit .env file