Daily FX exposure digest for open Xero invoices in Slack
Every weekday at 8am, see how exchange rate moves have changed what your unpaid foreign currency invoices are really worth.
Every weekday at 8am, review my open foreign currency invoices in Xero and tell me how my FX exposure has shifted since each invoice was raised, then post the result to Slack.
Treat my Xero organisation's base currency as my home currency, and default to USD if you cannot determine it. Use the Xero List Invoices operation to pull accounts receivable invoices with status AUTHORISED that still have an amount outstanding, then keep only the ones whose currency code differs from my home currency. Filter server side with the where parameter where you can, and page through the full result set rather than stopping at the first page. Use the amount still due rather than the invoice total, so partly paid invoices are measured correctly. Xero returns dates in .NET format like /Date(1551830400000+0000)/, so parse each invoice date into a plain YYYY-MM-DD value before using it.
Get today's rates with the Open Exchange Rates Get Latest Rates operation, and the rate for each invoice date with Get Historical Rates. My plan is USD base only, so do not pass a base parameter: an unsupported base returns a 400 invalid_base error. Instead take the USD quotes and derive each cross rate by division. To convert an amount in currency C into my home currency H, multiply by the USD quote for H divided by the USD quote for C. Do not use the Convert Amount operation, which is Unlimited plan only, and do not use Get Time-Series, which is Enterprise only. Do the arithmetic in the workflow instead. Collect the distinct invoice dates first and make one historical call per date rather than one per invoice, because every call counts against my monthly quota. Note that historical values are the last rate published up to 23:59:59 UTC on the requested day.
For every invoice, compute the outstanding amount in my home currency at the invoice date rate and again at today's rate. The difference is the unrealised gain or loss. For a receivable, a foreign currency that has strengthened against my home currency since the invoice date is a gain, and one that has weakened is a loss. Compute the percentage change as well as the absolute change.
Only call out invoices that have moved more than 2 percent or more than 500 in my home currency, whichever is crossed first, so the digest stays short. Invoices below the threshold still count toward the totals, they just do not get their own line.
Post one message using the Slack Send a Message operation containing three sections. First, the invoices that crossed the threshold, ranked by the absolute size of the gain or loss, each showing the customer, invoice number, currency, amount outstanding, invoice date, the rate then versus the rate now, and the gain or loss in my home currency with a clear plus or minus sign. Second, subtotals of the swing grouped by currency. Third, the net swing across the whole open receivables book since invoice date, including the invoices below the threshold so the total is complete. Keep it scannable and lead with the numbers.
If no invoice crosses either threshold, stay silent apart from a single all clear line, for example: FX check, no material movement across 9 open foreign currency invoices. If I have no open foreign currency invoices at all, say that in one line instead.
Example output
What does this prompt do?
- Each weekday morning it pulls every approved, unpaid invoice you have raised in a currency other than your home currency.
- Compares today's exchange rate against the rate on the day each invoice was raised, so you can see the gain or loss that has quietly built up while the invoice sits open.
- Ranks the biggest movers, subtotals the swing by currency, and gives you one net figure for the whole receivables book.
- Stays quiet with a single all clear line on days when nothing has moved enough to be worth your attention.
What do I need to use this?
- A Xero organisation that invoices customers in more than one currency
- An Open Exchange Rates account (the free plan is enough)
- A Slack workspace and the channel where your finance team should get the digest
- Your home currency, which is normally the base currency your Xero organisation reports in
How can I customize it?
- Change when it runs. Weekday mornings at 8am suits most finance teams, but month end only or every Monday works just as well.
- Move the thresholds. The digest calls out anything that has moved more than 2 percent or more than 500 in your home currency, and you can tighten or loosen either number.
- Narrow the scope. Limit it to particular currencies, your largest customers, or invoices above a certain value if your book is long.
- Send it somewhere else, such as a private channel for the CFO instead of a shared finance channel.
FAQs
Does this work on the free Open Exchange Rates plan?
Will this change anything in my Xero account?
Why doesn't Xero already show me this?
What counts as a big enough move to get reported?
What happens on a quiet day when rates barely moved?
Can I use this for supplier bills as well as customer invoices?
Related templates
When your flight moves, your calendar times get corrected automatically and you get a Slack note naming the meetings you're about to miss.
Every 15 minutes, forwarded phishing reports get traced back to the server that really sent them, with a verdict in Slack and the worst senders reported.
Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.
Every Monday, rank the week's matches by expected demand, put the big ones on your venue calendar, and post a rota-ready summary to Slack.
Every Tuesday we pull your best new reviews, draft social captions, email testimonials and product page quotes, then stage them in Notion for approval.
Every weekday morning, unfulfilled orders get an address check: harmless typos fixed automatically, risky addresses held with a note to the customer.
Stop discovering currency losses on the day you get paid.
Put a two minute check on your calendar every weekday morning and know exactly what your foreign currency receivables are worth today.