Skip to main content

Filtering Interactions

The interactions endpoint supports powerful filtering options to help you retrieve exactly the data you need. This guide covers common use cases with practical examples.

Filter Parameters

ParameterTypeDescription
channelstringvoice or whatsapp
typestringInteraction type (varies by channel)
outcomestringFilter by outcome (comma-separated for multiple, e.g., APPOINTMENT_BOOKED,APPOINTMENT_MODIFIED)
clinic_idstringSpecific clinic UUID
date_fromstringStart date (ISO 8601, e.g., 2024-01-15)
date_tostringEnd date (ISO 8601, e.g., 2024-01-31)
searchstringSearch phone numbers (partial match, e.g., 555 matches +1-555-123-4567)

Common Use Cases

Get All WhatsApp Inbound Messages

Retrieve all incoming WhatsApp conversations from patients:
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?channel=whatsapp&type=INBOUND" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Get Voice Campaign Outbound Calls

Retrieve all outbound calls from campaigns (e.g., no-show recovery, reactivation):
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?channel=voice&type=CAMPAIGN_OUTBOUND" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Get All Appointment Reminders

Retrieve WhatsApp appointment reminder conversations:
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?type=APPOINTMENT_REMINDER" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Get All Inbound Calls

Retrieve all incoming voice calls:
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?channel=voice&type=INBOUND" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Get Interactions for a Date Range

Retrieve interactions within a specific date range:
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?date_from=2024-01-01&date_to=2024-01-31" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Get Interactions by Outcome

Filter by specific outcomes (e.g., new bookings):
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?outcome=APPOINTMENT_BOOKED" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Filter by Clinic

Get interactions for a specific clinic:
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?clinic_id=550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Combine Multiple Filters

You can combine multiple filters for precise queries:
# Get WhatsApp campaign messages from January 2024 for a specific clinic
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?channel=whatsapp&type=CAMPAIGN_OUTBOUND&date_from=2024-01-01&date_to=2024-01-31&clinic_id=550e8400-e29b-41d4-a716-446655440000" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Pagination

When dealing with large datasets, use pagination:
# Get page 2 with 50 items per page
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?page=2&limit=50" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Iterating Through All Pages

async function getAllInteractions(apiKey, filters = {}) {
  const interactions = [];
  let page = 1;
  let hasMore = true;

  while (hasMore) {
    const params = new URLSearchParams({
      ...filters,
      page: page.toString(),
      limit: '100'
    });

    const response = await fetch(
      `https://api.getdoppel.ai/api/v1/interactions?${params}`,
      {
        headers: {
          'Authorization': `Bearer ${apiKey}`
        }
      }
    );

    const data = await response.json();
    interactions.push(...data.data.interactions);

    hasMore = data.meta.has_more;
    page++;
  }

  return interactions;
}

// Usage: Get all WhatsApp inbounds
const allWhatsAppInbounds = await getAllInteractions('dpl_live_YOUR_API_KEY', {
  channel: 'whatsapp',
  type: 'INBOUND'
});

Search by Phone Number

Use the search parameter to find interactions by phone number. Search uses partial matching - any phone number containing your search term will be returned.
# Search for interactions with phone numbers containing "555"
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?search=555" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

# Search for a specific phone number (URL-encode the + as %2B)
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?search=%2B34612345678" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"
The search parameter is case-insensitive and matches any part of the phone number. For example, search=555 will match +1-555-123-4567, 555-1234, etc.

Multi-Outcome Filtering

Filter interactions by multiple outcomes at once using comma-separated values. This is useful for getting all appointment-related interactions in a single request.
# Get all appointment-related interactions (booked, modified, or cancelled)
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?outcome=APPOINTMENT_BOOKED,APPOINTMENT_MODIFIED,APPOINTMENT_CANCELLED" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Valid Outcome Values

OutcomeDescription
APPOINTMENT_BOOKEDNew appointment was scheduled
APPOINTMENT_MODIFIEDExisting appointment was rescheduled
APPOINTMENT_CANCELLEDAppointment was cancelled
NO_ANSWERCall was not answered
VOICEMAIL_REACHEDCall went to voicemail
CALLBACK_REQUESTEDPatient requested a callback
OPT_OUTPatient opted out of communications
DECISION_PENDINGPatient needs more time to decide
Outcome values are case-sensitive and must be UPPERCASE. Invalid values will return a 400 validation error.

Get All Bookings

A common use case is retrieving all appointment-related interactions from a date range:
# Get all bookings and modifications from the last 30 days
curl -X GET "https://api.getdoppel.ai/api/v1/interactions?outcome=APPOINTMENT_BOOKED,APPOINTMENT_MODIFIED,APPOINTMENT_CANCELLED&date_from=2024-12-06&date_to=2025-01-05" \
  -H "Authorization: Bearer dpl_live_YOUR_API_KEY"

Quick Reference: Filter Combinations

Use CaseFilters
All inbound callschannel=voice&type=INBOUND
All outbound campaign callschannel=voice&type=CAMPAIGN_OUTBOUND
Callback callschannel=voice&type=CAMPAIGN_CALLBACK
Form-triggered callschannel=voice&type=FORM_OUTBOUND
All inbound WhatsAppchannel=whatsapp&type=INBOUND
WhatsApp campaignschannel=whatsapp&type=CAMPAIGN_OUTBOUND
Appointment reminderstype=APPOINTMENT_REMINDER
New bookingsoutcome=APPOINTMENT_BOOKED
All appointment changesoutcome=APPOINTMENT_BOOKED,APPOINTMENT_MODIFIED,APPOINTMENT_CANCELLED
Last 30 daysdate_from=2024-12-06&date_to=2025-01-05
Search by phonesearch=555 (partial match)