Delighted API Python Client

4.2.0 · deprecated · verified Tue Apr 14

The Delighted API Python Client (version 4.2.0) is the official Python library for interacting with the Delighted customer experience platform. It enables programmatic access to send surveys, retrieve responses, manage people, and obtain various engagement metrics. The library is currently in a deprecated state, with the Delighted service itself scheduled for sunset on June 30, 2026. Consequently, this package will no longer receive maintenance or updates after this date.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to configure the Delighted client with an API key, create a new person, add a survey response for that person, and retrieve account metrics. It also includes basic error handling for rate limits and general API errors. Ensure you replace 'YOUR_API_KEY' or set the DELIGHTED_API_KEY environment variable.

import os
import delighted

delighted.api_key = os.environ.get('DELIGHTED_API_KEY', 'YOUR_API_KEY')

try:
    # Create a person
    person = delighted.Person.create(email='test@example.com', name='Test User')
    print(f"Created person: {person.id} - {person.email}")

    # Add a survey response for the person
    survey_response = delighted.SurveyResponse.create(person=person.id, score=10, comment='Very satisfied!')
    print(f"Added survey response: {survey_response.id} with score {survey_response.score}")

    # Retrieve metrics
    metrics = delighted.Metrics.retrieve()
    print(f"Retrieved metrics: {metrics}")

except delighted.errors.TooManyRequestsError as err:
    print(f"Rate limit exceeded. Please wait {err.retry_after} seconds before retrying.")
except delighted.errors.APIError as err:
    print(f"An API error occurred: {err.message}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →