You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -21,7 +25,7 @@ Build a chat integration that receives complete responses after processing, perf
21
25
22
26
## Scenario
23
27
24
-
We'll build a help desk system for "TechFlow" that processes support messages through text chat and maintains conversation history using sessions.
28
+
We'll build a help desk system for "TechFlow" that processes support messages through text chat and maintains conversation history using `previousChatId`.
25
29
26
30
---
27
31
@@ -101,103 +105,13 @@ We'll build a help desk system for "TechFlow" that processes support messages th
101
105
102
106
---
103
107
104
-
## 2. Context Management with Sessions
105
-
106
-
<Steps>
107
-
<Steptitle="Create a session for persistent context">
108
-
Sessions allow multiple chats to share the same conversation context:
109
-
110
-
```bash title="Create Session"
111
-
curl -X POST https://api.vapi.ai/session\
112
-
-H "Authorization: Bearer YOUR_API_KEY" \
113
-
-H "Content-Type: application/json" \
114
-
-d '{
115
-
"assistantId": "your-assistant-id"
116
-
}'
117
-
```
118
-
</Step>
119
-
<Steptitle="Use the session across multiple chats">
120
-
Once you have a session ID, use it for related conversations:
121
-
122
-
```bash title="First Message with Session"
123
-
curl -X POST https://api.vapi.ai/chat\
124
-
-H "Authorization: Bearer YOUR_API_KEY" \
125
-
-H "Content-Type: application/json" \
126
-
-d '{
127
-
"sessionId": "session_abc123",
128
-
"input": "My account is locked and I can't access the dashboard"
129
-
}'
130
-
```
131
-
132
-
```bash title="Follow-up in Same Session"
133
-
curl -X POST https://api.vapi.ai/chat\
134
-
-H "Authorization: Bearer YOUR_API_KEY" \
135
-
-H "Content-Type: application/json" \
136
-
-d '{
137
-
"sessionId": "session_abc123",
138
-
"input": "I tried the suggestions but still can't get in"
139
-
}'
140
-
```
141
-
</Step>
142
-
<Steptitle="Implement session management in TypeScript">
143
-
Build a session-aware chat manager:
144
-
145
-
```typescript title="session-manager.ts"
146
-
async function createChatSession(assistantId: string): Promise<string> {
0 commit comments