Guides
Breadcrumbs

User Functions Tab

Overview

User functions are there to help compute the message of a prompt or an announcement. You can use javascript, write your own code, apply your business logic and at the end, literally return a string. This string will be used in an announcement or in a prompt.

User Functions are available for the following miniApps' Types:

  • Intent

  • Announcement

  • CorpusCollection

  • Text

  • Alphanumeric

  • Alpha

  • Numeric

  • Date

  • YesNo

  • Entity

  • Intelli

  • WebService

Add a User Function

In the User Function tab:

  1. Click the +Add User Function button

  2. Enter the User Function Name

  3. Enter the Javascript to configure the User Function

  4. Click the Save Changes button to save changes

  5. Click the +Add User Function button to add another User Function and follow steps 1-3.

    2023-01-20_08-30-00.png



User Function application example

Based on the telephone number the caller is calling (params.Dnis), the miniApp can find out which branch the caller called. The miniApp announces the brunch city name through a welcome prompt as configured through a User Function Javascript.

2023-01-20_08-32-20.png


User Function Javascript

if (params.Dnis.startsWith('505')) {
   'New Mexico'
} else if (params.Dnis.startsWith('272')) {
    'Pennsylvania'
}
2022-09-20_16-02-04.png

You can use the following values in your javascript code:

  • params.Ani

  • params.Dnis

  • params.extValue1

  • …​

  • params.extValue10

Your javascript function must always return a string in the end.

To get the string returned by your function, use {{MyFunctionName}} in the corresponding prompt.

For more information on how to complete JavaScript in User Functions please read JavaScript Functions in miniApps .