Delighted API Python Client
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
- breaking The Delighted service itself is being sunset on June 30, 2026. After this date, the API and this client library will cease to function.
- deprecated This Python client package is officially deprecated and will no longer be maintained or receive updates.
- gotcha API authentication uses HTTP Basic Auth where your API key is the username and the password field must be left blank.
- gotcha Requests are subject to rate limits. Exceeding them will raise a `delighted.errors.TooManyRequestsError` exception with a `retry_after` attribute.
- gotcha The `delighted` module must be configured with your API key, either globally via `delighted.api_key` or by passing a `Client` instance to resource actions.
Install
-
pip install --upgrade delighted
Imports
- delighted
import delighted
- SurveyResponse
delighted.SurveyResponse.create(...)
- Metrics
delighted.Metrics.retrieve()
- AutopilotConfiguration
delighted.AutopilotConfiguration.retrieve('email') - TooManyRequestsError
from delighted.errors import TooManyRequestsError
Quickstart
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}")