3CX PBX in the Cloud
1 year FREE - no ties!
google cloud platform
3CX
Zero Admin
With the new Dashboard
3CX
Bulletproof Security
With SSL certs and NGINX
3CX
Install on $200 Appliance
Intel MiniPC architecture
3CX
New, Intuitive Windows Client
More themes, more UC
3CX
More CRM Integrations
Scripting Interface to add your own
3CX
Improved Integrated Web Conferencing
iOS and Android apps included
3CX
Run On-Premise or in the Cloud
Google, OVH, Windows & Linux
Fast & easy call management
With the 3CX Web Client

CFD Example: Creating a phone support portal – Part 2 Validation using a web service

Creating a Phone Support Portal with the 3CX Call Flow Designer – Part 2

On this topic

Creating a Phone Support Portal with the 3CX Call Flow Designer – Part 2

Introduction

How to invoke the web service

Analyzing web service response

Conclusion

Introduction

In the previous article of this series Creating a Phone Support Portal with 3CX Call Flow Designer – Part 1, we explained how to create the application callflow, to validate whether a customer has a support contract, and then transfer the call to the appropriate department. We have left the validation using different data sources for subsequent articles.

In this article we will show how to perform the validation using a web service.

How to invoke the web service

The 3CX Call Flow Designer includes the HTTP Requests and Web Services (POST) components out of the box, which both allow invoking web services. The Web Services (POST) component is a simplification of the HTTP Requests component, which sets the HTTP method to POST, and creates the URL concatenating the provided URL and the web service name, so for example if the URL is http://www.example.com and the web service name is “MyWebMethod”, then the HTTP POST request will be sent to http://www.example.com/MyWebMethod.

For the purpose of this article, we’ll use the HTTP Requests component, which is more flexible for modern REST web services which require other HTTP methods than POST.

Open the user component created in the previous article to perform the customer validation (ValidateData), drag an HTTP Requests component from the toolbox and drop it into the design surface. Rename the component to validateDataWS and configure the URL, the request type, the content type and the content data to send. Add headers to the request if needed. In this case, we’ll send the data as “application/x-www-form-urlencoded”, and therefore we’ll use the following expression to create the data to send:

CONCATENATE("ID=",callflow$.CustomerID,"&PIN=",callflow$.CustomerPIN)

The configuration dialog looks like this:

Then we need to set the HTTP request result to the output property ValidationResult. Assuming that the web service returns the value 1 when the validation is successful, and 0 when it’s not, we can use an Assign a Variable component to set the result to the variable callflow$.ValidationResult using the following expression:

EQUAL(validateDataWS.ResponseContent,1)

The resulting diagram will look like this:

Analyzing web service response

In this case we simplified our scenario, and defined that the web service returns a number “1” or “0” depending on the validation result. This is usually not the case, and the response in most common cases is XML or JSON. In that case the response needs to be parsed, and to do that it’s necessary to use a Launch External Script component. Using this component we can execute C# code, and use the XML classes from .NET core to parse XML, or the Newtonsoft library to parse JSON.

Conclusion

In this article we have shown how to invoke a web service to validate the data entered by the customer. The next articles in the series will show how to perform this validation through the following external data sources:

  • XML File
  • CSV Text File
  • SQL Server Database

The third part of the series Creating a Phone Support Portal with the 3CX Call Flow Designer – Part 3 shows how to perform the validation using XML and CSV text files.

You might also be interested in:

Get 3CX Free for 1 Year Today
Download On-Premise Try in the Cloud