Use casesRecipes

Food Delivery Dispatch Agent

Accept orders over WhatsApp, coordinate with your POS and logistics provider, and send customers real-time delivery updates.

DifficultyIntermediate
TrackBuilder Track or Developer Track
ChannelsWhatsApp
IntegrationsPOS systemLogistics / delivery APIGoogle Calendar

What you'll build

An agent that takes food orders over WhatsApp, forwards them to your POS, hands off to your logistics provider for driver dispatch, and keeps customers updated with order status and estimated delivery times.

Customer journey

A hungry customer messages your restaurant on WhatsApp to place an order. The agent reads the menu KB, confirms items and delivery zone, pushes the order to your POS integration, and gives an ETA from the logistics provider.

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
  • POS, logistics, and Google Calendar integrations connected in the Console dashboard (see Step 4)
  • WhatsApp Business number connected in the Console dashboard

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: "food delivery" });
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="food delivery")
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: "Delivery dispatch agent",
  system_prompt: "You take food orders over WhatsApp, confirm order details, and send customers real-time delivery status updates.",
});
console.log(workflow.id);
workflow = client.workflows.create(
    name="Delivery dispatch agent",
    system_prompt="You take food orders over WhatsApp, confirm order details, and send customers real-time delivery status updates.",
)
print(workflow.id)

2. Create the agent

const agent = await bimpe.agents.create(
  {
    name: "Delivery dispatch agent",
    description: "Takes food orders, confirms details, and sends delivery status updates.",
    workflow_id: workflow.id,
  },
  { idempotencyKey: "create-delivery-agent-v1" },
);

console.log(agent.id);
agent = client.agents.create(
    name="Delivery dispatch agent",
    description="Takes food orders, confirms details, and sends delivery status updates.",
    workflow_id=workflow.id,
    idempotency_key="create-delivery-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.

Provide the menu with pricing and a delivery zone map so the agent can quote costs and estimated times accurately.

// Menu and pricing
await bimpe.agents.knowledgeBases.create(agent.id, {
  type: "text",
  name: "Menu and pricing",
  content:
    "Burger meal — £9.50 (burger, fries, drink)\n" +
    "Veggie wrap — £8.00\n" +
    "Loaded nachos — £6.50\n" +
    "Soft drinks — £2.00\n" +
    "Minimum order: £12.00",
});

// Delivery zones
await bimpe.agents.knowledgeBases.create(agent.id, {
  type: "text",
  name: "Delivery zones",
  content:
    "Zone A (0–2 km): £1.50 delivery, 20–30 min estimated\n" +
    "Zone B (2–5 km): £2.50 delivery, 30–45 min estimated\n" +
    "Zone C (5–8 km): £3.50 delivery, 45–60 min estimated\n" +
    "Outside 8 km: not available",
});
# Menu and pricing
client.agents.knowledge_bases.create(agent.id, {
    "type": "text",
    "name": "Menu and pricing",
    "content": (
        "Burger meal — £9.50 (burger, fries, drink)\n"
        "Veggie wrap — £8.00\n"
        "Loaded nachos — £6.50\n"
        "Soft drinks — £2.00\n"
        "Minimum order: £12.00"
    ),
})

# Delivery zones
client.agents.knowledge_bases.create(agent.id, {
    "type": "text",
    "name": "Delivery zones",
    "content": (
        "Zone A (0–2 km): £1.50 delivery, 20–30 min estimated\n"
        "Zone B (2–5 km): £2.50 delivery, 30–45 min estimated\n"
        "Zone C (5–8 km): £3.50 delivery, 45–60 min estimated\n"
        "Outside 8 km: not available"
    ),
})

4. Connect channels and integrations (dashboard)

Channels and 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 messaging channels on the Deploy screen and your POS, logistics, and Google Calendar integrations 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.
  3. On the Integrations screen, open the Custom API tab and wire up your POS system (see Configuring integrations) so orders flow through to the kitchen.
  4. In the same Custom API tab, wire up your logistics or delivery provider for driver assignment and tracking.
  5. On the Integrations screen, find Google Calendar and click Connect if your delivery windows are managed there.

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.

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.

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: "Two burger meals delivered to 14 Oak Street?",
  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="Two burger meals delivered to 14 Oak Street?",
    channel_type="whatsapp",
    channel_user_id="<tester-whatsapp-number>",
    is_test_channel=True,
)

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

6. Verify and go live

const integrations = await bimpe.agents.integrations.list(agent.id);
console.log("Active integrations:", integrations.map((i) => i.name));
integrations = client.agents.integrations.list(agent.id)
print("Active 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: "food delivery" });
const workflow = page.data[0];

// 2. Create agent
const agent = await bimpe.agents.create(
  {
    name: "Delivery dispatch agent",
    description: "Takes food orders, confirms details, and sends delivery status updates.",
    workflow_id: workflow.id,
  },
  { idempotencyKey: "create-delivery-agent-v1" },
);

// 3. Add knowledge bases
await bimpe.agents.knowledgeBases.create(agent.id, {
  type: "text",
  name: "Menu and pricing",
  content:
    "Burger meal — £9.50\n" +
    "Veggie wrap — £8.00\n" +
    "Minimum order: £12.00",
});

await bimpe.agents.knowledgeBases.create(agent.id, {
  type: "text",
  name: "Delivery zones",
  content:
    "Zone A (0–2 km): £1.50 delivery, 20–30 min\n" +
    "Zone B (2–5 km): £2.50 delivery, 30–45 min",
});

// 4. Verify integrations (connected via 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 messages in an order conversation
const controller = new AbortController();

for await (const event of bimpe.conversations.messages.stream(
  agent.id,
  "<conversation_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="food delivery")
workflow = page.data[0]

# 2. Create agent
agent = client.agents.create(
    name="Delivery dispatch agent",
    description="Takes food orders, confirms details, and sends delivery status updates.",
    workflow_id=workflow.id,
    idempotency_key="create-delivery-agent-v1",
)

# 3. Add knowledge bases
client.agents.knowledge_bases.create(agent.id, {
    "type": "text",
    "name": "Menu and pricing",
    "content": "Burger meal — £9.50\nVeggie wrap — £8.00\nMinimum order: £12.00",
})

client.agents.knowledge_bases.create(agent.id, {
    "type": "text",
    "name": "Delivery zones",
    "content": (
        "Zone A (0–2 km): £1.50 delivery, 20–30 min\n"
        "Zone B (2–5 km): £2.50 delivery, 30–45 min"
    ),
})

# 4. Verify integrations (connected via dashboard)
integrations = client.agents.integrations.list(agent.id)
print("Agent ID:", agent.id)
print("Integrations:", [i.name for i in integrations])

# 5. Stream messages in an order conversation
for event in client.conversations.messages.stream(agent.id, "<conversation_id>"):
    print(event.role, event.message)

Deploy and go live

Go-live checklist

  • Store your API key in BIMPEAI_API_KEY (server-side only).
  • Confirm POS system appears in integrations.list or is connected in the dashboard.
  • Confirm Logistics provider appears in integrations.list or is connected in the dashboard.
  • Confirm Google Calendar appears in integrations.list or is connected in the dashboard.
  • Verify WhatsApp 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

Confirm POS, logistics, and Google Calendar integrations before directing live traffic. Update delivery zone pricing when rates change.

Variations

  • Push a confirmation message server-side once the kitchen marks an order ready: use conversations.send (create-or-send by channel) with the confirmed ETA.
  • Add a knowledge base entry for peak-hour surcharges and update it automatically from a scheduled script.
  • Extend to multiple locations by creating a separate agent per restaurant, each with its own delivery zone KB.

On this page