Twilio Flex Connector

Verbinde dein Twilio-Flex-Contact-Center über Tajo mit Brevo, um einheitliche Kund:innen-Interaktionshistorien, Post-Conversation-Marketing-Flows und supportgetriebene Engagement-Analysen zu ermöglichen.

Überblick

EigenschaftWert
PlattformTwilio Flex
KategorieCustom
EinrichtungsaufwandFortgeschritten
Offizielle IntegrationNein
Synchronisierte DatenKund:innen, Gespräche, Events
Genutzte APIsFlex API, Conversations API, TaskRouter API
AuthentifizierungAccount SID + Auth Token / API Key
Basis-URLhttps://flex-api.twilio.com

Funktionen

  • Gesprächs-Synchronisation - Leite Voice-, SMS-, WhatsApp- und Chat-Interaktionen an Brevo-Zeitleisten weiter
  • Kund:innen-Profil-Anreicherung - Synchronisiere Flex-Kund:innen-Daten in Brevo-Kontaktattribute
  • Post-Interaktions-Kampagnen - Löse Brevo-Workflows nach Ende von Support-Gesprächen aus
  • CSAT-Event-Tracking - Synchronisiere Ergebnisse von Zufriedenheitsumfragen als Brevo-Events
  • Agent:innen-Aktivitätsdaten - Verfolge Agent:innen-Performance-Metriken fürs operative Reporting
  • Queue-Analysen - Leite Wartezeit- und Abbruchdaten für die Experience-Optimierung weiter

Voraussetzungen

Bevor du beginnst, stelle sicher, dass du Folgendes hast:

  1. Ein Twilio-Konto mit aktiviertem Flex
  2. Deine Twilio Account SID und deinen Auth Token
  3. Eine Flex-Instanz mit aktiven Channels (Voice, SMS, Chat oder WhatsApp)
  4. Einen konfigurierten TaskRouter-Workspace
  5. Ein Brevo-Konto mit API-Zugriff
  6. Ein Tajo-Konto mit aktivem Abonnement

Authentifizierung

Twilio Flex nutzt die Standard-Authentifizierungsmethoden von Twilio.

Konto-Zugangsdaten

Terminal window
# Basic Auth: Account SID as username, Auth Token as password
curl -X GET "https://flex-api.twilio.com/v1/Configuration" \
-u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN"

API Key (empfohlen für Produktion)

  1. Gehe zu Twilio Console > Account > API keys & tokens
  2. Klicke auf Create API Key
  3. Wähle den Key-Typ Standard
  4. Speichere SID und Secret sicher
Terminal window
curl -X GET "https://flex-api.twilio.com/v1/Configuration" \
-u "$TWILIO_API_KEY_SID:$TWILIO_API_KEY_SECRET"

Auth Token vs. API Key

Dein Auth Token gewährt vollständigen Kontozugriff. Für die Produktion nutze gescopte API Keys. API Keys lassen sich einzeln widerrufen, ohne andere Integrationen zu stören.

Verbinden mit Tajo

Terminal window
tajo connectors install twilio-flex \
--account-sid $TWILIO_ACCOUNT_SID \
--auth-token $TWILIO_AUTH_TOKEN \
--flex-flow-sid $TWILIO_FLEX_FLOW_SID

Konfiguration

Grundeinrichtung

connectors:
twilio_flex:
enabled: true
account_sid: "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
flex_flow_sid: "FOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
sync:
conversations: true
tasks: true
customers: true
csat: true
agent_activity: false
lists:
support_contacts: 32
csat_respondents: 33
channels:
- voice
- sms
- whatsapp
- webchat

Feld-Mapping

Mappe Flex-Kund:innen- und Interaktionsdaten auf Brevo-Attribute:

field_mapping:
# Customer fields
identity: FLEX_IDENTITY
friendly_name: FIRSTNAME
attributes.email: email
attributes.phone: SMS
# Interaction metrics
last_conversation_date: LAST_SUPPORT_DATE
total_conversations: SUPPORT_TICKET_COUNT
avg_wait_time: AVG_WAIT_TIME
last_csat_score: CSAT_SCORE
preferred_channel: PREFERRED_CHANNEL
# Custom attributes
customer_tier: VIP_TIER
account_id: ACCOUNT_ID

Event-Mapping

event_mapping:
task.created: SUPPORT_REQUESTED
task.completed: SUPPORT_RESOLVED
task.canceled: SUPPORT_ABANDONED
conversation.ended: CONVERSATION_ENDED
survey.completed: CSAT_SUBMITTED

API-Endpoints

Tajo integriert sich mit den folgenden Twilio-Flex- und verwandten API-Endpoints:

EndpointMethodeAPIZweck
/v1/ConfigurationGETFlexFlex-Konfiguration abrufen
/v1/InteractionsGETFlexInteraktionen auflisten
/v1/ChannelsGETFlexFlex-Channels auflisten
/v1/WebChannelsPOSTFlexWeb-Chat-Channel erstellen
/v1/ConversationsGETConversationsGespräche auflisten
/v1/Conversations/{sid}/MessagesGETConversationsNachrichten eines Gesprächs auflisten
/v1/Conversations/{sid}/ParticipantsGETConversationsTeilnehmende auflisten
/v1/Workspaces/{sid}/TasksGETTaskRouterTasks auflisten
/v1/Workspaces/{sid}/WorkersGETTaskRouterWorker (Agent:innen) auflisten
/v1/Workspaces/{sid}/TaskQueuesGETTaskRouterTask-Queues auflisten
/v1/Workspaces/{sid}/EventsGETTaskRouterWorkspace-Events auflisten

Code-Beispiele

Connector initialisieren

import { TajoClient } from '@tajo/sdk';
const tajo = new TajoClient({
apiKey: process.env.TAJO_API_KEY,
brevoApiKey: process.env.BREVO_API_KEY
});
await tajo.connectors.connect('twilio-flex', {
accountSid: process.env.TWILIO_ACCOUNT_SID,
authToken: process.env.TWILIO_AUTH_TOKEN,
flexFlowSid: process.env.TWILIO_FLEX_FLOW_SID
});

Gesprächsverlauf synchronisieren

await tajo.connectors.sync('twilio-flex', {
type: 'incremental',
resources: ['conversations'],
since: '2024-01-01',
channels: ['voice', 'sms', 'whatsapp']
});
const status = await tajo.connectors.status('twilio-flex');
console.log(status);
// {
// connected: true,
// lastSync: '2024-03-15T16:00:00Z',
// conversationsTracked: 12400,
// customersLinked: 8900,
// agentsMonitored: 45
// }

Post-Conversation-Kampagnen-Trigger

// Trigger a Brevo follow-up after a support conversation ends
app.post('/webhooks/flex/task-complete', async (req, res) => {
const task = req.body;
await tajo.connectors.handleEvent('twilio-flex', {
type: 'task.completed',
payload: {
taskSid: task.TaskSid,
customerEmail: task.TaskAttributes?.email,
channel: task.TaskChannelUniqueName,
duration: task.Age,
queueName: task.TaskQueueFriendlyName
}
});
res.status(200).send('OK');
});

Flex-Plugin-Integration

// Inside a Flex UI Plugin - send data to Tajo
import { FlexPlugin } from '@twilio/flex-plugin';
class TajoPlugin extends FlexPlugin {
init(flex, manager) {
flex.Actions.addListener('afterCompleteTask', async (payload) => {
await fetch('https://api.tajo.io/webhooks/flex/task-complete', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
TaskSid: payload.task.sid,
TaskAttributes: payload.task.attributes,
TaskChannelUniqueName: payload.task.taskChannelUniqueName,
Age: payload.task.age
})
});
});
}
}

Rate Limits

Twilio erzwingt Rate Limits über seine APIs hinweg:

APIRate LimitHinweise
Flex API100 Anfragen/SekundePro Konto
Conversations API100 Anfragen/SekundePro Konto
TaskRouter API30 Read-Anfragen/SekundePro Workspace
TaskRouter Events20 Anfragen/SekundePro Workspace

Event Streams

Für die Verarbeitung großer Event-Volumen empfiehlt sich Twilio Event Streams statt Polling auf TaskRouter-Events. Event Streams pushen Events in Echtzeit über Webhooks oder Kinesis.

Fehlerbehebung

Häufige Probleme

ProblemUrsacheLösung
401 UnauthorizedUngültige SID oder TokenAccount SID und Auth Token in der Twilio Console prüfen
403 ForbiddenFlex nicht aktiviertSicherstellen, dass Flex in deinem Twilio-Konto aktiviert ist
Gespräche fehlenFalscher DatumsbereichSync-Datumsbereich erweitern oder Gesprächsstatus prüfen
Tasks werden nicht erfasstFalscher TaskRouter-WorkspaceKorrekten Workspace-SID prüfen
Plugin feuert nichtEvent-Listener nicht registriertPrüfen, dass das Flex-Plugin deployed und aktiv ist

Debug-Modus

connectors:
twilio_flex:
debug: true
log_level: verbose
log_api_calls: true

Verbindung testen

Terminal window
tajo connectors test twilio-flex
# ✓ Flex API connection successful
# ✓ Conversations API accessible
# ✓ TaskRouter workspace found
# ✓ Agent list readable
# ✓ Queue configuration loaded

Best Practices

  1. API Keys statt Auth Tokens - API Keys lassen sich scopen und einzeln widerrufen
  2. Event Streams nutzen - Push-basierte Events sind effizienter als Polling auf TaskRouter
  3. Flex-Plugin bauen - Nutze ein UI-Plugin, um Task-Completion-Events in Echtzeit zu erfassen
  4. Channels einheitlich mappen - Normalisiere Voice-, SMS- und Chat-Daten zu einheitlichen Brevo-Events
  5. CSAT-Scores tracken - Synchronisiere Zufriedenheitsdaten in Brevo für experience-basierte Segmentierung
  6. Queue-Metriken überwachen - Nutze Wartezeitdaten, um proaktive Kund:innen-Kommunikation auszulösen

Sicherheit

  • Account SID + Auth Token - Standard-Twilio-Authentifizierung
  • API Keys - Widerrufbare Non-Root-Zugangsdaten für den Produktiveinsatz
  • Nur HTTPS - Die gesamte API-Kommunikation läuft verschlüsselt über TLS 1.2+
  • Webhook-Validierung - Verifiziere Twilio-Webhook-Signaturen mit X-Twilio-Signature
  • PCI-Konformität - Twilio Flex ist PCI DSS Level 1 konform
  • Verschlüsselte Speicherung - Zugangsdaten werden in Tajo at Rest verschlüsselt

Verwandte Ressourcen

Subscribe to updates

developer-docs

Drop your email or phone number — we'll send you what matters next.

auto-detect
AI-Assistent

Hallo! Fragen Sie mich alles über die Dokumentation.