Retail & E-Commerce

Post-Purchase Feedback Surveys

Call customers 7-14 days after delivery to capture product satisfaction, identify issues before they become returns, and generate review content.

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 post-purchase feedback surveys calls end-to-end with Guava's SDK — no telephony plumbing, no prompt engineering, just Python.

How to set persona & task
Working with Fields and Say items
Handling callbacks
Running the agent
Step 01

Installation

Install from Guava's private PyPI index. A public package is coming soon — the install command will simplify to pip install guava.

terminal
# 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="..."
Step 02

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.

01

Imports

Import the Guava SDK and any helpers you need. guava.CallController is the base class for every voice agent.

example.py
# Install: pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
import guava
import os
02

Agent 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.

example.py
class PostPurchaseSurveyBot(guava.CallController):
    def __init__(self, customer_name: str, product_name: str, order_id: str):
        super().__init__()
        self.set_persona(
            organization_name="Pinnacle Commerce",
            agent_name="Jamie",
        )
        self.set_task(
            objective=f"Survey {customer_name} about their purchase of {product_name} (order {order_id})",
            checklist=[
                f"Greet {customer_name} and ask for 90 seconds to give feedback on their recent purchase.",
                guava.Field(
                    key="product_received",
                    field_type="bool",
                    description=f"Did the customer receive their {product_name}?",
                ),
                guava.Field(
                    key="product_satisfaction",
                    field_type="rating",
                    description="Product satisfaction rating (1-5)",
                ),
                guava.Field(
                    key="delivery_satisfaction",
                    field_type="rating",
                    description="Delivery experience rating (1-5)",
                ),
                guava.Field(
                    key="any_issues",
                    field_type="bool",
                    description="Did the customer experience any issues?",
                ),
                guava.Field(
                    key="issue_description",
                    field_type="text",
                    description="Brief description of the issue",
                    required=False,
                ),
                guava.Field(
                    key="would_recommend",
                    field_type="bool",
                    description="Would they recommend this product to a friend?",
                ),
                "Thank them and offer a discount code for their next purchase.",
            ],
            on_complete=lambda fields: print(f"Survey done for {customer_name}: {fields}"),
        )

guava.dial(
    controller=PostPurchaseSurveyBot,
    controller_args={"customer_name": "Mike Thornton", "product_name": "Apex Standing Desk",
                     "order_id": "ORD-774421"},
    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

Step 03

Full example

The complete file — copy it, save it as example.py, and run it.

example.py
# Install: pip install gridspace-guava --extra-index-url https://guava-pypi.gridspace.com
import guava
import os

class PostPurchaseSurveyBot(guava.CallController):
    def __init__(self, customer_name: str, product_name: str, order_id: str):
        super().__init__()
        self.set_persona(
            organization_name="Pinnacle Commerce",
            agent_name="Jamie",
        )
        self.set_task(
            objective=f"Survey {customer_name} about their purchase of {product_name} (order {order_id})",
            checklist=[
                f"Greet {customer_name} and ask for 90 seconds to give feedback on their recent purchase.",
                guava.Field(
                    key="product_received",
                    field_type="bool",
                    description=f"Did the customer receive their {product_name}?",
                ),
                guava.Field(
                    key="product_satisfaction",
                    field_type="rating",
                    description="Product satisfaction rating (1-5)",
                ),
                guava.Field(
                    key="delivery_satisfaction",
                    field_type="rating",
                    description="Delivery experience rating (1-5)",
                ),
                guava.Field(
                    key="any_issues",
                    field_type="bool",
                    description="Did the customer experience any issues?",
                ),
                guava.Field(
                    key="issue_description",
                    field_type="text",
                    description="Brief description of the issue",
                    required=False,
                ),
                guava.Field(
                    key="would_recommend",
                    field_type="bool",
                    description="Would they recommend this product to a friend?",
                ),
                "Thank them and offer a discount code for their next purchase.",
            ],
            on_complete=lambda fields: print(f"Survey done for {customer_name}: {fields}"),
        )

guava.dial(
    controller=PostPurchaseSurveyBot,
    controller_args={"customer_name": "Mike Thornton", "product_name": "Apex Standing Desk",
                     "order_id": "ORD-774421"},
    to=os.environ["CUSTOMER_PHONE"],
    agent_number=os.environ["GUAVA_AGENT_NUMBER"],
    api_key=os.environ["GUAVA_API_KEY"],
)
Step 04

Run it

Start the agent. It will connect to Guava's infrastructure and begin accepting calls on your assigned number.

terminal
python example.py
Get Started