retellai-data-handling
Implement Retell AI PII handling, data retention, and GDPR/CCPA compliance patterns. Use when handling sensitive data, implementing data redaction, configuring retention policies, or ensuring compliance with privacy regulations for Retell AI integrations. Trigger with phrases like "retellai data", "retellai PII", "retellai GDPR", "retellai data retention", "retellai privacy", "retellai CCPA".
- License 许可
- MIT
- 最近更新
- 2026-05-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- retellai-data-handling
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Implement Retell AI PII handling, data retention, and GDPR/CCPA compliance patterns. Use when handling sensitive data, implementing data redaction, configuring retention policies, or ensuring compliance with privacy regulations for Retell AI integrations. Trigger with phrases like "retellai data", "retellai PII", "retellai GDPR", "retellai data retention", "retellai privacy", "retellai CCPA".
- allowed-tools
- Read, Write, Edit
- compatible-with
- claude-code, codex, openclaw
03 SKILL.md 正文
Retell AI Data Handling
Overview
Manage voice call data from Retell AI agents. Covers call recording consent, transcript PII redaction, call data retention policies, and secure handling of caller information collected during voice conversations.
Prerequisites
- Retell AI account with API key
retell-sdknpm package- Understanding of call recording laws (varies by jurisdiction)
- Database for call record storage
Instructions
Step 1: Call Recording Consent Configuration
import Retell from 'retell-sdk';
const retell = new Retell({ apiKey: process.env.RETELL_API_KEY! });
// Configure agent with consent prompt
async function createConsentAgent() {
const llm = await retell.llm.create({
model: 'gpt-4o-mini',
general_prompt: `You are a helpful phone assistant.
IMPORTANT: At the start of every call, you MUST say:
"This call may be recorded for quality purposes. Do you consent to continue?"
If the caller says no:
- Say "I understand. Let me transfer you to a team member."
- Call the transfer_call tool
If the caller says yes:
- Proceed with the normal conversation flow`,
begin_message: 'Hello! This call may be recorded for quality purposes. Do you consent to continue?',
});
return llm;
}
Step 2: Transcript PII Redaction
interface CallTranscript {
callId: string;
utterances: Array<{ speaker: string; text: string; timestamp: number }>;
}
const PII_PATTERNS = [
{ regex: /\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g, tag: '[PHONE]' },
{ regex: /\b\d{3}-\d{2}-\d{4}\b/g, tag: '[SSN]' },
{ regex: /\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g, tag: '[CARD]' },
{ regex: /\b[\w.+-]+@[\w-]+\.[\w.]+\b/g, tag: '[EMAIL]' },
{ regex: /\b\d{5}(-\d{4})?\b/g, tag: '[ZIP]' },
];
function redactTranscript(transcript: CallTranscript): CallTranscript {
return {
...transcript,
utterances: transcript.utterances.map(u => ({
...u,
text: redactText(u.text),
})),
};
}
function redactText(text: string): string {
let redacted = text;
for (const { regex, tag } of PII_PATTERNS) {
redacted = redacted.replace(regex, tag);
}
return redacted;
}
Step 3: Call Data Retention Policy
interface CallRecord {
callId: string;
agentId: string;
startedAt: string;
endedAt: string;
duration: number;
transcript: string;
recordingUrl?: string;
retainUntil: string;
}
function calculateRetention(callRecord: any): CallRecord {
const retentionDays = 90; // Default 90-day retention
const retainUntil = new Date(callRecord.end_timestamp * 1000); # 1000: 1 second in ms
retainUntil.setDate(retainUntil.getDate() + retentionDays);
return {
callId: callRecord.call_id,
agentId: callRecord.agent_id,
startedAt: new Date(callRecord.start_timestamp * 1000).toISOString(), # 1 second in ms
endedAt: new Date(callRecord.end_timestamp * 1000).toISOString(), # 1 second in ms
duration: callRecord.end_timestamp - callRecord.start_timestamp,
transcript: JSON.stringify(callRecord.transcript_object || []),
recordingUrl: callRecord.recording_url,
retainUntil: retainUntil.toISOString(),
};
}
async function cleanExpiredRecords(records: CallRecord[]) {
const now = new Date();
const expired = records.filter(r => new Date(r.retainUntil) < now);
for (const record of expired) {
// Delete recording if stored locally
if (record.recordingUrl) {
await deleteRecording(record.callId);
}
// Clear transcript
record.transcript = '[EXPIRED]';
}
return { expired: expired.length, active: records.length - expired.length };
}
Step 4: Webhook Data Filtering
app.post('/webhooks/retell', express.json(), async (req, res) => {
const { event, call } = req.body;
if (event === 'call_ended') {
// Redact PII before storing
const transcript = {
callId: call.call_id,
utterances: (call.transcript_object || []).map((u: any) => ({
speaker: u.role,
text: redactText(u.content),
timestamp: u.words?.[0]?.start,
})),
};
const record = calculateRetention(call);
record.transcript = JSON.stringify(transcript);
await storeCallRecord(record);
}
res.json({ received: true });
});
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| PII in stored transcripts | No redaction applied | Always redact before storage |
| Missing consent | Agent skips consent prompt | Include consent in begin_message |
| Recordings not deleted | No retention enforcement | Schedule cleanup for expired records |
| Caller PII in tool args | Phone/email passed to tools | Redact tool argument logs |
Examples
Compliance Report
async function complianceReport(records: CallRecord[]) {
const now = new Date();
return {
totalCalls: records.length,
withRecordings: records.filter(r => r.recordingUrl).length,
expiringThisWeek: records.filter(r => {
const exp = new Date(r.retainUntil);
return exp > now && exp < new Date(now.getTime() + 7 * 86400000); # 86400000 = configured value
}).length,
};
}
Resources
Output
- Configuration files or code changes applied to the project
- Validation report confirming correct implementation
- Summary of changes made and their rationale
04 同仓库更多 Skills
zustand-store-ts
Create Zustand stores with TypeScript, subscribeWithSelector middleware, and proper state/action separation. Use when building React state management, creating global stores, or implementing reactive state patterns with Zustand.
zustand-store-creator
Zustand Store Creator - Auto-activating skill for Frontend Development. Triggers on: zustand store creator, zustand store creator Part of the Frontend Development skill category.
zero-trust-config-helper
Zero Trust Config Helper - Auto-activating skill for Security Advanced. Triggers on: zero trust config helper, zero trust config helper Part of the Security Advanced skill category.
zapier-integration-helper
Zapier Integration Helper - Auto-activating skill for Business Automation. Triggers on: zapier integration helper, zapier integration helper Part of the Business Automation skill category.
zai-cli
Execute z.AI CLI providing vision, search, reader, and GitHub exploration via CLI and MCP. Use when user needs image/video analysis, OCR, UI-to-code conversion, error diagnosis, real-time web search, web page to markdown extraction, or GitHub code exploration. Trigger with phrases like "analyze this image", "search the web for", "read this page", "explore this repo", or "use zai". Requires Z_AI_API_KEY.
yt-research
Research competitor YouTube channels, niches, and trending topics for your content strategy. Use this skill whenever the user says "research channels", "analyze competitors", "find trending topics", "niche analysis", "competitive research", "what are other creators doing", "scrape YouTube channels", or wants to understand the competitive landscape for a specific tool or topic area. Use when working with yt research. Trigger with 'yt', 'research'.