|
| 1 | +# Creating Order Status Check Bot |
| 2 | + |
| 3 | +This guide walks you through creating a practical example of implementing order status check functionality in your chatbot. |
| 4 | + |
| 5 | +For a quick start, you can find a pre-configured bot in the [examples folder](../examples/order_status.json). Import it through Settings/Data Management, then train the model via the "Train Models" button in the Intents page. Once done, you can proceed directly to the [testing](#testing) section. |
| 6 | + |
| 7 | +## Configuration |
| 8 | + |
| 9 | +### 1. Create Order Number Entity |
| 10 | + |
| 11 | +1. Go to the Entities section |
| 12 | +2. Create a new entity named "order_number" |
| 13 | + |
| 14 | +### 2. Create the Intent |
| 15 | + |
| 16 | +1. Navigate to the Intents section in the admin interface |
| 17 | +2. Click "Create Intent" |
| 18 | +3. Configure the basic intent information: |
| 19 | + - **Intent Name**: "Check Order Status" |
| 20 | + - **Intent ID**: "check_order_status" |
| 21 | + |
| 22 | +#### Configure Parameters |
| 23 | + |
| 24 | +Add the following parameter: |
| 25 | +- **Name**: "order_number" |
| 26 | +- **Type**: Select your order number entity type |
| 27 | +- **Required**: Yes |
| 28 | +- **Prompt**: "Please provide your order number" |
| 29 | + |
| 30 | +[](screenshots/intent_configuration_1.png) |
| 31 | + |
| 32 | +### 3. Set Up API Integration |
| 33 | + |
| 34 | +We'll use a free dummy order status API for this example: |
| 35 | + |
| 36 | +``` |
| 37 | +https://fake-store-api.mock.beeceptor.com/api/orders/status?order_id=ORD1234 |
| 38 | +``` |
| 39 | + |
| 40 | +Example API Response: |
| 41 | +```json |
| 42 | +{ |
| 43 | + "order_id": 1, |
| 44 | + "user_id": 1, |
| 45 | + "status": "Shipped", |
| 46 | + "total_price": 849.97, |
| 47 | + "items": [ { "product_id": 1, "quantity": 2 }, { "product_id": 3, "quantity": 1 } ] |
| 48 | +} |
| 49 | +``` |
| 50 | + |
| 51 | +Configuration steps: |
| 52 | +1. Enable "Trigger API" |
| 53 | +2. Add the API URL with parameter templating: |
| 54 | + ``` |
| 55 | + https://fake-store-api.mock.beeceptor.com/api/orders/status?order_id={{ parameters['name'] }} |
| 56 | + ``` |
| 57 | +3. Choose method as GET |
| 58 | +4. Leave the headers and JSON payload configurations as default |
| 59 | + |
| 60 | +[](screenshots/intent_configuration_api_trigger.png) |
| 61 | + |
| 62 | +### 4. Configure Response Template |
| 63 | + |
| 64 | +In the response section of the intent, customize the response using the API result: |
| 65 | +``` |
| 66 | +Your order status is {{ result['status'] }} |
| 67 | +``` |
| 68 | + |
| 69 | +## Training |
| 70 | + |
| 71 | +### 1. Add Training Phrases |
| 72 | + |
| 73 | +1. Go to Intents Page and click on the training icon |
| 74 | + [](screenshots/training_icon.png) |
| 75 | + |
| 76 | +2. Add the following example phrases: |
| 77 | + - Tell me order status |
| 78 | + - What's the status of my order ORD123456? |
| 79 | + - Track order ORDER789012 |
| 80 | + - Where is my order ORD123456? |
| 81 | + - Can you check order ORD789012 for me? |
| 82 | + - I want to know about order ORD123456 |
| 83 | + - What is my order status |
| 84 | + |
| 85 | +### 2. Label Entities |
| 86 | + |
| 87 | +1. In each training phrase, highlight the order numbers |
| 88 | +2. Select the "order_number" entity type |
| 89 | +3. Ensure all variations are properly labeled |
| 90 | + |
| 91 | +[](screenshots/training_entity_label.png) |
| 92 | + |
| 93 | +### 3. Train the Model |
| 94 | + |
| 95 | +1. Return to the Intents Page |
| 96 | +2. Click "Train Models" |
| 97 | +3. Wait for training completion |
| 98 | +4. Test the intent with sample queries |
| 99 | + |
| 100 | +## Testing |
| 101 | + |
| 102 | +1. Navigate to the Chat Page |
| 103 | +2. Test with different variations: |
| 104 | + - "What is my order status?" |
| 105 | + - "Track my order ORD123456" |
| 106 | + - "Where is ORDER789012?" |
| 107 | +3. Verify the following: |
| 108 | + - Intent is correctly identified |
| 109 | + - Order number is properly extracted |
| 110 | + - API is triggered with correct parameters |
| 111 | + |
| 112 | +[](screenshots/testing.png) |
| 113 | + |
| 114 | +## Next Steps |
| 115 | +- [Integrate with other channels](03-integrating-with-channels.md) |
0 commit comments