Order by Phone - Demo CFD Project
Introduction
Combine CFD components to enable easy implementation of a telephone ordering system that can be integrated with a 3CX API compatible CRM. This guide showcases an example project available via the CFD Demo Projects GitHub page.
This usage scenario describes a customer:
- Calling an ordering line and is presented with a personalized greeting based on their caller number linked to Salesforce.
- Is authenticated via PIN-based on their Salesforce Contact ID.
- Gets directed to the ordering process.
Prerequisites
This example application needs these prerequisites:
- 3CX PRO Edition PBX v16 Update 4 or later - Pro.
- 3CX Call Flow Designer 16.4.26 or later.
- Enabled 3CX PBX integration with Salesforce. Follow this guide to set this up.
- A MySQL Server to be used for storing customer, item and order information. Download this SQL script to create the database and all the tables required.
- An Amazon Web Services account to use Amazon Polly for Text to Speech. Check this guide on how to configure it.
Main
This is the entry point of the application. When a call is received, the welcome message is played, and then the caller’s number is checked - if it belongs to a Salesforce contact using the “Contact Lookup” component.
If the contact is found, a menu is offered to the user, so they can select to:
- Speak to an operator, i.e. transfer the call to an operator.
- Start ordering by phone, i.e. authenticate the user via the “Authenticate Contact” component, before calling the “Order Multiple Items” component to enable item orders.
- Check order status, i.e. call the “Check Order Status” component.
If a contact is not found a suitable prompt is played before transferring the call to an operator.
Contact Look-up
The “CRM Lookup” component is used to get the contact details in Salesforce, provided that Salesforce integration is already configured in 3CX. It then returns the contact details in variables, i.e. ID, First Name, Last Name, Email.
Authenticate Contact
Using the “Authentication” component in combination with a “Database Access” component enables validating the PIN entered by the caller against the database.
The database credentials need to be configured in the CFD project. To do this:
- Go to the “Project Explorer” and select the project node, i.e. the first node of the tree.
- Go to the “Properties” window and click the button on the right of the “Variables” item.
- Change the values for the database server, port, database name, username and password.
When the entered PIN is valid, a success prompt is played and the component returns. Otherwise,a menu is presented to the user, so they can choose to:
- Contact an operator - transfer the call to an operator.
- Retry - enter the PIN again.
- Cancel - end the call.
Check Order Status
Using a “Loop” component enables checking the order reference number, retrying up to 3 times. Inside the loop:
- A “User Input” component asks the caller for the number.
- A “Database Access” component checks this reference number against the database and:
- if found, the order status is played back to the user and the call ends.
- if not found, the try number is incremented, and the loop condition is checked again for another iteration.
Order Multiple Items
Executed when the user starts ordering, to:
- Create the order in the database and get back the “Order ID”.
- A “Loop” component iterates through the item ordering procedure steps:
- Initially, the “Order Single Item” component is called to ask for an Item ID and select the quantity. This component exposes the result in output properties.
- Next, it checks the output properties of the previous component to determine if there is an item selected or not. When there is an item selected, it is added to the database, the item counter is incremented, and the item price multiplied by the quantity is added up to the total amount of the order.
- Finally, the post item menu offers the user to:
- Cancel the order - the order status is updated in the database.
- Add another item - the loop does another iteration.
- Complete the order:
- If there are items in the order, the status in the database is set to ready. If the contact has an email address, retrieved from the CRM during the “Contact Lookup” component, the order details are sent to the user via email using the “Send Order By Mail” component.
- If there are no items in the order, the status in the database is set to canceled.
Order Single Item
This process implements these steps:
- Requests the 6-digit ID of the item to buy with a “User Input” component.
- The entered item ID is checked against the database, and the item details are retrieved (item description, price, available stock). If the database check result is:
- No record found - a message is played indicating that the item is invalid, and the component ends.
- A record - if the item stock quantity is:
- Zero - the caller can choose to get a notification when the item is available via the “Item Add Notification” component.
- More than zero - the item details are played, and the caller can select the order quantity using the “Item Change Quantity” component.
Item Add Notification
Offers a simple menu so the user can choose to be notified when the item is available. If the user decides to be notified, a record is inserted into the database using a “Database Access” component.
Item Change Quantity
Asks for the item quantity using a “Loop” component, retrying as many times as needed until a valid quantity is entered. In the loop:
- A “User Input” component asks for the quantity of items to buy.
- When the user enters a quantity, the value is checked against the available stock, and if:
- Less than or equal to the available stock - return the selected quantity in an output property, using a zero value to cancel the item.
- Greater than the available stock - play a message indicating that stock quantity unavailability, and start another loop iteration.
Send Order By Mail
Uses a “Loop” component to iterate via the database through all the items in this order to:
- Add the corresponding item to a variable that stores the HTML for the mail body.
- Retrieve each order item details from the database using a “Database Access” component.
After iterating through all the order items, the order details are sent to the customer via email, and a relevant message is played back to the caller.
See Also
- Learn more about CFD components.
- Accessing a database from a CFD voice app.
- Sending emails from a CFD voice app.
- Routing Calls Based on the Time of Day.
- Using the Authentication Component to Validate Customers.
- Using the Credit Card Component.
- Text to Speech with the 3CX Call Flow Designer.
- Using the Loop component to navigate upwards
- Registering and making callbacks
- Using the survey component
- Using the CRM Lookup component
- See how to integrate your PBX with a CRM via the 3CX API.
Last Updated
This document was last updated on 29th April 2021
https://www.3cx.com/docs/cfd-order-by-phone-demo/