Skip to content

Collections follow-up

Recipe40 minPractitioner

Before you start

You will build the recovery side of a lender. When a customer misses a payment, the lending system calls Beezr and a case opens. An agent works it, records what the customer promised, and Beezr watches the dates. A promise that is broken moves the case up a level. An outside agency can work cases assigned to it and nothing else. When the case ends, the outcome is written back to the lending system. Plan on a day.

  1. Missed payment
  2. Case opens
  3. Promise to pay
  4. Broken promise
  5. Agency or legal
  6. Outcome written back

Four modules, three workflows, one permission profile for agencies. The lending system stays where it is. Beezr holds the recovery work and tells the lending system how it ended.

ModuleKey fieldsNotes
Collection CasesCase number, Loan reference, Customer name, Amount overdue, Days past due, Status, Escalation level, Assigned agent, Assigned agency, OutcomeStatus: Open, Promise Made, Broken Promise, With Agency, Legal, Resolved
InteractionsCase, Date time, Channel, NotesChannel: Call, Visit, WhatsApp, Email
PromisesCase, Promised amount, Promise date, StatusStatus: Open, Kept, Broken
AgenciesName, Contact email, ActiveReferenced by cases

Make Case, on Interactions and Promises, a relation to Collection Cases with the Relation button on each module’s Fields page. Assigned agent is a User field. Assigned agency is a relation to Agencies. Put Escalation level on the case as an Integer with a default of 0.

On the case record page, add related tabs for Interactions and Promises, so a new agent reads the whole history on one page. See Add related tabs. Handoffs lose history when it lives in different places. Here it stays on the case.

The lending system tells Beezr over HTTP. That is a webhook: a workflow that another system starts by calling a URL.

  1. On Collection Cases, open Automation and choose New workflow. Name it Open case from lending system.
  2. Under When should it run?, choose From a webhook.
  3. Turn on Require an API key. The caller must send the key in the api-key header.
  4. Create the key under Account settings › API Integration, and give it a name such as Lending system.
  5. Add JSON parser. Choose The data the webhook sent. Under Its shape, list the fields the lending system sends: loan_reference, customer_name, amount_overdue, days_past_due.
  6. Add Record manager. Choose Create, On which module? Collection Cases, and fill the fields from the parser’s result with Insert data. Set Status to Open.
  7. Save, then open the workflow’s menu and choose Copy webhook URL. Give the URL and the key to the lending team.
The Workflow settings drawer with From a webhook selected, the Require an API key switch, the Send the result back options and the schedule switch.
    From a webhook means another system calls a URL.
    Require an API key makes the caller send api-key.
    Send the result back posts the run result to a URL you choose.
    Also run on a schedule adds times on top of the trigger.

The webhook replies at once with a status, ACCEPTED, and a run ID, and does the work in the background. A call can be refused with a reason:

ReplyMeaning
202Accepted for processing
400The workflow is turned off, or the ID is wrong
401The key is missing or wrong

The JSON parser reads one JSON object. A field you list that is missing from the call comes through empty, and a number field that holds text fails the step. See Start a workflow from another system with a webhook.

An agent opens the case, adds an Interactions record for the call, and adds a Promises record with an amount and a date. A POST workflow on Promises, running when A record is created, does two things:

  1. Record manager: Update Collection Cases, set Status to Promise Made. The update needs a key, because the case is a different module from Promises. Map the Case relation as the key.
  2. Stop there. The date is watched by the daily check below.

Create a workflow on Promises named Check promises. Choose Adhoc as the trigger, then Also run on a schedule, Every day at 09:00.

  1. Add Load data. Choose Promises. Rules: Status is Open and Promise date is before today. For the value of the date rule, use a Smart Script that returns today’s date, and test the list with Check before you trust it. Name the list overdue_promises.
  2. Add Loop. Choose Each record in a list and pick overdue_promises.
  3. Inside the loop, add Record manager: Update Promises, set Status to Broken.
  4. Add another Record manager: Update Collection Cases, with the promise’s Case as the key, and set Status to Broken Promise and add 1 to Escalation level. Use parseInt around the token.
  5. Add Send email to the team lead, naming the case.

A scheduled run has no starting record, so the Load data step does the finding. A Terminate inside a loop ends the whole workflow, not only the loop, and if one round fails the workflow stops at that round. Keep the steps in the loop small.

For a long daily queue, turn on Process in pages on the Loop. The list is then read page by page.

Add a Decision after the update: Escalation level greater than 2 sends the case on, setting Status to Legal and writing the legal team’s email. That is your escalation rule, and it is a setting you change in one place.

Create a profile named Agency under Account settings › Users & Security › Permissions.

  1. Tick only the collections app. Set Create, Edit on Interactions and Promises, and Edit on Collection Cases.
  2. On Collection Cases, open the Records column and choose Only records that match rules.
  3. Add the rule Assigned agent is Me.
  4. Leave Team records off and Full access off. Click Save profile.
A permission profile with apps on the left, Team records and Full access switches under them, and a table of modules with Fields and Records columns.
    Tick only the apps this group needs.
    Records opens the rules for this module.
    Full access skips the record rules. Keep it off for agencies.

Each agency user is a user in your workspace with a role that has this profile, and each case names one agent. The rule hides every other case from lists, counts, lookups and exports. A User field offers Me. To use Created by me or my team on another module, give that module a Created By field. Permissions load at sign-in, so a change reaches people at their next sign-in.

How does the outcome return to the lending system?

Section titled “How does the outcome return to the lending system?”

On Collection Cases, create a workflow that runs when A record is updated, After the record is saved (POST).

  1. Add Decision: Status is Resolved or Legal.
  2. On Yes, add REST API. Method POST, to the lending system’s outcome endpoint. Authenticate with an API key header. Send the loan reference, the outcome and the date in the JSON body.
  3. Tick Send an idempotency key, so a retried call does not post twice. Set Retries so a short outage does not drop the outcome.

A workflow that updates a case can fire this workflow again, because record updates run the update workflows of the module. The Decision on Status is what stops a loop. See REST API.

The REST API step panel with three sections: Request, Sign in and Send, showing a POST to an address and a JSON body.
    Request holds the method and the address of the lending system’s endpoint.
    Sign in offers None, Username + password, API key and Bearer token.
    Send holds the JSON body. Insert data where it changes from run to run.
  • Notify on WhatsApp. The Integration hub sends messages through a provider. See Connect an app.
  • Legal handoff. A Create step makes a Legal Cases record that points to the case, so the lawyer opens the full history.
  • Pull data on demand. A REST API step on an Adhoc workflow reads the loan’s schedule when an agent presses a button.
  • Arabic. Agents and customers can each work in their language through Labels.

The Solutions page follows one missed payment from the API call to the outcome: Collections.

Check yourself

Nour's lending system calls the case webhook without an api-key header, and the workflow's Require an API key switch is on. What does the caller get back?
Show the answer

A 401 reply saying an API key is mandatory. An authenticated webhook refuses a call with no api-key header, or with a key that fails, and answers 401. A 202 means the call was accepted and queued.

Youssef schedules a workflow every morning. Which step must it start with to find the promises that are due?
Show the answer

Load data, because a scheduled run has no starting record. A scheduled run does not start from a record. The workflow has to load the records it needs.

What's next

Last checked