← Twilio Developer KitCONTENT HISTORY

Update to Twilio Developer Kit

Snapshot Sep 30, 2026 · 22:50 UTC · version 0.2.2

Collection source: not recorded for this historical snapshot.

WHAT CHANGED · RULE-BASED ANALYSIS

First saved snapshot

No earlier snapshot is available to establish a change.

Compare saved observations

Download comparison JSON
Full technical diff · 0 changed fields
Full snapshot data
{
  "name": "twilio-customer-memory",
  "description": "Store and retrieve customer context using Twilio Conversation Memory. Covers Memory Store provisioning, profile management, traits, observations, conversation summaries, and semantic Recall. Use this skill to give AI agents or human agents persistent memory of customer interactions across sessions and channels.",
  "included_files": [
    {
      "relative_path": "agents/openai.yaml",
      "size_in_bytes": 225
    }
  ],
  "skill_md_contents": "---\nname: twilio-customer-memory\ndescription: >\n  Store and retrieve customer context using Twilio Conversation Memory.\n  Covers Memory Store provisioning, profile management, traits, observations,\n  conversation summaries, and semantic Recall. Use this skill to give AI agents\n  or human agents persistent memory of customer interactions across sessions\n  and channels.\n---\n\n## Overview\n\nConversation Memory gives your application persistent customer memory. Observations (what happened) and traits (who the customer is) are written automatically from conversations flowing through Conversation Orchestrator/Orchestrator — or posted directly if you run your own extraction. Retrieve relevant context via Recall before responding.\n\n```\nConversation Orchestrator/Orchestrator conversation → auto-extracted observations & summaries → Memory Store\nYour App → Recall → relevant context injected into LLM prompt\n```\n\n**All Conversation Memory APIs are on `memory.twilio.com`.** Observations, traits, profiles, summaries — everything is on the same host.\n\n**Auth: Basic Auth** — `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN`.\n\n---\n\n## Prerequisites\n\n- Twilio account with Conversation Memory access (requires enablement)\n  — New to Twilio? See `twilio-account-setup`\n- `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` — see `twilio-iam-auth-setup`\n- **Memory Store must be created before creating a Conversations Service in Conversation Orchestrator/Orchestrator** — the store SID is required in the conversation config\n- For conversation orchestration: `twilio-conversation-orchestrator`\n\n---\n\n## Quickstart\n\n### Step 1 — Create a Memory Store\n\nDo this before setting up Conversation Orchestrator/Orchestrator. The Memory Store SID goes into your conversation service config.\n\n**Python**\n```python\nimport os, requests\n\naccount_sid = os.environ[\"TWILIO_ACCOUNT_SID\"]\nauth_token = os.environ[\"TWILIO_AUTH_TOKEN\"]\n\nstore = requests.post(\n    \"https://memory.twilio.com/v1/Services\",\n    auth=(account_sid, auth_token),\n    json={\n        \"uniqueName\": \"my-app-memory\",\n        \"friendlyName\": \"My App Memory Store\"\n    }\n).json()\n\nmemory_store_sid = store[\"sid\"]\nprint(memory_store_sid)\n```\n\n**Node.js**\n```javascript\nconst accountSid = process.env.TWILIO_ACCOUNT_SID;\nconst authToken = process.env.TWILIO_AUTH_TOKEN;\n\nconst store = await fetch(\"https://memory.twilio.com/v1/Services\", {\n    method: \"POST\",\n    headers: {\n        \"Authorization\": \"Basic \" + btoa(`${accountSid}:${authToken}`),\n        \"Content-Type\": \"application/json\",\n    },\n    body: JSON.stringify({\n        uniqueName: \"my-app-memory\",\n        friendlyName: \"My App Memory Store\",\n    }),\n}).then(r => r.json());\n\nconst memoryStoreSid = store.sid;\n```\n\nUse `memory_store_sid` when creating your Conversations Service in Conversation Orchestrator/Orchestrator. The two must be linked for automatic observation and summary extraction to work.\n\n### Step 2 — Profiles\n\nProfiles are **created automatically** when conversations flow through Conversation Orchestrator/Orchestrator — the conversation config determines how participants are resolved into profiles. You can also create or enrich profiles manually using traits.\n\n**Create a profile manually with traits:**\n\n**Python**\n```python\nprofile = requests.post(\n    f\"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles\",\n    auth=(account_sid, auth_token),\n    json={\n        \"traits\": {\n            \"Contact\": {\n                \"phone\": \"+15558675310\",\n                \"firstName\": \"Alyssa\",\n                \"lastName\": \"Mock\",\n                \"email\": \"alyssa@example.com\"\n            }\n        }\n    }\n).json()\n\nprofile_id = profile[\"id\"]\n```\n\n**Node.js**\n```javascript\nconst profile = await fetch(\n    `https://memory.twilio.com/v1/Services/${memoryStoreSid}/Profiles`,\n    {\n        method: \"POST\",\n        headers: {\n            \"Authorization\": \"Basic \" + btoa(`${accountSid}:${authToken}`),\n            \"Content-Type\": \"application/json\",\n        },\n        body: JSON.stringify({\n            traits: {\n                Contact: {\n                    phone: \"+15558675310\",\n                    firstName: \"Alyssa\",\n                    lastName: \"Mock\",\n                    email: \"alyssa@example.com\",\n                }\n            }\n        }),\n    }\n).then(r => r.json());\n\nconst profileId = profile.id;\n```\n\n**Look up a profile by phone number** (for inbound calls where you only have the caller's number):\n\n**Python**\n```python\nlookup = requests.post(\n    f\"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles/Lookup\",\n    auth=(account_sid, auth_token),\n    json={\"idType\": \"phone\", \"value\": \"+15558675310\"}\n).json()\n\nprofile_id = lookup[\"profiles\"][0][\"id\"] if lookup.get(\"profiles\") else None\n```\n\n### Step 3 — Observations\n\nObservations are **extracted automatically** from conversations when a conversation becomes inactive or is closed, based on your conversation config. You don't need to write them manually for Conversation Orchestrator-managed conversations.\n\n**If you run your own extraction** (custom pipeline outside Conversation Orchestrator), post results directly:\n\n**Python**\n```python\nrequests.post(\n    f\"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles/{profile_id}/Observations\",\n    auth=(account_sid, auth_token),\n    json={\n        \"observations\": [\n            {\n                \"content\": \"Customer asked about order #4521. Wants expedited shipping. Prefers SMS updates.\",\n                \"source\": \"custom_extraction\",\n                \"occurredAt\": \"2026-04-20T14:30:00Z\",\n                \"conversationIds\": [conversation_sid]\n            }\n        ]\n    }\n)\n```\n\n**Node.js**\n```javascript\nawait fetch(\n    `https://memory.twilio.com/v1/Services/${memoryStoreSid}/Profiles/${profileId}/Observations`,\n    {\n        method: \"POST\",\n        headers: {\n            \"Authorization\": \"Basic \" + btoa(`${accountSid}:${authToken}`),\n            \"Content-Type\": \"application/json\",\n        },\n        body: JSON.stringify({\n            observations: [{\n                content: \"Customer asked about order #4521. Wants expedited shipping. Prefers SMS updates.\",\n                source: \"custom_extraction\",\n                occurredAt: new Date().toISOString(),\n                conversationIds: [conversationSid],\n            }]\n        }),\n    }\n);\n```\n\nBatch up to 10 observations in one request.\n\n### Step 4 — Recall Context Before Responding\n\nRecall runs hybrid lexical + semantic search and returns the most relevant observations and summaries for an LLM prompt.\n\n**Recommended: pass a `conversationId` from Conversation Orchestrator/Orchestrator.** Recall builds a contextually relevant query from the active conversation automatically — no need to craft one yourself.\n\n**Python**\n```python\nrecall = requests.post(\n    f\"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles/{profile_id}/Recall\",\n    auth=(account_sid, auth_token),\n    json={\n        \"conversationId\": orchestrator_conversation_sid,\n        \"observationsLimit\": 10,\n        \"summariesLimit\": 3,\n    }\n).json()\n\nobservations = \"\\n\".join(o[\"content\"] for o in recall.get(\"observations\", []))\nsummaries = \"\\n\".join(s[\"content\"] for s in recall.get(\"summaries\", []))\n\nsystem_prompt = f\"\"\"You are a helpful support agent.\n\nCustomer history:\n{observations}\n\nRecent summaries:\n{summaries}\"\"\"\n```\n\n**Node.js**\n```javascript\nconst recall = await fetch(\n    `https://memory.twilio.com/v1/Services/${memoryStoreSid}/Profiles/${profileId}/Recall`,\n    {\n        method: \"POST\",\n        headers: {\n            \"Authorization\": \"Basic \" + btoa(`${accountSid}:${authToken}`),\n            \"Content-Type\": \"application/json\",\n        },\n        body: JSON.stringify({\n            conversationId: orchestratorConversationSid,\n            observationsLimit: 10,\n            summariesLimit: 3,\n        }),\n    }\n).then(r => r.json());\n\nconst context = [\n    ...recall.observations.map(o => o.content),\n    ...recall.summaries.map(s => s.content),\n].join(\"\\n\");\n```\n\n**Other Recall modes:**\n\n| Mode | How | When to use |\n|------|-----|-------------|\n| Conversation ID (recommended) | `\"conversationId\": orchestrator_sid` | Active Conversation Orchestrator/Orchestrator conversation — query is generated from conversation context |\n| Custom query | `\"query\": \"your question\"` | Custom pipelines outside Conversation Orchestrator, or when you need precise control over relevance |\n| No query | Omit both `query` and `conversationId` | Returns most recent observations in chronological order — useful for loading history at session start |\n\n---\n\n## Key Patterns\n\n### Trait Groups\n\nTraits are organized into named groups. The `Contact` group is the standard identity anchor — its fields are promoted to profile identifiers for lookup.\n\n| Group | Fields | Use |\n|-------|--------|-----|\n| `Contact` | phone, email, firstName, lastName | Identity anchor — always include |\n| `Account` | accountNumber, tier, region | Business account data |\n| `Support` | disposition, caseId, lastIssueType | Support history |\n\nDefine your own groups for domain-specific data.\n\n### Summaries\n\nSummaries are written automatically at conversation close or when a conversation goes inactive, based on your conversation config — the same trigger as observations. You can also write them manually:\n\n**Python**\n```python\nrequests.post(\n    f\"https://memory.twilio.com/v1/Services/{memory_store_sid}/Profiles/{profile_id}/ConversationSummaries\",\n    auth=(account_sid, auth_token),\n    json={\n        \"conversationId\": conversation_sid,\n        \"content\": \"Customer called about order #4521. Resolved: approved expedited upgrade.\",\n        \"source\": \"manual\"\n    }\n)\n```\n\nSummaries are returned in the `summaries` array of Recall results.\n\n### Voice Agent Integration\n\nRetrieve memory at call start, store observations at call end. For voice AI agents on ConversationRelay.\n\n**Python (WebSocket handler)**\n```python\nasync def handle_call(websocket):\n    setup = json.loads(await websocket.recv())\n    caller = setup.get(\"from\", \"unknown\")\n\n    # Look up profile by caller phone\n    lookup = requests.post(\n        f\"https://memory.twilio.com/v1/Services/{MEMORY_STORE_SID}/Profiles/Lookup\",\n        auth=(ACCOUNT_SID, AUTH_TOKEN),\n        json={\"idType\": \"phone\", \"value\": caller}\n    ).json()\n    profiles = lookup.get(\"profiles\", [])\n    profile_id = profiles[0][\"id\"] if profiles else None\n\n    context = \"\"\n    if profile_id:\n        recall = requests.post(\n            f\"https://memory.twilio.com/v1/Services/{MEMORY_STORE_SID}/Profiles/{profile_id}/Recall\",\n            auth=(ACCOUNT_SID, AUTH_TOKEN),\n            json={\"observationsLimit\": 5, \"summariesLimit\": 2}\n        ).json()\n        context = \"\\n\".join(o[\"content\"] for o in recall.get(\"observations\", []))\n\n    system_prompt = f\"You are a helpful agent.\\n\\nCustomer history:\\n{context}\" if context else \"You are a helpful agent.\"\n\n    # ... handle conversation ...\n\n    # Store observation at end if running custom extraction\n    if profile_id:\n        requests.post(\n            f\"https://memory.twilio.com/v1/Services/{MEMORY_STORE_SID}/Profiles/{profile_id}/Observations\",\n            auth=(ACCOUNT_SID, AUTH_TOKEN),\n            json={\"observations\": [{\"content\": call_summary, \"source\": \"voice_agent\", \"conversationIds\": [orchestrator_conversation_sid]}]}\n        )\n```\n\n### Multi-Tenant (ISV) Pattern\n\nUse one Memory Store per client. The `uniqueName` doubles as a namespace.\n\n```python\n# At client onboarding\nstore = requests.post(\n    \"https://memory.twilio.com/v1/Services\",\n    auth=(account_sid, auth_token),\n    json={\"uniqueName\": f\"client-{client_id}\", \"friendlyName\": client_name}\n).json()\n# Store store[\"sid\"] in your tenant config — pass it to Conversation Orchestrator conversation service setup\n```\n\n---\n\n## CANNOT\n\n- **Cannot create Conversation Orchestrator before Memory Store** — Create Memory Store first. Its SID is required when creating the Conversations Service. Reversing this order breaks the linkage.\n- **Cannot extract observations mid-conversation** — Automatic extraction happens on conversation close or inactive. For real-time writing, post directly to the Observations endpoint.\n- **Cannot read observations immediately after write** — Eventual consistency. Allow ~2 seconds after write before querying Recall.\n- **Cannot exceed 15 Memory Stores per account** — ISVs with more than 15 tenants should use sub-accounts\n- **Cannot detect misconfigured linkages** — If Memory Store is not correctly linked in Conversation Orchestrator config, observations are silently not extracted. See `twilio-debugging-observability`.\n- **Cannot recover deleted profiles** — Profile deletion is irreversible, permanent\n- **Cannot exceed 20 observations per Recall query** — `observationsLimit` max 20, default 5. `summariesLimit` and `communicationsLimit` similar.\n- **Cannot batch more than 10 observations per request** — Hard limit on batch writes\n\n---\n\n## Next Steps\n\n- **Set up Conversation Orchestrator conversations:** `twilio-conversation-orchestrator`\n- **Add real-time intelligence:** `twilio-conversation-intelligence`\n- **Enterprise knowledge retrieval (scripts, offers, policies):** `twilio-enterprise-knowledge`\n- **Voice agent setup:** `twilio-voice-conversation-relay`\n- **Debug integration issues:** `twilio-debugging-observability`\n"
}

SHA-256: 615c4371f2cda19ec9993927649c4f3dee3712f798389f698c12064d38c4a3a5