Script Widget

Through Script widget, we can control your call flow and third-party integrations through dynamically built APIs. You can choose to add widgets as a response to the caller.

Application of Script widget

  1. Third Party Integration: Script widget can handle multiple functionalities for you. Often, businesses prefer to work on their in-house applications and would prefer to import the call data. Let’s say, business wants to track the missed calls they received through their application. We’ll add the script widget with the business’s API and our replaceable parameters. Through this, the business’s in-house application tracks the number of missed calls received.

  2. Intelligent Routing: In the e-commerce marketplace, there might be call conversations that happen through unknown or unregistered numbers. As a service provider, we can trigger an API to recognize the caller’s identity. For example, a delivery agent is calling from an unknown number, we’d place a request through API to enter the registered phone number and the PIN. Through this, the call will be automatically routed to the respective resource.

  3. Manage Extensions: Through a dynamically enabled API, users can enter the extension number and the calls get connected to the inputted number.

How to use Script Widget?

To use the script widget, follow the steps below:

  1. Drag the ‘Script’ widget to the IVR flow.

  2. From the ‘Script Prompt’, choose the pre-recorded text format, by entering the text, or uploading a sound file, or choosing from the local library.

Choose the option to allow the caller to enter the keypress, or just say something. Choose the Speech language and the speech output (as shown in the image below). There are two options for the speech:

  1. No filter - where anything the customer says is accepted as speech, typically involves keywords like click to call, or talk to customer care etc.,

  2. Numeric only - where the customer can say numbers only. This is typically used in BFSI sector for banking and financial transactions or in e-commerce where the customer can enter the  order number, transaction id etc.,

  1. Define the Trigger URL (explained in Script Attributes)

  1. Choose the Response you wish to apply along with a response key. Key format can be ‘data.code’

  2. You can choose to repeat the prompt selection and specify the input time, no.of seconds to wait for each digit 

  1. Response cache ensures that the API response is saved for a specified time limit, and in this time limit if the same API parameter values are used for the same response, it’ll not generate a duplicated response. This avoids duplication of same API responses.

  1. You can also set ‘Background Music’ to ensure that the customer is engaged with a meaningful message when there is any delay in the response of the callback.

  2. You can also choose an alternative action in case of no response.

Script Attributes

  • Script Prompt (Optional): When the caller reaches the script, he will hear the message given here. You can type a message, upload a pre-recorded file or choose from your library.

- Read text also supports below customizable replaceable parameters from script response.

- {say:$variable} Which will verbalize the value of script response variable $variable.

- {play:$variable} Which will play the URL value of script response variable $variable.

  • Allow caller to enter DTMF (key press): If any user input is required to be passed in the trigger URL, this option is selected. IVR will wait, accept and store the keypress which is triggered along with the URL. It is always numeric.

Sample URL, to show how keypress is passed Where user is prompted to enter their order ID in script prompt and is passed to client server for validation along with calling number.{caller}&orderID={keypress}


  • Trigger URL (Mandatory): URL that is triggered in the background while script widget runs. This is ideally a URL that triggers to client destination along with a few parameters from IVR for validation.

  • Request body for POST request (Optional): POST request payload in query string format is accepted. If given, the system will automatically hit the API using POST method, leave it blank for GET method. Note to provide all the values in URL encoded format. Ex: caller={caller}&orderID={keypress}. JSON format can also be configured.

  • Request headers (Optional): Specify any standard/custom headers in query string format. System will automatically convert them to HTTP request headers while triggering the API. Note to provide all the values in URL encoded format. 

Ex: Authorization=Basic xxxxxxxxxxxxxxxx&customsource=Kaleyra&Content-Type=application/xml


  • Send as RAW HTTP POST request (Optional): Check this option if the API must be triggered as RAW HTTP request with JSON format payload. System will automatically convert payload into JSON format.

  • Response (Optional): The URL triggered in the previous step will respond in a non HTML format. For each response code, a corresponding widget can be added based on the action to be taken for each case. Sample IVR's explained in the next few pages.

  • Script prompt repeat (Optional): Specify the number of times the script prompt must be repeated if no input is received from user end. Set it to 0 or leave it empty if no iteration is required.

  • Keypress length (Optional): Specify the number of digits the script widget should accept. When the specified length is reached the keypress is accepted, saved and passed in the URL if required. 

  • Response Cache (Optional): Duration in minutes to which the API response to be cached. This is helpful to reduce the API calls when response remains same/similar for given parameters. Works only if response is handled. Min 1 minute, max as 999 minutes.

  • Gap between each digit (Optional): Specify the gap-time in seconds for which the IVR should wait for each digit. If not specified default is 4 seconds.

Example: If the IVR is set to accept 4 digits and the gap between each digit is set as 5 seconds, then the IVR will wait for 20(5*4) seconds before taking the next action.

  • Caller didn’t enter anything after the prompt (Mandatory): Add a widget here depending on the action that has to be taken if user does not input anything for the specified time (20 seconds). Mostly a hang-up widget is used to terminate the call.

Didn’t get a response from the script (Mandatory): Add a widget here depending on the action that has to be taken if no response is received from the URL that is triggered in the previous step until the URL times out. Mostly a hang-up widget is used to terminate the call.