# Quick start: inbound agent In about 15 minutes you build a working inbound agent: it greets the caller, asks what they need, looks up an order over HTTP, reads the status back and transfers to a person on request. The finished example is the scenario **Guide demo: order status** in the demo account. The same flow, with design notes, is in Recipe: order status line. ![The finished demo scenario after auto-layout](https://docs.aiva.apifonica.com/_astro/8568514cbe76a6a60467fc679ee4f409.Cr1ZHBgc_tjAlt.webp) **Before you start.** You need a console user who may edit scenarios and agents (for example the account\_admin role) and one free number. Test calls are real calls: dial only your own phone. ## Step 1. Create the scenario 1. Open **Build → Scenarios** and click **+ New scenario**. The builder opens with four bricks already on the canvas: **Start scenario**, **Outbound call**, **Inbound call** and **End scenario**. 2. Click the name button at the top left (it says **New scenario**). In the menu that opens, edit the name field at the top, type `Guide demo: order status` and confirm with the check mark. 3. Click **Save draft** now and then as you work. The first save gives the scenario its own address. ![A new scenario: Start, Outbound call, Inbound call and End](https://docs.aiva.apifonica.com/_astro/fda85d41e68881de179449dba538970d.C_732r7p_aLRyL.webp) ## Step 2. Add a greeting 1. Drag **Text-to-speech** from the palette on the left onto the canvas. 2. Connect it: drag from the dot at the right of **Inbound call → Success** to the header of the new brick. A line appears. 3. Click the brick. Click the pencil next to its title and rename it `Greeting`. 4. Type the message, for example: *Hello! You’ve reached the Demo Shop order line. I can check your order status or connect you to a colleague.* Click ▶ to hear it, then **Save**. ![The Greeting brick with its text-to-speech message](https://docs.aiva.apifonica.com/_astro/ffbb7af5e27df167b4c8694a3335a436.BHVFXknn_Z113FGG.webp) ## Step 3. Ask what the caller needs 1. Drag a **Question** brick onto the canvas, connect **Greeting → Complete** to it and rename it `Choose topic`. 2. In **Question message**, type *Would you like to check the status of an order, or speak to a colleague?* 3. Under **Answers**, keep **Speech recognition** and **Intents**. Rename the first answer `Order status` and type several ways people say it, pressing Enter after each: *check my order*, *where is my parcel*, *order status*, *has my delivery been shipped*. 4. Click **Add answer**, name it `Operator` and add *speak to a person*, *connect me to an operator*, *a colleague please*, *talk to someone*. 5. Click **Open test cases**, type an answer a caller might give in **Assumed answer**, and click **Run tests**. The result shows which output the answer would take and the intent scores. If a test misses, add more phrases and run it again. ![Testing which answer a phrase matches](https://docs.aiva.apifonica.com/_astro/14a1e415499f509f443652e72a33de13.DJm7gjJC_Z2c5azD.webp) Each answer becomes an output on the brick, next to three fallbacks: **Invalid** (no answer matched), **Empty** (silence) and **Incomplete** (for example, the caller hung up). ## Step 4. Look up the order 1. Drag an **HTTP request** brick, connect **Choose topic → Order status** to it and rename it `Get order status`. 2. Set **Target URL** to your order API. The demo uses a public echo service: `https://httpbin.org/anything?status=shipped`. Set **Method** to **GET**. 3. Under **Response data mapping**, choose **Set new variable** and type `{{order_status}}`. Choose **Body**, set **Path definition** to `$.args.status` and **Value if the path is not found** to `unknown`. 4. Click **Open test cases → Run tests**. You see the request as curl, the HTTP status, the response and the parsed variables, here `{"order_status": "shipped"}`. Click **Save**. ![HTTP request test: 200 OK and the parsed variable](https://docs.aiva.apifonica.com/_astro/3a9f76da11efc595154c268a43427bbb.DGEfP5fu_1Uq12t.webp) ## Step 5. Read the status back 1. Add a **Text-to-speech** brick after **Get order status → Success** and rename it `Tell order status`. 2. Type *Your order status is {{order\_status}}. Thank you for calling, goodbye!* The variable is highlighted when the name is valid. ![A variable inside a text-to-speech message](https://docs.aiva.apifonica.com/_astro/83a3c6e3fb3c2cbb10338d326af88901.CcLxXIo3_2ekOrD.webp) ## Step 6. Transfer to a person 1. Add a **Call transfer** brick and rename it `Transfer to operator`. Connect both **Choose topic → Operator** and **Get order status → Error** to it, so callers also reach a person when the lookup fails. 2. Set **Transfer destination** to your operators’ number or SIP address. The demo uses the fictional `+12025550100`. 3. Turn on **Audio for the client** and type *Please hold while I connect you to an operator.* Click **Save**. ![Call transfer settings](https://docs.aiva.apifonica.com/_astro/5a39c12ecf0775fe7a397651ac88f84d.Cz1vtp1M_2isVjC.webp) ## Step 7. Handle everything else 1. Add a **Text-to-speech** brick named `Reprompt` with *Sorry, I didn’t catch that. You can say order status, or ask for an operator.* Connect **Choose topic → Invalid** and **Empty** to it, and its **Complete** output back to **Choose topic**. The caller now gets a second chance. 2. After **Tell order status → Complete**, add a **Goal** brick tagged **Qualified**, then a **Business Metric** brick with key `order_status` and value `{{order_status}}`. Both show up in call results. 3. Every output must lead somewhere. With **Smart connections** on (the default), drag an unused output and drop it on an empty part of the canvas: it connects to **End scenario** and shows a small **End** tag. ## Step 8. Save and publish 1. Click **Save draft**, then **Publish**. Publishing checks the scenario first: a message such as *you have 11 errors in your scenario* means some outputs are still unconnected or some bricks are not configured. Bricks with problems carry a red **Error** badge. 2. When the check passes you see *Scenario published*. The scenario is now version v1 and can run on an agent. 3. To try it yourself, click **Test call**. It places a real call through the platform, so call only your own phone. ## Step 9. Put it on a number 1. On **Scenarios**, open the **⋯** menu of the scenario and choose **Create agent** (or use **Agents → New agent**). 2. Pick a free **Number**, set the **Lines** (simultaneous calls) and check the name and calling hours, then click the green button at the bottom to create the agent. 3. Inbound calls to that number now run the scenario. ![Creating an agent from the scenario](https://docs.aiva.apifonica.com/_astro/dab09d027098b8a91d735a9932c3f40a.DjarTvY8_TEqVO.webp) An agent needs a number that no other agent uses. If the number list shows no free number, ask your workspace administrator for one: see [Troubleshooting](https://docs.aiva.apifonica.com/guides/troubleshooting/). ## Next To call people instead of waiting for them, continue with Quick start: outbound calls.