Use casesRecipes

Payment & Invoice Reminder Agent

Chase overdue invoices by sending a WhatsApp reminder first, then following up with an outbound voice call — with a Stripe payment link in both messages.

DifficultyIntermediate
TrackDeveloper Track
ChannelsVoice (Outbound)WhatsApp
IntegrationsInvoice/billing system (API)Stripe (payment links)Customer contact list

What you'll build

An agent that chases overdue invoices across two channels: a WhatsApp message with a Stripe payment link goes out first; if the invoice remains unpaid after a configurable window, a follow-up outbound voice call reads out the outstanding amount and payment link. The agent handles payment confirmation and sends a receipt, all without a human collections agent in the loop for standard cases.

Prerequisites

  • BimpeAI account with an API key (sk_…)
  • Read Anatomy of a workflow agent first — this recipe skips steps covered there
  • Invoice/billing system, Stripe, and customer contact list connected in the Console dashboard (see Step 4)
  • A WhatsApp Business number and an outbound voice phone number configured in the Console dashboard (see Step 4)

Steps

1. Find the workflow

import { BimpeAI } from "@bimpeai/sdk";

const bimpe = new BimpeAI({ apiKey: process.env.BIMPEAI_API_KEY! });

const page = await bimpe.workflows.list({ scope: "public", search: "invoice reminder" });
const workflow = page.data[0];
console.log(workflow.id, workflow.name);
import os
from bimpeai import BimpeAI

client = BimpeAI(api_key=os.environ["BIMPEAI_API_KEY"])

page = client.workflows.list(scope="public", search="invoice reminder")
workflow = page.data[0]
print(workflow.id, workflow.name)

2. Create the agent

const agent = await bimpe.agents.create(
  {
    name: "Invoice reminder agent",
    system_prompt:
      "You chase overdue invoices on behalf of the business. " +
      "On WhatsApp, send a polite reminder with the invoice number, outstanding amount, due date, " +
      "and Stripe payment link. On a follow-up voice call, introduce yourself, state the overdue " +
      "amount, and read out the payment link clearly. If the customer says they have already paid, " +
      "ask for the payment reference and note it. If they request a payment plan, escalate to the " +
      "accounts team — do not agree to a plan yourself. Apply late fee policy from the knowledge base.",
    agent_workflow_id: workflow.id,
  },
  { idempotencyKey: "create-invoice-reminder-agent-v1" },
);

console.log(agent.id);
agent = client.agents.create(
    name="Invoice reminder agent",
    system_prompt=(
        "You chase overdue invoices on behalf of the business. "
        "On WhatsApp, send a polite reminder with the invoice number, outstanding amount, due date, "
        "and Stripe payment link. On a follow-up voice call, introduce yourself, state the overdue "
        "amount, and read out the payment link clearly. If the customer says they have already paid, "
        "ask for the payment reference and note it. If they request a payment plan, escalate to the "
        "accounts team — do not agree to a plan yourself. Apply late fee policy from the knowledge base."
    ),
    agent_workflow_id=workflow.id,
    idempotency_key="create-invoice-reminder-agent-v1",
)

print(agent.id)

3. Add knowledge bases

// Payment terms and late fee policy
await bimpe.agents.knowledgeBases.create(agent.id, {
  type: "text",
  name: "Payment terms",
  content:
    "Standard payment terms: net 30 days from invoice date.\n" +
    "Late fee: 2% of the outstanding balance applied after 7 days overdue.\n" +
    "A second late fee of 2% applies after 30 days overdue.\n" +
    "Invoices unpaid after 60 days are referred to the collections team.\n" +
    "Payment plans must be approved by the accounts team — agents cannot agree to them.",
});

// Escalation thresholds
await bimpe.agents.knowledgeBases.create(agent.id, {
  type: "text",
  name: "Escalation thresholds",
  content:
    "Escalate to accounts team if:\n" +
    "- Customer requests a payment plan or extension.\n" +
    "- Invoice is over 60 days overdue.\n" +
    "- Outstanding balance exceeds £10,000.\n" +
    "- Customer disputes the invoice amount.\n" +
    "For escalations, collect the customer's name, invoice number, and preferred callback time.",
});
# Payment terms and late fee policy
client.agents.knowledge_bases.create(agent.id, {
    "type": "text",
    "name": "Payment terms",
    "content": (
        "Standard payment terms: net 30 days from invoice date.\n"
        "Late fee: 2% of the outstanding balance applied after 7 days overdue.\n"
        "A second late fee of 2% applies after 30 days overdue.\n"
        "Invoices unpaid after 60 days are referred to the collections team.\n"
        "Payment plans must be approved by the accounts team — agents cannot agree to them."
    ),
})

# Escalation thresholds
client.agents.knowledge_bases.create(agent.id, {
    "type": "text",
    "name": "Escalation thresholds",
    "content": (
        "Escalate to accounts team if:\n"
        "- Customer requests a payment plan or extension.\n"
        "- Invoice is over 60 days overdue.\n"
        "- Outstanding balance exceeds £10,000.\n"
        "- Customer disputes the invoice amount.\n"
        "For escalations, collect the customer's name, invoice number, and preferred callback time."
    ),
})

4. Connect channels and integrations (dashboard)

WhatsApp, outbound voice, and integrations are configured in the dashboard

The API cannot create channel connections or integrations. There is no voice value in the SDK channel filter — outbound voice calls are initiated from the dashboard or a connected telephony trigger. The SDK cannot initiate calls. WhatsApp, the invoice/billing system, Stripe, and the customer contact list are all connected in the Console dashboard.

  1. Open Console dashboardAgents → select your agent.
  2. Under Channels, connect your WhatsApp Business number for the initial reminder message.
  3. Under Channels, configure an outbound voice phone number for the follow-up call.
  4. Under Integrations, connect your invoice/billing system. The agent reads outstanding amounts and due dates from it.
  5. Under Integrations, connect Stripe. The agent retrieves the payment link from Stripe and includes it in both the WhatsApp message and the voice call.
  6. Under Integrations, connect your customer contact list so the agent can look up phone numbers by invoice.

5. Go live

const integrations = await bimpe.agents.integrations.list(agent.id);
console.log("Integrations:", integrations.map((i) => i.name));
integrations = client.agents.integrations.list(agent.id)
print("Integrations:", [i.name for i in integrations])

Full example

import { BimpeAI } from "@bimpeai/sdk";

const bimpe = new BimpeAI({ apiKey: process.env.BIMPEAI_API_KEY! });

// 1. Find workflow
const page = await bimpe.workflows.list({ scope: "public", search: "invoice reminder" });
const workflow = page.data[0];

// 2. Create agent
const agent = await bimpe.agents.create(
  {
    name: "Invoice reminder agent",
    system_prompt:
      "You chase overdue invoices. On WhatsApp, send the invoice number, amount, and payment link. " +
      "On a follow-up call, state the amount and read the payment link. Escalate payment plan " +
      "requests to the accounts team.",
    agent_workflow_id: workflow.id,
  },
  { idempotencyKey: "create-invoice-reminder-agent-v1" },
);

// 3. Add knowledge bases
await bimpe.agents.knowledgeBases.create(agent.id, {
  type: "text",
  name: "Payment terms",
  content:
    "Net 30 days. Late fee: 2% after 7 days overdue, another 2% after 30 days. " +
    "Invoices over 60 days referred to collections. Payment plans require accounts team approval.",
});

await bimpe.agents.knowledgeBases.create(agent.id, {
  type: "text",
  name: "Escalation thresholds",
  content:
    "Escalate if: customer requests payment plan, invoice > 60 days overdue, balance > £10,000, " +
    "or customer disputes the amount.",
});

// 4. Verify integrations (billing system, Stripe, contact list must be in dashboard)
const integrations = await bimpe.agents.integrations.list(agent.id);
console.log("Agent ID:", agent.id);
console.log("Integrations:", integrations.map((i) => i.name));

// 5. Stream WhatsApp reminder conversations
const controller = new AbortController();
const conversations = await bimpe.conversations.list(agent.id, { channel: "whatsapp" });
const conv = conversations.data[0];

if (conv) {
  for await (const event of bimpe.conversations.messages.stream(agent.id, conv.id, {
    signal: controller.signal,
  })) {
    console.log(event.role, event.message);
  }
}
import os
from bimpeai import BimpeAI

client = BimpeAI(api_key=os.environ["BIMPEAI_API_KEY"])

# 1. Find workflow
page = client.workflows.list(scope="public", search="invoice reminder")
workflow = page.data[0]

# 2. Create agent
agent = client.agents.create(
    name="Invoice reminder agent",
    system_prompt=(
        "You chase overdue invoices. On WhatsApp, send the invoice number, amount, and payment link. "
        "On a follow-up call, state the amount and read the payment link. Escalate payment plan "
        "requests to the accounts team."
    ),
    agent_workflow_id=workflow.id,
    idempotency_key="create-invoice-reminder-agent-v1",
)

# 3. Add knowledge bases
client.agents.knowledge_bases.create(agent.id, {
    "type": "text",
    "name": "Payment terms",
    "content": (
        "Net 30 days. Late fee: 2% after 7 days overdue, another 2% after 30 days. "
        "Invoices over 60 days referred to collections. Payment plans require accounts team approval."
    ),
})

client.agents.knowledge_bases.create(agent.id, {
    "type": "text",
    "name": "Escalation thresholds",
    "content": (
        "Escalate if: customer requests payment plan, invoice > 60 days overdue, balance > £10,000, "
        "or customer disputes the amount."
    ),
})

# 4. Verify integrations (billing system, Stripe, contact list must be in dashboard)
integrations = client.agents.integrations.list(agent.id)
print("Agent ID:", agent.id)
print("Integrations:", [i.name for i in integrations])

# 5. Stream WhatsApp reminder conversations
conversations = client.conversations.list(agent.id, channel="whatsapp")
if conversations.data:
    conv = conversations.data[0]
    for msg in client.conversations.messages.stream(agent.id, conv.id):
        print(msg.role, msg.message)

Deploy

Store your API key in BIMPEAI_API_KEY. Confirm that the billing system, Stripe, and contact list all appear in integrations.list before enabling live reminders. A missing Stripe integration means the agent cannot retrieve payment links, which breaks both the WhatsApp message and the voice call. Update the late fee policy via knowledgeBases.update whenever your payment terms change.

Variations

  • Add a third knowledge base entry with a list of your most common invoice dispute reasons so the agent can address them before escalating.
  • Use conversations.messages.send to deliver a receipt message on WhatsApp once a payment clears in Stripe.
  • Adjust the system_prompt to change the reminder tone from formal to friendly for B2C versus B2B invoice runs.

On this page