Skip to content

Commit 3e721e8

Browse files
committed
fix(workflows): include conditions, first messages, prompts for all nodes
1 parent 371f087 commit 3e721e8

File tree

4 files changed

+1105
-124
lines changed

4 files changed

+1105
-124
lines changed

fern/workflows/examples/appointment-scheduling.mdx

Lines changed: 222 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,30 @@ You'll start with a default template that includes a "Call Start" node. We'll mo
117117
<Step title="Add Customer Verification Node">
118118
Click the + button below the greeting node and add a new **Conversation** node:
119119

120-
**Prompt**:
120+
**Condition**:
121+
```txt
122+
Intent identified
123+
```
124+
125+
**First Message**:
121126
```txt
122127
Now I need to verify your information. Can you please provide your phone number or full name so I can look up your account?
128+
```
129+
130+
**Prompt**:
131+
```txt
132+
You are collecting customer identification information to look them up in the system.
123133

124-
If they provide a phone number, extract it. If they provide a name, extract it.
125-
Be friendly and reassuring about privacy.
134+
If they provide a phone number, extract it in a clean format (numbers only).
135+
If they provide a name, extract their full name.
136+
Be friendly and reassuring about privacy. Keep responses under 25 words.
126137
```
127138

128139
**Extract Variables**:
129140
- Variable: `phone_number`
130141
- Type: `String`
131142
- Description: `Customer's phone number if provided`
143+
<br />
132144
- Variable: `customer_name`
133145
- Type: `String`
134146
- Description: `Customer's full name if provided`
@@ -137,91 +149,274 @@ You'll start with a default template that includes a "Call Start" node. We'll mo
137149
<Step title="Add Customer Lookup Tool Node">
138150
Add a **Tool** node:
139151

152+
**Condition**:
153+
```txt
154+
Customer information collected
155+
```
156+
140157
**Select Tool**: Choose your pre-configured customer lookup tool from the dropdown. This tool will use the extracted `phone_number` and `customer_name` variables to find the customer in your database.
141158
</Step>
142159

143160
<Step title="Add Intent Routing Logic">
144161
Create branching paths based on the customer's intent. Add multiple conversation nodes:
145162

146163
**Schedule New Appointment Node**:
147-
- **Prompt**: `Great! I can help you schedule a new appointment. What type of service would you like? We offer haircuts, beard trims, shampoo and styling, and full grooming packages.`
164+
165+
**Condition**:
166+
```txt
167+
Customer verified and intent is schedule
168+
```
169+
170+
**First Message**:
171+
```txt
172+
Great! I can help you schedule a new appointment. What type of service would you like? We offer haircuts, beard trims, shampoo and styling, and full grooming packages.
173+
```
174+
175+
**Prompt**:
176+
```txt
177+
You are helping the customer schedule a new appointment.
178+
179+
Listen for the service they want and any preferred dates/times they mention.
180+
Be enthusiastic and helpful. Keep responses under 30 words.
181+
If they're unsure about services, briefly describe each option.
182+
```
148183

149184
**Reschedule Appointment Node**:
150-
- **Prompt**: `I can help you reschedule your appointment. Let me first look up your current booking details.`
185+
186+
**Condition**:
187+
```txt
188+
Customer verified and intent is reschedule
189+
```
190+
191+
**First Message**:
192+
```txt
193+
I can help you reschedule your appointment. Let me first look up your current booking details.
194+
```
195+
196+
**Prompt**:
197+
```txt
198+
You are helping the customer reschedule an existing appointment.
199+
200+
Be understanding and accommodating. Look up their current appointment first.
201+
Keep responses under 25 words while being empathetic.
202+
```
151203

152204
**Cancel Appointment Node**:
153-
- **Prompt**: `I can help you cancel your appointment. Let me look up your current booking to confirm the details.`
205+
206+
**Condition**:
207+
```txt
208+
Customer verified and intent is cancel
209+
```
210+
211+
**First Message**:
212+
```txt
213+
I can help you cancel your appointment. Let me look up your current booking to confirm the details.
214+
```
215+
216+
**Prompt**:
217+
```txt
218+
You are helping the customer cancel their appointment.
219+
220+
Be understanding and offer to reschedule instead if appropriate.
221+
Confirm cancellation details before proceeding. Keep responses under 25 words.
222+
```
154223
</Step>
155224

156225
<Step title="Configure Edge Conditions">
157226
Connect the nodes with conditional edges:
158227

159228
**To Schedule Appointment Node**:
160-
- Condition: `if the user said yes` (AI condition)
161-
- Alternative: `{{ intent == "schedule" }}` (Logic condition)
229+
- Condition: `Customer verified and intent is schedule`
162230

163231
**To Reschedule Appointment Node**:
164-
- Condition: `if the user said yes` (AI condition)
165-
- Alternative: `{{ intent == "reschedule" }}` (Logic condition)
232+
- Condition: `Customer verified and intent is reschedule`
166233

167234
**To Cancel Appointment Node**:
168-
- Condition: `if the user said yes` (AI condition)
169-
- Alternative: `{{ intent == "cancel" }}` (Logic condition)
235+
- Condition: `Customer verified and intent is cancel`
170236
</Step>
171237

172238
<Step title="Add Global Error Handling Node">
173239
Create a global conversation node that checks for errors after every step:
174240

175241
**Enable Global Node**: Toggle this on to make the node available from any point in the conversation
176242

177-
**Prompt**:
243+
**Condition**:
244+
```txt
245+
Customer confused or error detected
246+
```
247+
248+
**First Message**:
178249
```txt
179250
I apologize for any confusion. Let me transfer you to one of our human staff members who can better assist you. Please hold for just a moment.
180251
```
181252

253+
**Prompt**:
254+
```txt
255+
You are handling an error or confused customer situation.
256+
257+
Be apologetic and professional. Prepare them for transfer to human staff.
258+
Keep the message brief and reassuring.
259+
```
260+
182261
This global node will activate whenever there's an error or the customer becomes frustrated, regardless of where they are in the workflow.
183262
</Step>
184263

185264
<Step title="Add Availability Checking Flow">
186265
For the schedule appointment flow, add these nodes:
187266

188267
**Service Selection Node** (Conversation):
189-
- **Prompt**: `What type of service would you like to book? Also, do you have a preferred date and time?`
190-
- **Extract Variables**: `service_type`, `preferred_date`, `preferred_time`
268+
269+
**Condition**:
270+
```txt
271+
Service type mentioned or requested
272+
```
273+
274+
**First Message**:
275+
```txt
276+
Perfect! And when would you prefer to come in? What date and time work best for you?
277+
```
278+
279+
**Prompt**:
280+
```txt
281+
You are collecting appointment preferences for scheduling.
282+
283+
Listen for specific dates, times, or general preferences like "morning" or "next week".
284+
Be flexible and offer to check availability. Keep responses under 25 words.
285+
```
286+
287+
**Extract Variables**:
288+
- Variable: `service_type`
289+
- Type: `String`
290+
- Description: `Type of service requested`
291+
<br />
292+
- Variable: `preferred_date`
293+
- Type: `String`
294+
- Description: `Customer's preferred date`
295+
<br />
296+
- Variable: `preferred_time`
297+
- Type: `String`
298+
- Description: `Customer's preferred time`
191299

192300
**Availability Check Tool Node**:
193-
- **Select Tool**: Choose "Check Availability" from the pre-defined calendar tools
301+
302+
**Condition**:
303+
```txt
304+
Preferences collected
305+
```
306+
307+
**Select Tool**: Choose "Check Availability" from the pre-defined calendar tools
194308
- This will automatically check available slots based on the extracted preferences
195309

196310
**Availability Results Node** (Conversation):
197-
- **Prompt**: `Based on your preferences, here are the available time slots. Which one works best for you?`
198-
- Use conditional logic to offer alternatives if preferred time unavailable
311+
312+
**Condition**:
313+
```txt
314+
Availability checked
315+
```
316+
317+
**First Message**:
318+
```txt
319+
Based on your preferences, here are the available time slots. Which one works best for you?
320+
```
321+
322+
**Prompt**:
323+
```txt
324+
You are presenting available appointment times to the customer.
325+
326+
Present 2-3 options clearly with dates and times.
327+
If their preferred time isn't available, offer the closest alternatives.
328+
Be helpful and accommodating. Keep responses under 35 words.
329+
```
199330
</Step>
200331

201332
<Step title="Add Confirmation and Booking Flow">
202333
**Booking Confirmation Node** (Conversation):
203-
- **Prompt**: `Perfect! Let me confirm your appointment details: [service] on [date] at [time]. Is this correct?`
204-
- **Extract Variables**: `confirmation_status`
334+
335+
**Condition**:
336+
```txt
337+
Time slot selected
338+
```
339+
340+
**First Message**:
341+
```txt
342+
Perfect! Let me confirm your appointment details: [service] on [date] at [time]. Is this correct?
343+
```
344+
345+
**Prompt**:
346+
```txt
347+
You are confirming appointment details before booking.
348+
349+
Read back the service type, date, and time clearly.
350+
Wait for their confirmation before proceeding.
351+
Be thorough but concise. Keep responses under 30 words.
352+
```
353+
354+
**Extract Variables**:
355+
- Variable: `confirmation_status`
356+
- Type: `String`
357+
- Description: `Whether customer confirms the appointment details`
205358

206359
**Create Appointment Tool Node**:
207-
- **Select Tool**: Choose "Schedule Event" from the pre-defined calendar tools
360+
361+
**Condition**:
362+
```txt
363+
Appointment details confirmed
364+
```
365+
366+
**Select Tool**: Choose "Schedule Event" from the pre-defined calendar tools
208367
- This will book the appointment in your calendar system
209368

210369
**Send Confirmation Node** (Tool):
211-
- **Select Tool**: Choose your pre-configured SMS/email confirmation tool
370+
371+
**Condition**:
372+
```txt
373+
Appointment created successfully
374+
```
375+
376+
**Select Tool**: Choose your pre-configured SMS/email confirmation tool
212377

213378
**Completion Node** (Conversation):
214-
- **Prompt**: `Great! Your appointment is confirmed. You'll receive a confirmation message shortly. Is there anything else I can help you with today?`
379+
380+
**Condition**:
381+
```txt
382+
Confirmation sent
383+
```
384+
385+
**First Message**:
386+
```txt
387+
Great! Your appointment is confirmed. You'll receive a confirmation message shortly. Is there anything else I can help you with today?
388+
```
389+
390+
**Prompt**:
391+
```txt
392+
You are wrapping up a successful appointment booking.
393+
394+
Be friendly and offer additional assistance.
395+
If they say no, prepare to end the call politely.
396+
Keep responses under 25 words.
397+
```
215398
</Step>
216399

217400
<Step title="Add Transfer and Hangup Options">
218401
**Transfer to Human Node**:
219-
- **Node Type**: `Transfer Call`
220-
- **Phone to transfer to**: `+1-555-BARBER-1` (your barbershop number)
402+
403+
**Condition**:
404+
```txt
405+
Customer requests human assistance
406+
```
407+
408+
**Node Type**: `Transfer Call`
409+
**Phone to transfer to**: `+1-555-BARBER-1` (your barbershop number)
221410

222411
**End Call Node**:
223-
- **Node Type**: `End Call`
224-
- **First Message**: `Thank you for calling Tony's Barbershop. Have a great day!`
412+
413+
**Condition**:
414+
```txt
415+
Customer satisfied and no further assistance needed
416+
```
417+
418+
**Node Type**: `End Call`
419+
**First Message**: `Thank you for calling Tony's Barbershop. Have a great day!`
225420
- Use when customer is satisfied and no further assistance needed
226421
</Step>
227422
</Steps>

0 commit comments

Comments
 (0)