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.

Customer journey

An overdue invoice triggers a WhatsApp message with a Stripe payment link. If the invoice remains unpaid, the agent places an outbound voice call reading the balance and link again. The customer pays in Stripe; the agent confirms and can send a receipt message.

Loading diagram…

See Deploying and testing channels for connect and test steps per channel.

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 or create 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)

Or build a new workflow from scratch with workflows.create instead of finding one. name and system_prompt are required; it returns the new Workflow whose id you bind the agent to. See Anatomy of a workflow agent for the full set of optional fields like rules and flows.

const workflow = await bimpe.workflows.create({
  name: "Invoice reminder agent",
  system_prompt: "You chase overdue invoices over WhatsApp first, then a follow-up voice call, sharing a Stripe payment link in both.",
});
console.log(workflow.id);
workflow = client.workflows.create(
    name="Invoice reminder agent",
    system_prompt="You chase overdue invoices over WhatsApp first, then a follow-up voice call, sharing a Stripe payment link in both.",
)
print(workflow.id)

2. Create the agent

const agent = await bimpe.agents.create(
  {
    name: "Invoice reminder agent",
    description: "Chases overdue invoices over WhatsApp and a follow-up voice call with a Stripe payment link.",
    workflow_id: workflow.id,
  },
  { idempotencyKey: "create-invoice-reminder-agent-v1" },
);

console.log(agent.id);
agent = client.agents.create(
    name="Invoice reminder agent",
    description="Chases overdue invoices over WhatsApp and a follow-up voice call with a Stripe payment link.",
    workflow_id=workflow.id,
    idempotency_key="create-invoice-reminder-agent-v1",
)

print(agent.id)

3. Add knowledge bases (optional)

Knowledge bases are optional; an agent whose workflow and integrations already cover everything it needs to say can skip this step. This recipe uses one to ground the agent in the details it must quote accurately.

// 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)

Channels, Stripe, and your billing integrations are connected in the dashboard

The API cannot create channel connections, but integrations can now be configured through it; see Configuring integrations. Connect your channels on the Deploy screen and Stripe, your invoice/billing system, and your customer contact list on the Integrations screen of the Console dashboard. The SDK lists what is active but cannot modify channel connections.

  1. In the Console dashboard, pick your agent from the switcher at the top, then open Deploy.
  2. Under Messaging & Chat, click Connect on the WhatsApp card and follow the prompts to link your WhatsApp Business number for the initial reminder message.
  3. Under Voice, click Set up on the Telephony card — it is an add-on with usage-based pricing. Provision or link a number under Team settings → Phone numbers, then set the agent's voice and greeting under Settings → Voice for the follow-up call.
  4. On the Integrations screen, open the Custom API tab and wire up your invoice/billing system so the agent can read outstanding amounts and due dates.
  5. On the Integrations screen, find Stripe and click Connect. The agent retrieves the payment link from Stripe and includes it in both the WhatsApp message and the voice call.
  6. Back in the Custom API tab, wire up your customer contact list so the agent can look up phone numbers by invoice.

Connect WhatsApp

Customers message your WhatsApp Business number for support and transactions.

  1. Open the Deploy screen in the Console dashboard and select your agent.
  2. Under Messaging & Chat, click Connect on the WhatsApp card.
  3. Follow the prompts to link your WhatsApp Business number.
  4. Once connected, customers can message your business number and the agent replies within WhatsApp's 24-hour session window.

Full reference: Deploying and testing channels.

Connect Telephony (outbound)

Your system calls customers for reminders, alerts, or follow-ups.

  1. Open Deploy and click Set up on the Telephony card.
  2. Under Team settings → Phone numbers, request or link an outbound-capable number and assign it to this agent.
  3. Under Settings → Voice, set the outbound voice and greeting.
  4. Place calls with calls.make and is_test_call: false, or trigger calls from your backend when events fire.

Full reference: Deploying and testing channels.

Also on Instagram and Messenger: the same Deploy → Connect flow applies. Testers use the Deploy panel links or getTestCode deep links for each network. Instagram · Messenger

5. Test your agent

Before going live, exercise the agent on a test channel. Fetch the test code (created on first request), then test on WhatsApp — share the deep link or start message with a human tester, or inject a message from your server.

Test WhatsApp

Human tester: fetch the test code with agents.getTestCode (or use the Deploy panel). Share the deep link or start <code> message with a tester.

SDK injection: call conversations.send with is_test_channel: true and the matching channel_type.

Full reference: Deploying and testing channels.

Test Telephony (outbound)

Test call: use calls.make(agentId, { destination, is_test_call: true }) — test telephony consumes no live minutes.

Confirm channels.telephony.is_enabled from getTestCode before placing live calls.

Full reference: Deploying and testing channels.

const { channels } = await bimpe.agents.getTestCode(agent.id);
// A tester opens channels.whatsapp.url, or sends channels.whatsapp.start_message
// to channels.whatsapp.phone_number, to open a 24-hour test window.
console.log(channels.whatsapp.start_message, channels.whatsapp.url);

// Or inject a test message yourself:
await bimpe.conversations.send(agent.id, {
  message: "Can you resend the payment link for invoice #1043?",
  channel_type: "whatsapp",
  channel_user_id: "<tester-whatsapp-number>",
  is_test_channel: true,
});
test_code = client.agents.get_test_code(agent.id)
# A tester opens .url, or sends .start_message to .phone_number, to open a 24-hour window.
print(test_code.channels.whatsapp.start_message, test_code.channels.whatsapp.url)

# Or inject a test message yourself:
client.conversations.send(
    agent.id,
    message="Can you resend the payment link for invoice #1043?",
    channel_type="whatsapp",
    channel_user_id="<tester-whatsapp-number>",
    is_test_channel=True,
)

To exercise the phone path too, place a test call with bimpe.calls.make(agent.id, { destination, is_test_call: true }) (Python: client.calls.make(agent.id, {"destination": ..., "is_test_call": True})).

See Test your agent for the other test channels and the pause-AI rule.

6. 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",
    description: "Chases overdue invoices over WhatsApp and a follow-up voice call with a Stripe payment link.",
    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",
    description="Chases overdue invoices over WhatsApp and a follow-up voice call with a Stripe payment link.",
    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 and go live

Go-live checklist

  • Store your API key in BIMPEAI_API_KEY (server-side only).
  • Confirm Invoice/billing system appears in integrations.list or is connected in the dashboard.
  • Confirm Stripe appears in integrations.list or is connected in the dashboard.
  • Confirm Customer contact list appears in integrations.list or is connected in the dashboard.
  • Verify WhatsApp is connected on the Deploy screen (agents.channels.list shows it enabled).
  • Verify Telephony (outbound) is connected on the Deploy screen (agents.channels.list shows it enabled).
  • Set Escalation Email under Settings → Agent if humans must take over.
  • Switch the agent to live with updateLiveStatus / update_live_status.
  • Monitor the Conversations screen (or stream via SDK) after launch.

After go-live

Update the late fee policy via knowledgeBases.update when payment terms change. A missing Stripe integration breaks both WhatsApp and voice reminders.

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.send (create-or-send by channel) to deliver a receipt message on WhatsApp once a payment clears in Stripe.
  • Adjust the workflow's system_prompt to change the reminder tone from formal to friendly for B2C versus B2B invoice runs.

On this page