> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hooksnode.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bank alerts

> Turn bank alert emails into bank.credit.received and bank.debit.posted events.

Most banks give business accounts no webhooks, but they send an email for each transaction. hooksnode reads these alert emails and sends a typed event for each one:

* `bank.credit.received` for money in
* `bank.debit.posted` for money out

Amounts are integers in minor units (kobo for NGN, cents for USD), with an ISO 4217 currency code. See the [event reference](/events/bank).

## Turn it on

Bank alerts work on [Gmail](/sources/gmail), [Outlook](/sources/outlook) and [IMAP](/sources/imap) sources. Connect the mailbox that gets your alerts. Then set **Bank alerts** on the source:

| Mode            | What the source sends                          |
| --------------- | ---------------------------------------------- |
| `off` (default) | The email only.                                |
| `add`           | The email, and a bank event for each alert.    |
| `only`          | The bank event only. Other mail sends nothing. |

<Tip>
  Use `only` with a **From contains** filter for your bank's alert address. Your destination then gets bank events and nothing else.
</Tip>

## Supported banks

hooksnode knows the alert senders of these banks and fintechs:

Access Bank, Ecobank, FCMB, Fidelity Bank, First Bank, Globus Bank, GTBank, Jaiz Bank, Keystone Bank, Kuda, Moniepoint, OPay, PalmPay, Parallex Bank, Polaris Bank, PremiumTrust Bank, Providus Bank, Stanbic IBTC, Sterling Bank, Titan Trust Bank, UBA, Union Bank, Unity Bank, Wema Bank and Zenith Bank.

hooksnode also reads alerts from other senders, when the email has an account or balance line and an alert word.

## The parser never guesses

If the email has no clear amount and direction, hooksnode sends no bank event. The `confidence` field tells you how sure the parser is:

| Value    | Meaning                                                         |
| -------- | --------------------------------------------------------------- |
| `high`   | A known bank sender, and the amount came from a labelled field. |
| `medium` | Any other result, and every AI result.                          |

A common rule: post `high` credits at once, and send `medium` credits to a person to check.

## AI fallback

When the rules cannot read an alert, a language model can try. This is off by default.

To use it, tick **Use AI when the rules cannot read an alert** on the source. The server must also have a model set up.

<Warning>
  With the AI fallback on, the model provider gets the text of the email. Tell your data protection officer before you turn it on.
</Warning>

How hooksnode keeps AI results safe:

1. It calls the model only when the rules find no alert and the email looks like an alert.
2. The model must answer in a fixed JSON schema.
3. hooksnode checks the answer against the email. The amount and currency must appear in the email. A reference, name, balance or account number that is not in the email is dropped.
4. The event says `"parser": "ai"`, names the model in `ai_model`, and has `"confidence": "medium"`.
5. If the model fails, refuses or times out, hooksnode sends no bank event. In `add` mode the email event still goes out.

## Example: reconcile invoices

```mermaid theme={null}
flowchart LR
  A[GTBank alert email] --> B[Gmail source<br/>bank alerts: only]
  B --> C["bank.credit.received"]
  C --> D[Your invoicing API]
  D --> E{narration matches<br/>an open invoice?}
  E -- yes --> F[Mark paid, send receipt]
  E -- no --> G[Queue for review]
```

Add a filter on the destination to get credits only:

```json theme={null}
{ "type": "bank.credit.received" }
```

## Idempotency

The bank event's idempotency key is the email's key plus `:bank`. One email never makes two bank events.
