Skip to Content
Technical Articles
Author's profile photo Saatae Issa

Send personalized emails with SAP Customer Data Cloud webhooks and Kyma serverless functions

SAP Customer Data Cloud webhooks send out asynchronous event notifications to custom notification URLs when specific events occur in SAP Customer Data Cloud flows such as login, registration, and account update.

This post demonstrates an example in which event notifications for the subscription updated event are sent to a Kyma serverless function, which has a code snippet that implements some business logic to eventually send a personalized welcome email to users.

Two Kyma serverless functions are used in this example and they work together as explained below.

The first serverless function receives notification messages and has a code snippet to extract all the events from each message and post them to an SAP Event Mesh Queue.

The second serverless function has a code snippet to consume the events from the SAP Event Mesh Queue and process them as follows:

  • First, it makes an accounts.getLiteToken REST API call to get a regToken that is required for the next step
  • Next, it makes an accounts.getAccountInfo REST API call to get the user’s preferences
  • Finally, it sends a personalized email to the user based on the user’s preferences using SendGrid Email Delivery Service

Note: All the functionality presented here are subject to change and may be changed by SAP at any time for any reason without notice.

Solution Architecture


Sequence Diagram


Source code repository

Here’s a link to the source code of this example.

Build and deployment steps

This example can be setup using SAP Customer Data Cloud and a free SAP BTP Trial account via the following steps:

Note: Click the links below for more details.

Verification steps


This example shows how easy it is to extend SAP Customer Data Cloud using webhooks and SAP BTP, Kyma runtime. It also shows how to effortlessly and quickly create Kyma serverless functions using the Kyma console to add some simple code snippets without having to worry about the infrastructure details, which results in faster time to market as well as lower infrastructure total cost of ownership (TCO).

As a next step, you could explore the built-in observability tools of Kyma runtime for monitoring the serverless functions. With reference to this example, you could also try to create other Kyma serverless functions for your own use cases and implement SAP Customer Data Cloud webhook endpoints for some other events such as the account logged in or account updated events.

Kindly provide your feedback or feel free to ask clarifying questions related to this post in the comment section below. Additionally, I’d like to invite you to submit any broader Kyma related questions in the Q&A area of the SAP BTP, Kyma runtime topic.

If the SAP BTP, Kyma runtime topic interests you, here are some other links that you may like:

Lastly, if you liked this post, kindly hit the like icon, leave a comment below or share this post. Thank you!

Further Readings

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.