Loyalty Program Enrollment
Call existing customers to enroll them in your loyalty program, explain benefits, and activate their account in a single 2-minute conversation.
Why this matters
Drive revenue and retention with voice automation for order updates, cart recovery, loyalty enrollment, and post-purchase engagement. This example shows you how to automate loyalty program enrollment 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 LoyaltyEnrollmentBot(guava.CallController):
def __init__(self, customer_name: str, total_spend: float, program_name: str):
super().__init__()
self.set_persona(
organization_name="Pinnacle Commerce",
agent_name="Morgan",
)
self.set_task(
objective=f"Enroll {customer_name} (lifetime spend: ${total_spend:.2f}) in the {program_name} loyalty program",
checklist=[
f"Greet {customer_name} and thank them for being a valued customer.",
guava.Say(f"Mention that based on their purchase history, they qualify for {program_name} — free."),
guava.Say("Explain the benefits: early access to sales, free shipping, 2x points on every purchase."),
guava.Field(
key="wants_to_enroll",
field_type="bool",
description="Would they like to enroll?",
),
guava.Field(
key="email_for_account",
field_type="email",
description="Email address to use for the loyalty account",
required=False,
),
guava.Field(
key="birthday_month",
field_type="text",
description="Birthday month for a special birthday reward",
required=False,
),
"Confirm enrollment and send welcome email with first bonus points.",
],
on_complete=lambda fields: print(f"Loyalty enrollment: {customer_name} — enrolled: {fields.get('wants_to_enroll')}"),
)
guava.dial(
controller=LoyaltyEnrollmentBot,
controller_args={"customer_name": "Diana West", "total_spend": 1847.00,
"program_name": "Pinnacle Rewards"},
to=os.environ["CUSTOMER_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 LoyaltyEnrollmentBot(guava.CallController):
def __init__(self, customer_name: str, total_spend: float, program_name: str):
super().__init__()
self.set_persona(
organization_name="Pinnacle Commerce",
agent_name="Morgan",
)
self.set_task(
objective=f"Enroll {customer_name} (lifetime spend: ${total_spend:.2f}) in the {program_name} loyalty program",
checklist=[
f"Greet {customer_name} and thank them for being a valued customer.",
guava.Say(f"Mention that based on their purchase history, they qualify for {program_name} — free."),
guava.Say("Explain the benefits: early access to sales, free shipping, 2x points on every purchase."),
guava.Field(
key="wants_to_enroll",
field_type="bool",
description="Would they like to enroll?",
),
guava.Field(
key="email_for_account",
field_type="email",
description="Email address to use for the loyalty account",
required=False,
),
guava.Field(
key="birthday_month",
field_type="text",
description="Birthday month for a special birthday reward",
required=False,
),
"Confirm enrollment and send welcome email with first bonus points.",
],
on_complete=lambda fields: print(f"Loyalty enrollment: {customer_name} — enrolled: {fields.get('wants_to_enroll')}"),
)
guava.dial(
controller=LoyaltyEnrollmentBot,
controller_args={"customer_name": "Diana West", "total_spend": 1847.00,
"program_name": "Pinnacle Rewards"},
to=os.environ["CUSTOMER_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