C# · Track 8 · Tutorial 2 of 4

Get told when a load finishes

Let BrizoConsol tell your system when each write has finished, instead of your system asking.

You will needThe monthly script from Put the steps in order, and a public address your system listens on.
By the endA run that tells your system as each write finishes.

1When a webhook helps

Instead of reading each request back, your system can be told when a write has finished. Add webhook_url to the declarations, and BrizoConsol posts the request's status there once - when it's written, or if it fails.

2Add it to the run

Monthly.cs already adds it when BRIZO_WEBHOOK_URL is set:

Monthly.cs

static Dictionary<string, string> Declarations(string source, string period, string currency, string? webhook)
{
    var declarations = new Dictionary<string, string>
    {
        ["source_reference"] = source,
        ["period"] = period,
        ["value_basis"] = "company_base",
        ["rate_direction"] = "document_to_base",
        ["base_currency"] = currency,
    };
    if (webhook is not null)
    {
        declarations["webhook_url"] = webhook;
    }
    return declarations;
}
When a webhook is called
A webhook is called once, when the write finishes - not when the consolidation does.

3What arrives

A POST with the same body GET …/requests/{id} answers: the counts, any refusals, and recalculation. For a trial balance that reads pending, because the call comes when the write finishes - the consolidation is still to run.

4The rules

The rules for a webhook address
Webhooks go only to public addresses; a call that fails is recorded, and the request still stands.
  • The address must be public: an internal or private address isn't called.
  • Redirects aren't followed.
  • A call that fails is recorded on the request and never fails it - read the request back to see what happened.

Want more detail? See the documentation