Cancellation Winback
Reach customers who cancelled a reservation, understand the reason, and offer a compelling counter-offer to bring them back.
Why this matters
Deliver white-glove guest experiences at scale with automated reservation management, upsells, and disruption handling. This example shows you how to automate cancellation winback calls end-to-end with Guava's SDK — no telephony plumbing, no prompt engineering, just Python.
Installation
Install from Guava's private PyPI index. A public package is coming soon — the install command will simplify to pip install guava.
# Step 1: Install Guava
pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
# Public PyPI package coming soon — the install command will simplify to:
# pip install guava
# Step 2: Set your credentials
export GUAVA_API_KEY="..."
export GUAVA_AGENT_NUMBER="..."How it's built
Every Guava agent is a Python class. Walk through the key sections below, then grab the complete file at the end.
Imports
Import the Guava SDK and any helpers you need. guava.CallController is the base class for every voice agent.
# Install: pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
import guava
import osAgent setup
set_persona() defines how the agent presents itself. set_task() gives it its mission in plain English. The checklist drives the conversation — Guava works through it top-to-bottom, collecting Field values and speaking Say items as it goes.
class CancellationWinbackBot(guava.CallController):
def __init__(self, guest_name: str, hotel: str, cancelled_dates: str, cancelled_rate: float):
super().__init__()
self.set_persona(
organization_name=hotel,
agent_name="Sophia",
)
self.set_task(
objective=f"Win back {guest_name} who cancelled their {cancelled_dates} reservation at ${cancelled_rate:.2f}/night",
checklist=[
f"Reach {guest_name} and mention you noticed their reservation was cancelled — express genuine concern.",
guava.Field(
key="cancellation_reason",
field_type="choice",
description="Reason for cancellation",
choices=["plans changed", "found better price", "switched hotels", "personal emergency",
"dissatisfied with previous stay", "prefer not to say"],
),
guava.Field(
key="still_traveling_those_dates",
field_type="bool",
description="Are they still traveling during those dates?",
),
guava.Field(
key="open_to_offer",
field_type="bool",
description="Would a rate match or room upgrade change their mind?",
),
guava.Field(
key="rebook_now",
field_type="bool",
description="Would they like to rebook now with a 15% loyalty discount?",
),
"If rebooking, process and confirm new reservation details.",
],
on_complete=lambda fields: print(f"Winback result for {guest_name}: rebook={fields.get('rebook_now')}"),
)
guava.dial(
controller=CancellationWinbackBot,
controller_args={"guest_name": "Natalie Brooks", "hotel": "The Mayfair Grand",
"cancelled_dates": "April 18-20", "cancelled_rate": 249.00},
to=os.environ["GUEST_PHONE"],
agent_number=os.environ["GUAVA_AGENT_NUMBER"],
api_key=os.environ["GUAVA_API_KEY"],
)Platform performance
<1s
Response time
99.99%
Uptime SLA
13+
Industries served
Full example
The complete file — copy it, save it as example.py, and run it.
# Install: pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
import guava
import os
class CancellationWinbackBot(guava.CallController):
def __init__(self, guest_name: str, hotel: str, cancelled_dates: str, cancelled_rate: float):
super().__init__()
self.set_persona(
organization_name=hotel,
agent_name="Sophia",
)
self.set_task(
objective=f"Win back {guest_name} who cancelled their {cancelled_dates} reservation at ${cancelled_rate:.2f}/night",
checklist=[
f"Reach {guest_name} and mention you noticed their reservation was cancelled — express genuine concern.",
guava.Field(
key="cancellation_reason",
field_type="choice",
description="Reason for cancellation",
choices=["plans changed", "found better price", "switched hotels", "personal emergency",
"dissatisfied with previous stay", "prefer not to say"],
),
guava.Field(
key="still_traveling_those_dates",
field_type="bool",
description="Are they still traveling during those dates?",
),
guava.Field(
key="open_to_offer",
field_type="bool",
description="Would a rate match or room upgrade change their mind?",
),
guava.Field(
key="rebook_now",
field_type="bool",
description="Would they like to rebook now with a 15% loyalty discount?",
),
"If rebooking, process and confirm new reservation details.",
],
on_complete=lambda fields: print(f"Winback result for {guest_name}: rebook={fields.get('rebook_now')}"),
)
guava.dial(
controller=CancellationWinbackBot,
controller_args={"guest_name": "Natalie Brooks", "hotel": "The Mayfair Grand",
"cancelled_dates": "April 18-20", "cancelled_rate": 249.00},
to=os.environ["GUEST_PHONE"],
agent_number=os.environ["GUAVA_AGENT_NUMBER"],
api_key=os.environ["GUAVA_API_KEY"],
)Run it
Start the agent. It will connect to Guava's infrastructure and begin accepting calls on your assigned number.
python example.py