Use a rule to evaluate information from a data action


Using the Data Action rule condition, a pre-call or wrap-up rule can evaluate response data from the PureCloud Public API, Salesforce, Zendesk, or REST API endpoints.

This procedure explains how to set up a rule that runs a data action, and then evaluates the information it returns. To set up a rule, select a data action, configure input data the data action needs, and configure the rule to evaluate information returned by the data action.

The steps are:

  1. Click Admin.

  2. Below Outbound Dialing, click Rule Management.

  3. On the Call Rule Sets tab, click Create New.

  4. On the Create Call Rule Set page, type a name for this rule set in the Call Rule Set Name box.

  5. If your data action needs contact data, select a contact list from the Contact List box so that you can select its columns later. You do not need to select a Queue.

  6. Click Save and Add Rules.

    Note: If updating a set that already contains rules, click Add New Call Rule instead.
  7. On the Add Call Rule page, type a name in the Call Rule Name box.

  8. Select Pre-Call or Wrap-up from the Category box, based on whether you want your rule to evaluate before outbound places calls, or after calls ends.

  9. Below Conditions, click inside the Type box. Select Data Action.

  10. To display a list of available data actions, click the Data Action box. Then select a data action from the list.

    If no existing data actions are suitable, create a new data action. See Create a custom action for integrations. To create a data action, you must know the data action’s input and output contracts, endpoint, and other parameters. Contracts define the format of data passed to the data action or returned by it. The endpoint is the address of the API call. For more information, see About integrations, About the PureCloud data actions integration, and About custom actions for integrations.

    The efficiency of data actions is important. If a data action makes an API call or conducts a database lookup that takes a long time to complete, that could slow down outbound dialing.

    Note: If the system displays, ‘The input contract on the data action must be of type “object”‘, then the selected data action is not compatible with Outbound. A compatible contract resembles this schema:

    To view the input contract for a data action, select Actions from the Admin menu. To open a data action, select its name. Then select its Input Contract tab. The data in the schema must define properties as belonging to an object. See Create a custom action for integrations.

  11. The controls below Map of Outbound Values to Data Action Inputs correlate campaign data with input properties of the data action. This mapping tells the rule what information to pass to the data action before the data action runs.

    Note: Agent Wrap-up and Call Analysis Result input fields are not necessarily populated for a running a data action condition. An Agent wrap-up is not returned for calls that don’t reach an agent. Preview calls do not return a Call Analysis result.
    1. Use the Outbound Value list to select an item of information to pass to the data action. Your selection of outbound values is based on the contact list selected.

    2. Use the Data Action Input list to select which input property of the data action receives the outbound value.

      For example, you can map a phone number from the campaign to a data action’s Cell property.

      Tip: If the system displays this validation warning: “The data action must be configured as secure for use with contact columns”, then the data action was not configured as a HIPAA/Secure Data compliant data action. You must reconfigure the data action to make it secure before using the data action in outbound. To do this, click Admin. Under Integrations, click Actions. Click the data action name to open it. Then click the HIPAA/Secure Data box.

      The inputs to a data action are based on its contracts. Contracts are JSON schema statements (specified when someone creates a data action) that define what data passes to a function or what the function returns.

    3. To map more Outbound Values to Data Action Inputs, click the + below the last configured row. Repeat until you have mapped all inputs that the data action requires.

      Using this association between Outbound Values and Data Action Inputs, your rule passes to the data action any data it needs. For example, a data action can use a column from the contact list to retrieve information from a CRM.

  12. In some situations, you may want to invert the condition, so that the system performs its data action when the opposite of the condition is true. This inversion is accomplished by setting the Invert Condition switch to Yes. An inverted condition performs rule actions when the condition is not met.

    If you want to:

    • Perform a rule action when the condition is met, set Invert Condition = No. This setting is the default.

    • Perform a rule action when the condition is not met, set Invert Condition = Yes.

  13. Having defined inputs to the data action, the next step is to configure your rule to evaluate information returned by the data action. Use the Output Evaluations section to set up expressions that evaluate any return value in the data action’s Output contract.

    1. Select a return value from the Data Action Output box.

    2. Select an operator from the Comparator box.

      Currency evaluations

      A data action condition can evaluate currency values, but only if the output result has 2 or fewer decimal places.

      If a result has more than two decimal places, rules cannot evaluate it.

      Time evaluations

      String, Boolean, and numeric comparators are intuitive. You can compare date strings to relative times, or to specific times. Both types of time comparators provide “Is Earlier Than” and “Is Later Than” comparators. The difference is whether the value is compared with an exact data and time, or relative to the current time, in the past or the future. A specific time value is set by configuring:

      But a relative time value is set by configuring a time offset:

    3. Type a value in the Value box. This value is compared with the value returned by the data action, using the selected comparator. For example, you can check to see if a postal code begins with the number 5:

      Tip: String comparisons are case-sensitive.
  14. (Optional) Check the invert comparator box if it makes sense to invert the comparison operator. For example, if you invert the “Begins With” comparator, the evaluation resolves true if the value does not begin with the specified value.

  15. (Optional) Set When there is no value for the data action output field, this evaluation resolves to True. In other words, if the output contains no data, you can decide whether the expression returns True or False. False is the default.

  16. (Optional) Click + to evaluate another output value. Repeat steps 13-15 to configure the new evaluation condition

    Note: Conditions join with the AND operator, so a call must meet all rule conditions for the overall rule to evaluate True.
  17. (Optional) If the data action returns no data, you can control whether the condition evaluates True or False by clicking the Data Not Found Resolution switch. False is the default, meaning that the condition returns False when the data action returns no data.

  18. Configure data actions for this rule to perform when its conditions are met. See Configure rule actions for details.
  19. Click Save.

Limitations on data types in contracts

When administrators create a custom action for integrations, they define input and output contracts that Outbound interfaces with.

There are some limitations on data actions that can be used with outbound rules:

    • For both input and output contracts, the top-level type must be an object. An Input contract cannot pass an array to a remote endpoint, and Outbound cannot consume an array of response data unless the data action’s output contract uses a translation map to convert the array to an object.
    • Output contracts can allow complex objects or arrays, but Outbound does not permit use of those data types in a rule condition. The rule condition can only operate on Boolean, integer, number, and string data types.
    • If the endpoint returns a non-JSON response, you must provide a middleware service that transforms the response to JSON. The response to a data action must be a valid JSON. Otherwise, the data action will fail.
    • Never try to flatten fields in a data action’s output schema. See Guidelines for actions used with outbound dialing rules.