Skip to main content
View on YouTube to comment and like!

Syntax Video

Hacking Pizza Ordering For Fun And Profit

Chapter 1 0:00

The plan

I was doing my weekly pizza order a couple days ago and I thought in the age of AI, all of the infrastructure that we have, all of the skills that we have as developers, computer hacking skills, why are we still ordering pizza manually like a sucker? I thought it would be a fun idea to order pizza with code. So, I challenged two of my friends to see who of us can order pizza by simply writing code.

I'm excited for this. So, what are the what are the rules? All right. One, you may order pizza from any restaurant. You may pay online or you may pay in cash, but it must be delivered to your house. Okay. The pizza must have at least three toppings and you may not order a pre-built menu item, meaning that you can't find the ID for a Canadian pizza and simply just order that. You must explicitly build it yourself. A large pizza, three toppings.

You may not use any existing libraries to do this. You might not use like an SDK for Uber Eats um or somebody that has already reverse engineered. You must do it yourself. You may not hook up an existing MCP server to chat GBT cuz quite honestly I I think you might be able to do this without writing any code.

Yeah, there's probably like a Domino's MCP or something. I haven't looked, but yeah, [laughter] that what a world. Yeah, you may use any medium or any interface possible. In fact, CJ, I want you to reverse engineer the APIs. Great. That's my wheelhouse. [music] Scott, I want you to orchestrate a browser in some way. Maybe maybe creating an agent. Maybe doing something with headless puppeteer.

I love it. And for that, Wes, you're going to have to use voice. Uh, I want to see some AI voice. I want you to talk to the pizza guy on the phone. You can't say a [laughter] word. There's no time limit on this. I want you guys to be creative as possible, but we'll meet back in a couple days to see who actually got a pizza in [music] their hands.

Nice. Sounds good. Got it. Let's go. All right, let's get into it. It is currently 3:00 p.m. my time. My hope is that I can finish this up within an hour or two so the pizza can be delivered by dinner time. Uh, and my plan is to order from a place called Sexy Pizza. [music] They're a local Denver pizza restaurant.

Chapter 2 2:02

Ordering A Pizza With Code

They have fantastic branding and a fantastic website. Now, my goal here is to reverse engineer how this site works. So, what you can do is open up the dev tools and then head over to the network tab. We're going to keep an eye on absolutely everything that happens as we navigate around the site and it's going to show us what endpoints they're potentially [music] hitting. Uh, right now I have it filtered to XHR, which is XML HTTP request. And so, that'll show us what requests JavaScript is making.

[music] And ideally we can see the requests that actually happen to get the menu and stuff like that. So let's go to order online. Okay. Immediately I am seeing some GraphQL endpoints. This is a decent sign because uh if you can figure out the GraphQL schema, it's trivial to just call their API directly with a GraphQL library. Uh so that's great. We should see some GraphQL endpoints.

And then I'm going to do a filter of these requests because I basically want to find the response that had the word Jefferson Park or Pearl Street inside of there to see if there's an endpoint I can hit to get those delivery locations. This might be a serverside render that includes the data inside of it. Yeah, it is. See, this is a full-on HTML page, but it has an embedded JSON object and inside of there is a list of locations. So to start I am actually going to [music] copy this as fetch. So in the dev tools if we right click the call that was made I can do copy as fetch. That's going to give me an actual JavaScript fetch command that's against this endpoint. Um there was nothing in the request itself but we should get back the HTML page and then maybe we can extract out that JSON and then further use that to find the right delivery location. So that's the plan here. Let's start writing some code. Uh, I have this blank directory here and I'm just going to set this up as a TypeScript project and use Node.js to

directly run those TypeScript files. And basically, we're just going to be running this directly from the command line. So, we'll run it from the command line. It'll hit the endpoints, make all the requests it needs, and hopefully order us a pizza. All right. So, for my pizza ordering, I'm going to be creating a voice agent. I want I want to create something that will talk back and forth with an LLM um, literally over the phone. So no duplicating requests or anything like that. Like literally just call the pizza place and order a pizza.

So I did a little bit of research into like what can I use for this? And initially I thought like let's use 11 Labs to simulate [music] a voice and then pass that back and forth to an LLM and then maybe make an agent. But turns out 11 Labs has an entire agents platform that is built exactly for this.

And and quite honestly, I I got a little bit bummed looking at the documentation because they have an MCP server. I could literally just hook this up to an MCP server and probably be done in like 3 minutes, [music] which is not very fun at all. So, what my thought is here is I'm going to use the 11 Labs agent platform to do a couple more things as well as build my own interface for it because you can you can literally use the 11 Labs UI for all of this as well.

So, I kind of want to uh create a database of pizza prices around town. So, I want to call several pizza places and try to extract that information out of them in voice and then save it to a database somehow. Um, I want to ask them what their favorite topping is and maybe order that. I want to display the conversations had back and forth. And then finally, like once I'm happy with that, then I'll actually go ahead and and order the pizza in there. So, I've created a barebones V TypeScript application. And what I'm going to do now is try to get the 11 Labs voice thing working. So, they have a React API, React package that will allow you to talk back and forth with an agent.

Um, and I want to use that to test it out, create the agent, work on the prompt a little bit, and then once we're happy with that, we'll go ahead and and try to display all the conversations that we have. I've been tasked with some kind of aentic workflow. I think I'm ultimately going to be using MCP for this rather than like doing um Mastra workflow or something just because I think I can do it with like a playright not playright MCP cuz that would be too easy, right? It would be so easy to just say, "Hey, Playright MCP, click on this, click on that." I think I want to do it a little bit more fun. So, I'm going to attempt to make an MCP server. I recently made an MCP server using a number of things. This is my CSSMCP.

And what it does is allows you to analyze your CSS using um Project Wallace as well as being able to hit MDN to get CSS docs cuz AI is terrible at at CSS. It's a huge frustration. And it's one of the reasons why working in AI sucks. It starts to add in all this god-awful CSS or make you use some kind of DSL like Tailwind or something. So, I made this recently and it kind of unlocked some things for me in terms of building MCP servers. Now, I'm not exactly an expert at this, so it might be tough for me and I'm not a Playright expert either, but I have used MCP to build an MCP server. I'm going to keep this off screen here so that way I can refer to it as I go, but it's going to be a challenge. I am going to order a pizza from Jets. Jets has good Detroit style pizza. And what I want to do is kind of dive in a little bit to this

website and see what's going on. Now, I think CJ was the one who's going to be reverse engineering. So, I I'm not going to go to the network tab. That's something I'm not going to do, which is tough. All of this is working. I think the next thing I want to do is see if we can actually just get the GraphQL schema because if we have the GraphQL schema, we can actually just get type completion when we're querying the endpoint.

[music] So instead of having to inspect the traffic for this, we'd have the schema and we would know exactly what fields are available for the restaurants endpoint, we' we'd know every single entity that's available. So, I'm going to do some digging and see if I can actually find the schema or better yet even see if I can make a schema request against this endpoint. All right, so we're we're 1 hour in right now and we have a application that looks like crap, but is able to make calls and display the conversation transcripts both in real time and it's just finishing up here the past tense of a transcript. So, I think what I'm going to do is pause for a sec and just spend a little bit of time finessing the UI to make it look a little bit nicer [music] and then we'll start to get into how do we collect information and how do we start finessing the agent so it sounds a little bit nicer. Okay, so after several

long hours of infuriating back and forth with [music] an MCP server that occasionally works and occasionally doesn't work and has to deal with extremely bad [music] HTML, like very very bad HTML. In fact, most of my time working on this thing was not trying to get the MCP server to be nice. there.

There's even some fun stuff in here which I'll show you, but it was simply just getting the right [music] inputs, the right DOM elements. Sometimes things were divs that you were supposed to click on that didn't even have a roll of button or anything. Sometimes it was buttons, sometimes it was links, sometimes it was links that looked like buttons. And the classes were just pure vomit of who knows what. And so after a lot of concessions and a lot of back and forth, I think I'm ready to give this a try.

We have a major issue. I am logged in, but there is no way to add a payment method unless you actually check out with the restaurant. So I guess I have to figure out how how they're doing payment info. I mean, technically the source is available.

This is going to be some more in-depth reverse engineering then because we might have to actually I mean we might have to actually look at the React code that they've written that creates the payment info and then use that. I'm going to look into this for like 10 minutes. If it doesn't work, we might have to just use a different pizza restaurant.

All right, we have a bit of an issue and that is with hooking up external calls. So, in order to place outbound calls instead of just uh over WebRTC connections, we have to hook it up to Twilio. And I have a Twilio account. I bought a phone number to actually use it. It has a local phone number. And I was looking at the docs and you can't listen in on a conversation that is happening between yourself or between like the agent and the actual phone number. you can only get access to that data after the fact via the audio and the transcriptions.

[music] So, meaning that I'll just have to set this thing wild. I thought about like piping it through using like loop back and piping the audio into my like FaceTime, but it's too complicated, especially because there's no tracks between the person talking and and the agent itself. So, what we're going to do now is hook this up to Twilio so we can actually send out phone calls and see what the agent responses look like on an actual phone call rather than the WebRTC that we've been using. So, what this should hopefully do is it did in my other display. It pops open our browser window and this is using Playright, not Playright MCP though. It's just using straight up playright. And it says, "Do I want to proceed?" Yeah, I think I want to proceed. Let's get me a pizza over here. It finds the store. It goes through all of this annoying popups

and clicks and gets through. It selects ASAP. This is all looking pretty good. I'm back. Last time I couldn't figure out how to add payment via the API, but I had a stroke of genius when [laughter] I woke up this morning. And my thought is I actually have the ability to create temporary credit cards and I can also set limits on those credit cards. So what I'm going to do is I'm going to place a fake order in the UI with a one of those temporary credit cards that has a spending limit. So, that should not go through, but it'll save that [music] payment to my account and then I can use that payment ID from my codes. That's the plan. All right.

So, we're going to make a new component that should take in the phone number to call and then that should use the serverside 11 Labs API to actually make the outbound call. And then we will simply be able to see it happening in our recent conversations, but we will not be able to know what is going on until the person on the other end hangs up. So, luckily, I can call myself and we can test it until we're we're confident in actually calling a pizza place. [music] Now, at this point, it does ask me, what do I want to order? I hit control O and see all of the different options on the entire menu.

I'd like a build your own pizza. And I'm going to get it with ham, pepperoni, and pineapple for fun. Okay. And let's see what Claude does. And it's not Claude. What it's doing here is it is hitting the MCP and it's going to use another tool, select order type, which is build your own. And then it's going to use the customized pizza. Looks like I didn't give it what size. We're going to say medium.

And it should use the customize pizza tool. Look at that. So, it is running actual JavaScript. So, a lot of people think like this is all just AI, but behind the scenes it is taking JavaScript parameters in here. I don't know what to do. I I think there's probably one more request that happens cuz the status says requires capture. So, my guess is [music] the payment succeeded. Now, we need to link that payment to the order itself, but I don't know what request it needs to be made. So, I think what I'm going to do is make a real order and capture that traffic and then do this again tomorrow, I guess. [laughter] Um, but at that point, I'll know what request to make.

Man, I'm so close. Okay, so I'm I'm pretty happy with with that of the like data collection. I'm obviously not going to like like spin up a thousand instances of it and and waste everybody's time. So, I think the next step is like like really making sure that the prompt cuz like when it when it's time to order, I have nothing in my prompt about delivery. I have nothing in the prompt about my address. I have nothing in the prompt about any of that.

So, I think I really need to get the prompt dialed in and then we'll try to to order the pizza. Okay, let's uh proceed to checkout. Let's go. Let's go, please. This is the part that has been killing me in this thing. So, let's go.

So, enter this address. Yes, let's do it. It's using the enter delivery address. That worked. Yes. Now, it should continue as guest. Let's hope it gets hung up here all the time. For some reason, it does not like this continue as guest button. Uh, would you like to use this information? Yes, I would. Now, what I'm going to be doing offcreen just here is getting to this exact point with my real address. I'll get to this here.

I will run this same command and you'll see it actually work. Okay, so everything's in place. Let's give it a try. Place order failed. This is what I was worried about. Okay, so there actually was no transaction. So, it didn't even try to charge my credit card. We're just going to try it again, but this time we will try to create a new payment method. Um, okay.

Confirming order. Confirmed the order. Place order failed. Let's see. Okay. So, I got a charge on my credit card. It's possible again that this order ID didn't link up. So, let me look at the responses again. All I'm going to do is only run the function that places the paid order, but the payment ID is going to be the confirmed order ID. Let's just try this. We have to do it really quick because [laughter] um it charged my credit card. Now it's just a matter of linking that charge from the credit card to the actual placed order. No, that's still failing. I need to find the right payment ID.

Maybe it's this external reference ID. Okay, please work. Yes. Yes. I think that's it. I think that's it. Now we just have to see if I get an email. Yes. Yes. Online order receipt. The pizza's on its way. And we used code to get it. Awesome.

Hello. How's it going? Good. How are you? Good. Cool. Appreciate you. Thank you. Have a great night. You, too.

I think we should do it. Are you guys ready? I'm ready. I'm going to switch out my name, address, all that. See if we can get it. [sighs] I'm nervous. I'm nervous. I'm so nervous. Here we go. Call now. Initiated.

In progress. They've picked up. All right. Are you guys ready? Hi there. I'm ready to order a pizza for deliver. Ah, hello. Great. I would like to order a large pizza for delivery. Dropping another pizza.

Yes, please. I would like pepperoni, mushrooms, and onions. Your phone number, please. Blur this out. It's area code 4168888 and the address blur.

Mhm. It's one one one [laughter] and the pizza pepperoni mushroom and onion. Anything else? Nope. No extras are needed. So what is the total including delivery and the estimated delivery time?

Will it be cash or debit? Cash on delivery if that works for you. Sure. Just give me one moment for the total. Okay. Oh man, this is it's working. Um, [laughter] what? Sorry. No problem at all. Still there.

What was that? Os, are you still there? Oh, man. Okay, I'm still here. Just let me know when you're ready. Okay. You know what? I think there is a settings in the agent to it's called skip a turn and it will just add a bunch of pauses cuz it's it's being rude. He's he's trying to figure out the price of the pizza and it's being rude.

All right. Your total comes out to perfect my friend. Ah, sorry about that. My total comes out to 18 $1806. $186. Whoa. $18,0006. [laughter] Is that right? Are you sure this is a real call?

$186. [laughter] Okay, that sounds more like it. And what is the estimated? Uh, just about 45 minutes. And what is the estimated delivery time? 45 minutes. Fantastic. Thanks so much.

Perfect. Thanks for the pizza. Goodbye. That could have gone wrong, man. There was a lot there. So, I I probably had to cut it out, but it had a big problem saying the street name. Um, it started spelling it out, but it didn't know if it was saying a B or a D.

Uh, but luckily it it got it. Says it's going to be here in 45 minutes. So, now we wait.

Oh, that's okay. Awesome. Thank you. There you go. Get the change. Have a great day. You, too. Watch out, buddy.

Oh, baby.

Taste aic.

It's hard to eat on camera. Wow. Um, we did it. We built an agent to call a pizza place and order us up a pie. And it came. Okay. So, we have reached the [music] point we were before. And now it's time to Yes. Place real order.

Let's go. Let's do it. Let's do it. [music] We're about to have a $30 pizza sent to my house. Order submitted. [music] Nice. Look at that. Enter payment. Yes, real order. Perfect. Your pizza order has been successfully placed with a pizza emoji. I just ordered a pizza with pizza MCP.

Here's that pizza for you. Got it. And did you need any change back today? No. All right. You have a good one. Appreciate it. Thank you so much.

Chapter 3 23:11

Debrief

All right, we're all fed and you have all seen what we each have done, but Scott, CJ, and I have no idea how or or what we did to actually get the pizza to our house. So, let us know down in the comments who did the best job, which one you appreciated most, what was your favorite point, and we're going to now get into it and and explain to each other what we've done and all the problems that we hit. CJ, you go first.

Chapter 4 23:34

How CJ Did It

I'm so curious to see what happened. Let's do it. And [music] I was the reverse engineer. Uh, there's going to be people in the comments saying that I wasn't a reverse engineer, but we'll see. We'll see. He's a hacker. I'm I'm a hacker. Hacker, man. So, the site that I decided to hack is Sexy Pizza. So, this is a a Denver based pizza restaurant. And I originally picked them because they used to have this really old outdated ordering form. Like, it looked like it was built with like ASP.NET or something like that. And so, my thought was like like let's modernize it. Let's make it easy to order from. But it turns out they're just using this thing called Toast Tab. A lot of restaurants are using it these days. It's very similar to like what what companies are using that are like Door Dash. It's like or you can upload your menu. So, it was a little bit trickier than than I thought to to figure it all out.

Yeah. Cuz I'm sure with something like Toast Tab, [music] it's way more guarded and protected against automation or hacking. Yes. You I mean, you would think. And so, like you're you're now you're having to you're dealing with like authorization. You got to make sure that all the requests you're sending have the correct session ID and everything's validated in the right way and there's like particular endpoints you have to hit in the right order. [music] So, yes, absolutely. And that was that was my process. So basically in order to make this all work I opened up the dev tools and started just seeing what network traffic was happen as I was visiting visiting the site and it [music] turns out that they just have a GraphQL API.

So it's refreshing now but we should see some endpoints pop up. So basically I needed to figure out these GraphQL endpoints. So as I navigate the page you can see these requests going off all to the same endpoint/graphql. I've never built like a big GraphQL API but I I have a semblance of an idea of how it works. Basically, it's a single [music] endpoint and all of the querying is coming from the client. So, these payloads are JSON payloads that basically request from the client what they want. So, this first request is like for restaurant info. [music] Um, and then there's stuff about like the menu and the loyalty cards. So, basically, I just kind of navigated around the site, saw which network requests were being made, and then replicated it all in Typescript. Uh, so I have just a single TS file here with a lot of functions. So, I've got a get restaurants function, get menus, add to cart, [music] create payment intent, create payment method, confirm order, place order. So, like it's pretty pretty nicely written. [laughter] Yeah, if I don't say so myself. Um, and I didn't use AI to do it.

Beautiful. I got crazy with it, too. It's all type safe. Like, each of these functions actually returns a proper type. Um, and I and I actually like generated all the types. Um, my god, Toast Tab. Hire this guy. [laughter] Um, but yeah, it but it it was fun to figure out, but the hardest part was payment and checking out. As far as I could tell, there was no way to add a payment method to my account that I could then use on an order. They only let you add payment methods with a successful order. So, tried my best to figure out how I was going to get that payment method in there. And what I tried first was a temporary credit card.

[music] I made it so that it had a spending limit so that way it would try to charge it and then not [clears throat] and then it would fail so I could at least see the request. Oh, that's a smart move. Yeah. I So it it came to me in a dream because so [laughter] like I I couldn't get it working and then I woke up the next morning and I was like let's let's try this. So uh that actually gave me the request that could be made. Um and so I have a couple methods like create payment method. I was able to figure out what was the endpoint. And then the tricky part is all of this encryption.

So this this request right here, this is my credit card encoded with some kind of encryption. And I had to just literally copy the request. I I wasted some time trying to figure out how to recreate this encryption that actually creates the payment method and encodes the card info and this card data. That got nowhere. So I ended up just exactly duplicating this request. Um so this creates the credit card. From there, I was home free, except there was one more request that I couldn't see.

So, it charged my card. I could see that that the charge went through, but then the the pizza didn't actually come in. And it turns [music] out that there's one more inpoint that needs to be called, which is uh like confirm order, like place paid order with payment method. My complaint here is that should be happening on their back end. There's no reason the client side should be should be the one to make the request that ties a payment together with an order.

Yeah. It should be like a a web hook, you know. Stripe does that. Actually, Stripe will allow you to confirm like once you create the the charge, you have to then confirm it. And you can either confirm it on the client or on on the server depending on like the what your flow is like. Yeah. Basically, to get it working, I had to actually order a pizza, see what the final request was to tie it together, and then the next day, I replicated it in the command line.

Delicious research. Yeah, exactly. [laughter] Uh, but it was fun. Make sure you keep your receipts, CJ. Yeah, I'm going to I'm going to expense it for sure. Pizzas. [laughter] Um, but it was fun. I've got some like type safe code. It's like you could it's readable code and it's exactly what's happening in the browser as you're clicking around, right? So like get the restaurant, get the menu, create the intent, uh create a payment method, and then update payment intent, which also adds the tip, confirm order, which actually charges the credit card, and then place paid order, which links the credit card charge with this cart to mark it as paid, and then after that, I got an email, pizza showed up. Yeah. So that was mine. I think I want to hear from uh Scott now. How did how did you get this going?

Chapter 5 28:57

How Scott Did It

Oh, man. Okay, so I wrote an MCP server named Pizza MCP. We can call this uh you can at least see it in action [laughter] right here. Pizza MCP right here. Uh view tools. The tools I built. So I I'm not I've built one MCP server before, so I have no idea if my MCP server is any good, but start order, select store, order from store, customize pizza, list available toppings. So these are all the tools I had. And for the most part, when you work with an AI like Claude Code to run some of these tools, I can get a pizza order completed in just like one or two, well, maybe not one or two prompts cuz it kind of goes back and forth with you a little bit. So, use pizza MCP to order pizza. Oh, not Pissa pizza from [laughter] uh I need a I need an area code. uh 90210

from 90210 if they have Jets Pizza and 90210 because that's what I did. I used Jets Pizza which is they have a Detroit style pizza and it's going to go off. It's going to use their storefinder directly. You'll see a playright window open up. Now the one thing this is not doing Yeah. What it's not doing is it's not using dev tools MCP at all and [music] everything is coded in playright to do the operations. So right now okay select the store by entering do you want to yes I guess yes do it um and it's going to search okay no jets near you. So either way it will find the store that's near that zip code. Um what's a good zip code in Denver that's not my zip code. um 80202 [music] 80202 and we'll see if that actually is able to pick it up. But um what it will do is it actually is entering in the inputs and then running through this. And the

thing the biggest problem that I had in this entire process is jets pizza.com [music] has the most dog [ __ ] HTML I've ever seen. Sometimes buttons are buttons. Sometimes they're links. Sometimes they're divs with not [music] even any kind of roles or attributes.

Sometimes the button text is all caps. Sometimes it's all lowercase, even if it's always displayed in all caps. Sometimes the inputs or or anything like that has no rhyme or reason. So then you can see what's cool about this is now it works with Cloud Code's new to-do thing where it's asking what type of pizza. So I'll say uh build your own. It might list the toppings right now. Yeah, you can't proceed to check out because you don't have the toppings. I want medium with pineapple pepperoni and I don't know how to spell anything and cheese. And we'll see if it goes off and does it. But one of the the funniest things I did with this is I built a pizza visualizer because sometimes when you're ordering pizza, you really want to see what it looks like. So, after I get this added to my cart, I'll ask it what it looks like, and we can take a look at uh what our pizza actually looks like.

A a tuy uh terminal UI pizza. More asky than Tui. I will say that. [music] Um, is it going to delivery now? Is it trying to check out? Bro, don't try to check out. You don't even have anything in the cart. Yeah, this [snorts] is the funniest part is sometimes when it like it thinks it's uh completed a step because the one thing I I had trouble with was like timing of things. So I wrote this big old um amount of text here to say uh this presscript to say here is the order in which you need to do things. Um so sometimes it like if it if it gets ahead of itself it like jumps ahead in the the order of things. Um you can see here it may have gotten stuck but I didn't want it to randomly just place an order. I wanted to like So, I have a confirm passphrase where I have to manually paste in a yes place real order. Uh, or else it won't click that final button. Yeah, I don't know why we're getting hung up here. How about this? Show me a pizza with pineapple

sausage. Sausage. My god. I I'm sorry, folks. Pepperoni. We'll see if it will at least do the uh the pizza visualizer cuz that's the funniest part about this whole thing. Okay. So, it showed me my pizza. I have to hit control O to open it. But there we go. That's my pizza. Your pizza.

So, these are all the different symbols for the different toppings. And it's just a just some a little JavaScript to post uh get random topping out of the toppings that are you've selected on your pizza. So, if you have a pizza in your cart and you say, "Show me my pizza," it will use that pizza that's in the cart to generate this image, which is very funny. But for the most part guys, this entire thing is just a bunch of page locator fill-in stuff and then it will prompt me for things. I am using a lot of like arguments. So it's like I I type in my address and stuff into here. Um I'm using a a lot of like please find this obscure [music] HTML tag and then look for something else in [laughter] it. Took forever honestly.

That's that's pretty good. Honestly, I think that's a pretty accurate look at like MCP controlling an existing UI. Like I I think like it's it's pretty amazing that you were able to just like literally puppeteer a website, but also very accurate that it's extremely frustrating and the real world applications are just brittle and it gets confused very easily. And like I would say that's that's kind of where we're at with a lot of this stuff.

[music] Yeah. And I I like I actually do like that you went with writing the playright code because like you technically could have just added the uh Chrome DevTools MCP or the Playright MCP and just like had the AI figure out which buttons to press, but that's less deterministic, right? Like it that would probably fail more fun. Yeah, that's true. But that would fail more often than your code that knows which items to click on and press. So yeah, I love that.

Yeah. So Wes, how did your experiment go? All right. So, I ended up building a voice agent for mine and I used 11 Labs. They have a a voice agent product. Um, and kind of the bummer thing about this initially was like I probably could have done this whole challenge without writing a line of code. Um, because they have a whole MCP server you can hook it up. But I I opted to build out my own and [music] still using the 11 Labs agent and then build out a whole UI. So, creating the the voice agent, there was a se several things that it can do. The first one is you provide like a prompt as to um what it needs to do. And I found that to be probably the hardest part getting AI to actually sound like a human. Um it's good at outputting text, but that text is not necessarily translate to natural flow of language.

Chapter 6 35:09

How Wes Did It

So, um, another part of it is that you have to do data collection because I wanted to collect [music] interesting things like, um, here is an example of one of the calls that I did and I needed to collect the recommended toppings. Um, cuz I was I was trying to ask them, hey, what would you recommend on a pizza? Um, the delivery time and and then the price. So, like you need to like parse out those from the natural language. Um, but getting the AI to just be chill about it was really tricky because it would either be like this is an interview, I am collecting data or it would just be like h whatever like if I didn't collect the data or not or even just like like questions like you want you want pepperoni on that it like in normal languages be like yeah you know but like with an AI it would like have to go back and forth be like why yes thank you for confirming that I would like I am not a I'm not a cop.

[laughter] Um just the most hilarious going back and forth. So the 11 Labs the SDKs they have a both a client side SDK for sending the calls out. Um and they have a whole backend SDK that allow you to connect and and hit their API. So those SDKs were fantastic. They have a whole bunch of UI elements for integrating them into um into a React application as well. But the just the prompting and the data collection I found to be relatively tricky. But what's nice about that is I didn't even need a database for all of this. It's all stored [music] in the 11 Labs API.

Um, so I thought like let's give let's give Scott a call. And the the other problem that I I I hit is that I can chat with the voice agent in real time in the browser, but if you're making an outbound call to someone's phone number, it uses Twilio and you can't monitor that conversation at all. So I had to go in blind and like so I hit I hit make the call to the pizza place and I was just sitting on my hands. Once they hang up, then it's processed and you can actually go and listen to the call and read the transcript. Um, and luckily it worked. But I'm going to give Scott a call now. And Scott, if you put that on speaker phone up to your mic, we can see see how well it works.

Chapter 7 38:12

AI Calls Scott's Hot Pizza

Okay, I'm getting a call. Maybe hang up. We'll try it again. But let me explain. That was probably my hardest problem as well is trying to tell the AI, you are ordering the pizza. And probably three or four times it would get confused and think that it was it was the pizza place. Yeah, that's what it it's like. Oh, I said I'm sorry.

My headphones are connected to my headphones cuz I was talking to you guys and it was like it's okay technology, right? So, you were trying to order a pizza. Okay, so that's funny. Here we go. Here we go. Uh, you are not the pizza shop. And [laughter] I still thought it was the pizza shop. All right, I'll give it a call again. Scott's Hot Pizza. It should be working by now.

Yes, this is the right place. Awesome. I'm craving a large pizza. What toppings do you have? Uh, we have horse meat, we have dino bones, and we have pepperoni. Okay. Haha. Interesting. Let's go with pepperoni, mushrooms, and onions, please.

What's the next piece of information you need from me? See? Well, [laughter] I need your uh I need your your address so that way we can get the pizza to you on time. Uh, what's your name? bleep this out if it The name is West Boss and for the address it's What [laughter] other information do you need?

What other information do you need? I'm going to need uh your birthday and your mother's maiden name. You're funny. How about I just give you the city and postal code for the address? How about you do that? It's Hamilton, Ontario, postal code. And I think you have my phone number, too, right?

I [laughter] do have your phone number. Can I get your credit card? Cuz this is going to be $10 million. $10 million? Well, that's a lot of dough. I was actually planning to pay with cash on delivery. Is that an option? If you got 10 million bones on you, then I suppose so.

Okay, great. So, what's the total price for the pizza, including any delivery [laughter] fees? 10 million plus $14 for delivery. [snorts] All right. And what time can I expect the pizza to arrive? [laughter] As soon as we can get it to you. I hope that's okay. Perfect. All the best things are immediate. I think that's all I need.

Thanks. [laughter] You're welcome. Bye. That's great. Oh, but you see what I mean about like what kind of person says, "What type of information would you like next?" You know, [laughter] I love the voice you chose, by the way. That's great. Oh, man. I went back and forth on the voice so much and I had I actually had some previous voices. I had Tim Cook [music] uh trained on my 11 labs and then I guess they stopped letting you just add any voice um from any audio.

So I I tried to train my own voice but it took too long. So I ended up just using that one. But that was another problem is that I couldn't get it to sound like natural like it needed to sound worse. I needed background noise added to it and I just it was very hard to make it sound human. Um, but now I think here we go. Pizza order prank. See, it knew that Scott was a prank.

Scott's hot pizza. Recommended toppings. Delivery time as soon as we can get it to you. The user states that the pizza will arrive as soon as we can get it. This is the approximate time. Price. The user states the price of the pizza is $10 million. The pizza is a large pizza. Therefore, the price of a pizza with toppings is $10 million. So, it's because it's a large. Yeah. So, like this stuff is both very impressive, especially the fact that you can like hook up like I could take Scott's MCP tools and hook them into this agent and then it would be able to to use those tools as well, but it was so funny trying to go through it. And then and the like React and the API stuff as well was was pretty interesting as well, but not as funny as the the the audio back and forth stuff.

Wes, this is this is incredible. This is amazing. I [laughter] uh I was like just absolutely [music] blown away by your approach here. This is [laughter] all right. That was fun. Let us know down below in the comments what challenge we should do next. Not necessarily just ordering a pizza or anything, but we'll face off and and try to accomplish something in the real world with this stupid technology that we all have.

[laughter]

Quote it with credit and a link. Quoting Syntax