The Salesforce Developers website will undergo maintenance on May 29, 2024 from 3:00 a.m. UTC to 10:00 a.m. UTC. The maintenance process may affect the availability of our documentation. Please plan accordingly.

Salesforce Data Cloud’s Data Actions is a powerful near real-time platform that enables customers to harness the power of data and insights available in Data Cloud. It uses Change detection, which is based on Change Data Capture. It enables near real-time data processing, decision-making, and maintaining data integrity across a wide range of applications. Combining the change detection events with visualization can deliver substantial business value by providing timely, accurate, and actionable insights that drive operational efficiency, enhance customer experiences, ensure compliance, and support data-driven decision-making.

In this blog post, we’ll provide an overview of Salesforce Data Cloud’s Data Actions feature and walk through how to further extend a webhook as a target to visualize and drive business outcomes.

What are data actions?

Data Actions in the Data Cloud platform is a powerful feature that allows users to automate actions on customer data across multiple Salesforce apps and external systems. Users can define rules and logic that trigger actions like sending an alert or an event to a target based on customer streaming insights and engagement data to trigger automation or data integration. These actions can include updating records, sending notifications, invoking external services, or initiating business processes.

Data actions leverage the change data feed from Lakehouse, which captures and provides near real-time updates on changes (creation, deletion, or updates in records) made to a dataset. Users can configure data actions for a specific target to trigger based on specific events, such as data changes or specific conditions being met. One possible use case could be streaming analytics and anomaly detection. The supported targets are Salesforce Platform Event, Webhook, and Marketing Cloud. In this blog, we will describe how to use a webhook as your target for a data action.

What are webhooks?

Webhooks provide the flexibility to create custom integrations, define event-driven workflows, and seamlessly exchange data between systems. Webhooks enable applications to send automatic notifications or data to another application by triggering an HTTP request to a specific URL endpoint. When an event or specific action occurs in the sending application, it can send relevant information to the webhook endpoint, which is then processed and acted upon by the receiving application.

Data action with a webhook as a target

Potential use cases

There are various other use cases where data actions with a webhook as a target can be useful. For example:

  • Efficient and timely vehicle servicing reminders for customers
  • Acting on changes in customer data to strengthen the customer relationship
  • Loyal customers campaign

Let’s take a closer look at one scenario and the steps involved.

Example use case: Effective email engagement with customers

A B2C company is running a campaign of offers for all of their customers, including the churned ones. They want to keep track of the contact’s information update and take appropriate action. Additionally, they have a customer database and are not sure whether their email addresses are still valid or if there is an update. They want to leverage data actions to trigger webhook events whenever the rules of bounced emails are met, so that they can analyze the email engagement success ratio.

Business Value: Regularly monitoring a contact’s information updates and bounce rates, identifying and removing invalid email addresses, and adhering to best practices for email marketing can help minimize the negative impact on business operations and enhance the effectiveness of email communication engagement, in turn increasing business revenue.

How to create a data action with a webhook as a target

Prerequisites

The data is ingested, harmonized, and modeled in Data Cloud. The Data Action feature should be enabled and the user should have the Data Aware Specialist role.

Step 1: Create a webhook data actions target

The result of a data action is triggered in a data action target as change data events. Here, we’re talking about webhook as a target. The webhook receives the data action in near real-time. Customers can further drive event-based orchestration using these events.

Follow the below steps to create a webhook data actions target.

  • In Data Cloud, navigate to the Data Actions Target tab, and click New.
  • Enter the Action Target Name. The Action Target API Name field is auto-filled.

Data Action Target create page

  • Select Webhook in Action Target Type.
  • Enter the URL to publish, and save the changes.
  • Generate the secret key by clicking on Generate Key.

Data Action Target Details page along with secret key generation

  • Copy the secret key to configure your webhook endpoint.

Data Action Target Details page along with secret key generated and regeneration options

Step 2: Create data actions

Create a data action to send an alert or an event to a target based on a data model object or calculated insight to trigger an automation or data integration.

  • In Data Cloud, go to the Data Actions tab, and click New.
  • Select the data action target, and click Next.

Data Action Target selection page for data action creation

  • Select the appropriate Data Space from the dropdown.
  • Select either a data model object or a calculated insight object type. A data model object contains streaming insights and engagement objects. From the Primary Object dropdown, select an object, and then click Next.
  • (Optional) To enrich your data action, select an optional related object.
  • Add up to 10 related attributes to your data action.

Data Action Creation page

  • Select an event rule and an action rule. Use the event rule to create an action based on record changes. The action rule evaluates your data action. You can include OR and AND conditions in the action rule.
  • Select the object, attribute, and operator, and enter a value that can trigger the data action. Here we see rules for taking action on creating and updating a contact’s email.
  • To add more conditions, click Add Condition.

Data Action creation page with Event Rules and Action Rules selection

  • Click Next.
  • Enter the Action Name. The Action API Name field is auto-filled.

Data Action properties addition and Publish button

  • Click Save and Publish.

If action creation is successful, you will see a success message. You can go to the Details tab to see the details of the created data action.

Data Action Details page showing data action metadata

How to visualize and act on webhook data action targets

Webhooks offer a great deal of customizable ways of driving business outcomes. These events can be used in various ways depending on the specific use case and the systems involved, for example, near real-time notifications, data synchronization, automation and workflow integration, custom integrations, and web service APIs.

To visualize the events received in a webhook:

  • Visit any webhook site (https://webhook.site/, for example) and enter the webhook URL used while creating a data action target. Or you can even add /#!/ (see docs) to the webhook URL and enter in any browser and monitor it for new events. For example: https://<<Any webhook site>>/#!/77c4981f-271b-4fb9-8ce9-xxxxxxxxxxx (see docs).
  • Whenever a record is ingested in the CRM source matching the condition of the data actions, an event is triggered to the webhook.

Triggered event in a webhook based on data action rules

The below image shows that the email was updated from amaclead@gmail.com → amaclead_new@gmail.com for the data action Contact Email Update.

The change data captured in the triggered event to a webhook data action target

Optional: Extend webhook events at client side for visualization (outside scope of Data Cloud)

These webhook data action events possess a lot of meaningful insights for businesses to drive critical decision-making. Here we propose an architecture for extending the usage of these events. In Data Cloud data actions, the events are retained for four days. Hence for consumers of these events, it is recommended to build a pipeline for scalability and reliability.

Below are the high-level steps to visualize webhook events in AWS Quicksight in a reliable manner.

  1. Create an SQS queue for storing webhook requests.
  2. Create a role for the API gateway to access SQS.
  3. Create an API gateway endpoint for receiving webhook requests and write to SQS.
  4. Create a Lambda function to read SQS events and transform them as needed and write to Amazon S3. Lambda reads messages in batches and invokes the function once for each batch, and then uses s3.put_object boto3 to upload to S3. Note: For simple upload without transformation, we can even use an API gateway (without Lambda) PUT method with AWS service integration.
  5. Data in S3 can be visualized using Amazon Quicksight.

Here is an architecture for the above steps:

Architecture of extending webhook events at the client side for visualization and data analytics

Plan ahead

Webhooks as a data action target has seen a lot of customer adoption recently. There are multiple reasons that could cause the events to be failed or delayed, while attempting to process and deliver the events to the data action target. Some of the reasons include a burst of events load, system errors, targets being down, etc. To enable customers to be able to visualize it for analysis and redelivery, webhooks will also support the replay of events from a particular timestamp in future releases.

Summary

The simplicity of data actions using webhook as a target offers tremendous possibilities in terms of extensions and enhancements on the customer’s end to help them provide near real-time updates and alerts, helping them stay on top of changing market conditions and customer needs.

Resources

About the author

Geeta Singh is a Senior Manager in Salesforce Data Cloud Engineering management. She has been building products for 10+ years using big data and AI technologies. In her current role at Salesforce, Geeta works in Data Cloud Data Actions, Copy field enrichment, and Data Cloud triggered flow solutions to enable actionable insights for customers.

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS