Skip to content

Commit ffc7375

Browse files
committed
chore: add other pm install options, cleanup
1 parent 7e6fa59 commit ffc7375

File tree

4 files changed

+68
-167
lines changed

4 files changed

+68
-167
lines changed

fern/customization/custom-transcriber.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,26 @@ You'll learn how to:
6363
mkdir vapi-custom-transcriber
6464
cd vapi-custom-transcriber
6565
npm init -y
66+
```
67+
68+
<CodeBlocks>
69+
```bash title="npm"
6670
npm install ws express dotenv @deepgram/sdk
6771
```
72+
73+
```bash title="yarn"
74+
yarn add ws express dotenv @deepgram/sdk
75+
```
76+
77+
```bash title="pnpm"
78+
pnpm add ws express dotenv @deepgram/sdk
79+
```
80+
81+
```bash title="bun"
82+
bun add ws express dotenv @deepgram/sdk
83+
```
84+
</CodeBlocks>
85+
6886
Create a `.env` file with the following content:
6987
```env
7088
DEEPGRAM_API_KEY=your_deepgram_api_key

fern/examples/outbound-call-python.mdx

Lines changed: 34 additions & 160 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,27 @@ Make outbound calls programmatically using various SDKs and languages. This guid
3333
Dashboard calls are great for testing and one-off calls. Use the API for automated outbound campaigns.
3434
</Note>
3535
</Tab>
36-
<Tab title="Web SDK + TypeScript">
36+
<Tab title="TypeScript (Web SDK)">
3737
Create browser-based voice interactions (note: Web SDK doesn't make phone calls to external numbers):
3838

39-
```bash
39+
<CodeBlocks>
40+
```bash title="npm"
4041
npm install @vapi-ai/web
4142
```
4243

44+
```bash title="yarn"
45+
yarn add @vapi-ai/web
46+
```
47+
48+
```bash title="pnpm"
49+
pnpm add @vapi-ai/web
50+
```
51+
52+
```bash title="bun"
53+
bun add @vapi-ai/web
54+
```
55+
</CodeBlocks>
56+
4357
```typescript
4458
import Vapi from '@vapi-ai/web';
4559

@@ -104,13 +118,27 @@ Make outbound calls programmatically using various SDKs and languages. This guid
104118
Web SDK creates browser-based voice interactions. For phone calls to external numbers, use Server SDK APIs.
105119
</Note>
106120
</Tab>
107-
<Tab title="Server SDK + TypeScript">
121+
<Tab title="TypeScript (Server SDK)">
108122
First install the TypeScript SDK:
109123

110-
```bash
124+
<CodeBlocks>
125+
```bash title="npm"
111126
npm install @vapi-ai/server-sdk
112127
```
113128

129+
```bash title="yarn"
130+
yarn add @vapi-ai/server-sdk
131+
```
132+
133+
```bash title="pnpm"
134+
pnpm add @vapi-ai/server-sdk
135+
```
136+
137+
```bash title="bun"
138+
bun add @vapi-ai/server-sdk
139+
```
140+
</CodeBlocks>
141+
114142
```typescript
115143
import { Vapi } from "@vapi-ai/server-sdk";
116144

@@ -171,7 +199,7 @@ Make outbound calls programmatically using various SDKs and languages. This guid
171199
.catch(error => console.error("Failed to initiate call:", error));
172200
```
173201
</Tab>
174-
<Tab title="Server SDK + Python">
202+
<Tab title="Python (Server SDK)">
175203
First install the Python SDK:
176204

177205
```bash
@@ -271,7 +299,7 @@ Make outbound calls programmatically using various SDKs and languages. This guid
271299
}'
272300
```
273301
</Tab>
274-
<Tab title="Web SDK + TypeScript">
302+
<Tab title="TypeScript (Web SDK)">
275303
Monitor outbound calls in real-time:
276304

277305
```typescript
@@ -477,158 +505,4 @@ Make outbound calls programmatically using various SDKs and languages. This guid
477505
});
478506
```
479507
</Tab>
480-
481-
<Tab title="Webhook Integration (Python)">
482-
```python
483-
from flask import Flask, request, jsonify
484-
import requests
485-
from typing import Dict, Any
486-
487-
app = Flask(__name__)
488-
489-
class VapiWebhookHandler:
490-
def __init__(self, api_key: str):
491-
self.api_key = api_key
492-
self.base_url = "https://api.vapi.ai"
493-
494-
def verify_webhook(self, payload: Dict[str, Any]) -> bool:
495-
# Add your webhook verification logic here
496-
# This could include signature verification
497-
return True
498-
499-
def handle_call_status_update(self, webhook_data: Dict[str, Any]) -> None:
500-
call_id = webhook_data.get('call', {}).get('id')
501-
status = webhook_data.get('call', {}).get('status')
502-
503-
print(f"Call {call_id} status updated to: {status}")
504-
505-
if status == 'ended':
506-
self.process_completed_call(call_id)
507-
508-
def process_completed_call(self, call_id: str) -> None:
509-
# Get call details and analysis
510-
headers = {"Authorization": f"Bearer {self.api_key}"}
511-
response = requests.get(
512-
f"{self.base_url}/call/{call_id}",
513-
headers=headers
514-
)
515-
516-
if response.status_code == 200:
517-
call_data = response.json()
518-
519-
# Process call analysis
520-
if 'analysis' in call_data:
521-
self.save_call_analytics(call_data)
522-
523-
# Trigger follow-up actions
524-
self.trigger_followup_actions(call_data)
525-
526-
def save_call_analytics(self, call_data: Dict[str, Any]) -> None:
527-
# Save analytics to your database
528-
analytics = {
529-
'call_id': call_data['id'],
530-
'duration': call_data.get('endedAt', 0) - call_data.get('startedAt', 0),
531-
'summary': call_data.get('analysis', {}).get('summary'),
532-
'success_score': call_data.get('analysis', {}).get('successEvaluation'),
533-
'customer': call_data.get('customer', {})
534-
}
535-
536-
print(f"Saving analytics: {analytics}")
537-
# Your database save logic here
538-
539-
def trigger_followup_actions(self, call_data: Dict[str, Any]) -> None:
540-
# Send follow-up emails, create CRM records, etc.
541-
customer = call_data.get('customer', {})
542-
543-
if customer.get('number'):
544-
print(f"Triggering follow-up for {customer['number']}")
545-
# Your follow-up logic here
546-
547-
# Initialize webhook handler
548-
webhook_handler = VapiWebhookHandler("YOUR_API_KEY")
549-
550-
@app.route('/webhook/vapi', methods=['POST'])
551-
def handle_vapi_webhook():
552-
try:
553-
webhook_data = request.json
554-
555-
# Verify webhook authenticity
556-
if not webhook_handler.verify_webhook(webhook_data):
557-
return jsonify({'error': 'Invalid webhook'}), 401
558-
559-
# Handle different webhook types
560-
webhook_type = webhook_data.get('type')
561-
562-
if webhook_type == 'call-status':
563-
webhook_handler.handle_call_status_update(webhook_data)
564-
elif webhook_type == 'call-ended':
565-
call_id = webhook_data.get('call', {}).get('id')
566-
webhook_handler.process_completed_call(call_id)
567-
568-
return jsonify({'status': 'success'}), 200
569-
570-
except Exception as e:
571-
print(f"Webhook error: {str(e)}")
572-
return jsonify({'error': 'Webhook processing failed'}), 500
573-
574-
if __name__ == '__main__':
575-
app.run(debug=True, port=8000)
576-
```
577-
</Tab>
578508
</Tabs>
579-
580-
## Common Use Cases
581-
582-
### Sales Outreach
583-
```python
584-
# Automated sales follow-up calls
585-
sales_assistant = {
586-
"firstMessage": "Hi {{customer.name}}, this is Sarah from TechCorp. I'm following up on your recent inquiry about our software solutions.",
587-
"model": {
588-
"provider": "openai",
589-
"model": "gpt-4",
590-
"messages": [
591-
{
592-
"role": "system",
593-
"content": "You are a sales representative. Be friendly, informative, and focus on understanding the customer's needs. If they show interest, offer to schedule a demo."
594-
}
595-
]
596-
}
597-
}
598-
```
599-
600-
### Customer Support
601-
```python
602-
# Proactive customer support calls
603-
support_assistant = {
604-
"firstMessage": "Hello {{customer.name}}, this is Alex from CustomerCare. I'm calling to follow up on your recent support ticket #{{ticket_id}}.",
605-
"model": {
606-
"provider": "anthropic",
607-
"model": "claude-3-sonnet-20240229",
608-
"messages": [
609-
{
610-
"role": "system",
611-
"content": "You are a customer support agent. Be empathetic, solution-focused, and ensure customer satisfaction. Always confirm if their issue has been resolved."
612-
}
613-
]
614-
}
615-
}
616-
```
617-
618-
### Appointment Reminders
619-
```python
620-
# Automated appointment confirmation
621-
reminder_assistant = {
622-
"firstMessage": "Hi {{customer.name}}, this is a reminder about your appointment with Dr. {{doctor.name}} tomorrow at {{appointment.time}}.",
623-
"model": {
624-
"provider": "openai",
625-
"model": "gpt-3.5-turbo",
626-
"messages": [
627-
{
628-
"role": "system",
629-
"content": "You are an appointment reminder system. Confirm the appointment, offer to reschedule if needed, and provide any necessary preparation instructions."
630-
}
631-
]
632-
}
633-
}
634-
```
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
Install the package with your preferred package manager.
22

3-
```bash
4-
# with npm
3+
<CodeBlocks>
4+
```bash title="npm"
55
npm install @vapi-ai/web
6-
# with yarn
6+
```
7+
8+
```bash title="yarn"
79
yarn add @vapi-ai/web
8-
# with pnpm
10+
```
11+
12+
```bash title="pnpm"
913
pnpm add @vapi-ai/web
1014
```
15+
16+
```bash title="bun"
17+
bun add @vapi-ai/web
18+
```
19+
</CodeBlocks>

fern/workflows/examples/lead-qualification.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ Before building the workflow, create the necessary tools in your dashboard:
6868

6969
<Steps>
7070
<Step title="Navigate to Tools">
71-
In your Vapi dashboard, click **Tools** in the left sidebar.
71+
In your Vapi dashboard, click `Tools` in the left sidebar.
7272
</Step>
7373
<Step title="Create Lead Lookup Tool">
74-
Click **Create Tool** and configure:
74+
Click `Create Tool` and configure:
7575
- **Tool Name**: "Lead Lookup"
7676
- **Tool Type**: "Function"
7777
- **Function Name**: `lookup_lead`
@@ -132,7 +132,7 @@ Before building the workflow, create the necessary tools in your dashboard:
132132
- Click `Create Workflow`.
133133
- Enter workflow name: `TechFlow Sales Qualification Workflow`.
134134
- Select the default template (includes Call Start node).
135-
- Click "Create Workflow".
135+
- Click `Create Workflow`.
136136
</Step>
137137
</Steps>
138138

0 commit comments

Comments
 (0)