Introduction: automation using Zapier

I doubt it, you don’t know what Zapier is, but for a short recap: it’s the SaaS application that “automates apps in millions of ways”. You can choose ready to implement receipts that connect and automate the most popular applications into one workflow. Set it once – and forget.

From my life example, I have a “Zap” which connects the Stripe with Slack. Each time someone buys my book (successful payment in the Stripe), I am receiving a notification on my Slack channel.

Boom%21

Boom!

It’s not required to have any programming skills to build an integration like that. What You need to do is:

  • Select two applications you want to integrate.
  • Select action or scenario.
  • Configure access to each of them (for example, by API private key).
  • Run!

Examples can be found on the main site, https://zapier.com/.

When I started thinking about that, I saw that the same way of automation is possible using SAP Data Intelligence! SAP DI is a perfect tool for designing and implementing the automation of processes.

In this post, I want to show the steps required to implement a similar scenario using SAP Data Intelligence.

Introduction

The SAP DI offers plenty of ready to use standard operators.

SAP%20DI%20Operators

SAP DI Operators

We can use them in the integration scenarios like:

  • Connect with other SAP systems, SAP HANA, SAP BW.
  • Connect with third party systems.
  • Send OData/HTTP request.
  • And more…

But we will not find ready to use operators like in the Zapier. Luckily, we could build and reuse our operators using programming languages like:

  • JavaScript
  • Node.js
  • Go
  • Python

My final goal is to implement integration and prepare two custom operators: first for fetching data from the Stripe, second for pushing a message to a Slack channel.

First approach: pipeline with available operators

There could be multiple approaches there (no surprise). I don’t recommend that, but it will be possible to combine existing components to achieve the goal. It will work, but it wouldn’t be reusable in the other pipelines.

I propose to build a pipeline which will:

  1. Call the Stripe API using the HTTP Client operator.
  2. Response data will be processed and forwarded to Slack in the next HTTP Client.
  3. Node Base operators will be used to pass the messages between other operators.

Pipeline%20example%20in%20SAP%20Data%20Intelligence

Pipeline example in SAP Data Intelligence

Documentations:

Stripe API Documentation: https://stripe.com/docs/api/charges/list?lang=curl

HTTP Client operator documentation: https://help.sap.com/doc/de49c012b53d476eae7af14497eac256/2.4.latest/en-US/f6619b1123794a4fb47fe904859391a2.html

Pipeline implementation

It is possible to access data from the Stripe calling HTTP request with the appropriate authorization header. Let’s use the HTTP Client operator to fetch charges from the Stripe.

To correctly authorize with Stripe we have to fill the “Authorization” header parameter in an HTTP request. Unfortunately, the current version of the HTTP Client operator doesn’t allow us to do it directly in the configuration. It’s possible to pass the details to the input port named “inRequest”. I used Node Base Operator for that.

“Request Prepare” operator code:

Code is straightforward, I am passing the configuration of the request as a message to the HTTP Client operator (inRequest port). I simplify that and I am getting all charges from the current date.

Slack configuration

The Next step is to pass the message to the Slack channel. To be able to push messages, we have to create and configure the application.

    1. Create a Slack app in our channel: https://api.slack.com/start/overview#creating.

    1. Activate Incoming Webhooks.

  1. Install the application in the selected channel.

Using the generated Webhook URL, we could pass the message directly to the channel. Now it’s possible to process a response from Stripe – and pass it to the next HTTP Client operator. Continue.

“SLACK: Send Message” operator configuration:

We could do global configuration in “Connection Management” application (HTTP Connection), which I would recomend.

 

“Message Prepare” operator code:

 

Finally, we could, save and run the pipeline. After a few seconds, the message should be published on the dedicated channel.

In a pipeline like that, we could schedule and run it every day, to receive a quick summary directly to team chat.

Second approach: building custom operators.

This solution will be described in the next post 🙂

Please let me know if you have any questions related to implementing custom operators or SAP DI.

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x