Skip to content

Commit 08bf6ce

Browse files
Merge pull request #243 from twilio-labs/feat/pickup-location-welcome
feat: use pickupLocation in welcome message and AI prompt
2 parents 6382ab7 + f4e945f commit 08bf6ce

5 files changed

Lines changed: 21 additions & 7 deletions

File tree

src/app/(layout-free)/event/[slug]/kiosk/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default async function KioskPage(props: {
3131
return (
3232
<div className="p-4 space-y-8 flex-1">
3333
<p className="text-xl md:text-4xl">
34-
Order your beverage here and pick it up at the Twilio booth.
34+
Order your beverage here and pick it up at {(event?.data as any)?.pickupLocation || "the Twilio booth"}.
3535
</p>
3636
{hasPermissions && (
3737
<OrderForm

src/app/(master-layout)/event/[slug]/page.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,15 @@ function EventPage({ params }: { params: Promise<{ slug: string }> }) {
404404
{touched.pickupLocation && fieldErrors.pickupLocation && (
405405
<p className="text-xs text-red-500">{fieldErrors.pickupLocation}</p>
406406
)}
407+
<p className="text-xs text-gray-400 italic">
408+
{internalEvent.pickupLocation.length >= 3
409+
? (internalEvent.language ?? "en") === "pt-BR"
410+
? `"Bem-vindo ao ${internalEvent.pickupLocation}!"`
411+
: `"Welcome to ${internalEvent.pickupLocation}!"`
412+
: (internalEvent.language ?? "en") === "pt-BR"
413+
? `"Bem-vindo ao Estande da Twilio!"`
414+
: `"Welcome to the Twilio Booth!"`}
415+
</p>
407416
</div>
408417
<div className="space-y-1.5">
409418
<Label htmlFor="language">Language</Label>

src/app/webhooks/messaging/ai-agent.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ Rules:
269269
* Always reply in ${languageName}, regardless of what language the user writes in.
270270
* When suggesting menu items, ALWAYS format them as a markdown list.
271271
* Never fabricate information on tool execution failures. Acknowledge errors without speculation.
272-
* If the users want to learn more about Twilio, point them to the Twilio employees at the booth.
272+
* If the users want to learn more about Twilio, point them to the Twilio employees at ${event.pickupLocation || "the booth"}.
273273
* If they want to reach out to sales, point them to https://www.twilio.com/en-us/help/sales
274274
* UNDER NO CIRCUMSTANCES TALK ABOUT TWILIO COMPETITORS. If asked, say you can't help with that and suggest they ask a Twilion.
275275
* Use the log_feedback tool if the user asks for something you cannot do. This stores their attempted action so we can improve the system.`;

src/app/webhooks/messaging/route.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ async function selectEventForCustomer(
118118

119119
const welcomeMsg = isReturning
120120
? getWelcomeBackMessage(newEvent.selection.mode, newEvent.name, newEvent.welcomeMessage, eventLang(newEvent))
121-
: getWelcomeMessage(newEvent.selection.mode, newEvent.welcomeMessage, newEvent.leadCollection, eventLang(newEvent));
121+
: getWelcomeMessage(newEvent.selection.mode, newEvent.welcomeMessage, newEvent.leadCollection, eventLang(newEvent), newEvent.pickupLocation);
122122
sendMessage(sender, welcomeMsg, undefined, undefined, from);
123123

124124
const country = getCountryFromPhone(sender);
@@ -157,7 +157,7 @@ async function selectEventForCustomer(
157157
const newEvent = matches[0].data as Event;
158158
const welcomeMsg = isReturning
159159
? getWelcomeBackMessage(newEvent.selection.mode, newEvent.name, newEvent.welcomeMessage, eventLang(newEvent))
160-
: getWelcomeMessage(newEvent.selection.mode, newEvent.welcomeMessage, newEvent.leadCollection, eventLang(newEvent));
160+
: getWelcomeMessage(newEvent.selection.mode, newEvent.welcomeMessage, newEvent.leadCollection, eventLang(newEvent), newEvent.pickupLocation);
161161
sendMessage(sender, welcomeMsg, undefined, undefined, from);
162162

163163
const country = getCountryFromPhone(sender);

src/lib/stringTemplates.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,15 @@ export function getWelcomeMessage(
7373
customWelcomeMessage?: string,
7474
leadCollection: LeadCollection = "NONE",
7575
language: Language = "en",
76+
pickupLocation?: string,
7677
) {
77-
const defaultWelcome = language === "pt-BR"
78-
? `Bem-vindo ao Estande da Twilio! Está pronto para um ${modeToBeverage(mode, language)} por nossa conta? 🎉`
79-
: `Welcome to the Twilio Booth! Are you ready for a ${modeToBeverage(mode, language)} on us? 🎉`;
78+
const defaultWelcome = pickupLocation
79+
? language === "pt-BR"
80+
? `Bem-vindo ao ${pickupLocation}! Está pronto para um ${modeToBeverage(mode, language)} por nossa conta? 🎉`
81+
: `Welcome to ${pickupLocation}! Are you ready for a ${modeToBeverage(mode, language)} on us? 🎉`
82+
: language === "pt-BR"
83+
? `Bem-vindo ao Estande da Twilio! Está pronto para um ${modeToBeverage(mode, language)} por nossa conta? 🎉`
84+
: `Welcome to the Twilio Booth! Are you ready for a ${modeToBeverage(mode, language)} on us? 🎉`;
8085

8186
const welcomeMessage = customWelcomeMessage || defaultWelcome;
8287

0 commit comments

Comments
 (0)