Skip to content

Functions ​

With this guide you will learn how to create and manage Functions in uContact. Functions run custom logic in the background: they receive data from other systems, notify other systems when something happens in uContact, or run scheduled tasks. Unlike Bots and IVRs, they do not talk to customers.

What types of Functions are there? ​

  • Webhook: integrates uContact with other applications by receiving data. uContact generates a URL; when another system calls it, the Function's flow runs.
  • Event: triggers actions when something happens on the platform (for example, an interaction finishes) by sending the data to the URL you configure.
  • Scheduler: automates scheduled actions, such as running a database script or exporting data on a schedule.
Scheduler availability

The Scheduler type is only available to system administrators.

Where do you find them? ​

Go to the Administrator menu, open Automations and select the Functions tab.

The list shows, for each Function:

  • Name: unique name that identifies the Function.
  • Description: purpose of the Function. It is empty if no description was added.
  • Type: Webhook, Event or Scheduler. Hover over the type to see the URL (Webhook), the event (Event) or a description of the schedule (Scheduler).
  • Status: for Webhooks and Events, the date and user of the last deployment, or Never if the flow was never deployed. Schedulers show Enabled.

Disabled Functions are grouped at the end of the list under Disabled. Use the search bar to find a Function by name, description, type, deployer, event or URL.

Clicking a row opens the flow designer (Webhook and Event) or the task form (Scheduler).

How to create a Function? ​

  1. Click New (shortcut Alt + Shift + C).
  2. Choose the type: Webhook, Event or Scheduler.
  3. Complete the form, described below for each type.

Webhook ​

  • Enabled: turns the Function on or off. It is on by default.
  • Name (required): unique name. Only letters, numbers, _, - and ., without spaces. It cannot be changed after creating the Function.
  • Description: optional.

The URL is generated when the Function is created. To see it, open Edit: the URL field is read-only and has a Copy URL icon to copy it.

Event ​

  • Enabled: turns the Function on or off. It is on by default.
  • Name (required): same rules as in Webhook.
  • Event (required): what triggers the Function:
    • Agent logged: a user logs in or out.
    • Disposition: a user sets a disposition on an interaction on any channel.
    • AgentRingNoAnswer: an agent does not answer a call within the maximum ring time configured for the campaign.
    • Agent break: an agent enters or leaves a break.
    • Finish interaction: an interaction finishes on any channel.
    • Assign interaction: an interaction is assigned to a user.
    • New recording: a new recording is available for a telephony interaction.
  • URL (required): address the data is sent to when the event occurs. It must be a public domain (for example https://example.com/hook); IP addresses and localhost are not accepted and show Invalid format.
  • Description: optional.

After creating a Webhook or an Event, open its flow with Edit workflow to define what it does, and click Deploy for the flow to take effect.

Scheduler ​

The Scheduler form has three tabs:

  • Basic:
    • Enabled, Name (same rules as above) and Description.
    • Type: SQL Script (runs a query or script on the database), Shell Script (runs a command or script on the system) or Export (generates a CSV file with the data of a query).
  • Configuration: appears once you choose the type.
    • The script to run.
    • For Export, two optional delivery blocks:
      • SFTP: check Export to external server and complete Host, Port, Username, Password or Auth key file, Path and Filename.
      • Email: check Send to email and complete Email, Subject, CC and CCO.
  • Schedule: the Timezone in which the task runs and when it runs, using the Minutes, Hours, Days of Month, Month and Days of Week tabs. The Expression and Explain boxes show the resulting schedule.

An enabled Scheduler cannot be saved without a script: you will see the message Cannot save. The Script field is required when the task is enabled.

Available actions ​

From the actions menu of each Function:

  • Edit: change Enabled and the description and, in an Event, the event and the URL. In a Scheduler it opens the full form. The name cannot be changed.
  • Edit workflow: opens the flow designer. Only for Webhooks and Events.
  • Historic: opens the version history of the flow, where you can recover a previous version. Only for Webhooks and Events.
  • Duplicate: creates a copy named name_copy, disabled. The URL of a duplicated Webhook also ends in _copy.
  • Delete: deletes the Function.
Technical details

To learn which variables each type receives, what the flow can do and examples of schedules, check the Functions guide in the Developer section.

Frequently Asked Questions ​

Answers to the most common questions about this topic.