Building a Second iFlow for Internal Notification

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Create an additional iFlow to provide PO notifications via Slack and outbound communication to the SAP API Business Hub enterprise API

Build a Second iFlow for Internal Notification

Business Scenario

In this exercise you will:

  • Build a second iFlow for an internal notification.
  • Create an outbound communication to the API Business Hub Enterprise API.

Task Flow

You will perform the following steps:

  • 30: Create iFlow PO_Slack.
  • 31: Consume and process purchase order message.
  • 32: Send a message to a Slack channel.
  • 33: Prepare for testing.

Prerequisites

You have a running Cloud Integration process with name Send a PO Message as notification to Slack.

Task 1: Create Another iFlow PO_Slack

Steps

  1. Create Another iFlow PO_Slack.

    1. From the iFlow editor, navigate back to you package by choosing Designyour packageArtifacts. Choose EditAddIntegration Flow.

    2. Enter a Name and, optionally, a Description. Choose OK.

    3. Navigate to the iFlow editor of your just-created artifact by selecting the iFlow. Select the newly created process row with the name PO_Slack.

    4. Choose the Edit button.

Task 2: Consume and Process Purchase Order Message

Steps

  1. Consume and Process Purchase Order Message.

    Use the following data:

    FieldValue
    Adapter<choose> ProcessDirect
    Connection/Address/PO_scenario/PO_Slack
    Element: Content ModifiersetCommunication Parameters

    1. Select the Sender tile and rename it to PurchaseOrder.

    2. Press Enter and again select the PurchaseOrder tile and drag the arrow to the Message Start icon.

    3. Choose the ProcessDirect adapter.

    4. Insert the following data in the Connection tab Address field: /PO_scenario/PO_Slack.

    5. Save your interim status.

    6. Afterwards, select Edit again.

    7. Set a Content Modifier element using the Message Transformers toolbar icon in the top toolbar, and call it setCommunication Parameters.

  2. Edit the Message Header.

    Use the following data:

    FieldValue
    ActionCreate
    NameAPIkey
    TypeConstant
    Value<your saved API Key from your SAP API Business Hub Enterprise API>

    1. Open the Message Header tab and enter the API Key from your SAP API Business Hub Enterprise API. Choose the Add button and enter the data from the table above.

    2. Choose Save.

  3. Add data to the Exchange Property tab.

    Use the following data:

    FieldValue
    ActionCreate
    Namepoid
    TypeXPath (if no payload displays, choose Constant)
    Data Typejava.lang.String
    Value4500000011 (if you followed the example)

    Normally, for the Value, you work with a variable that you can provide via Externalize, as you have seen before in a previous lesson.

    1. Navigate to the Exchange Property tab, choose the Add button and enter the data from the table above.

  4. Add further data.

    Use the following data:

    FieldValue
    ActionCreate
    NameChannelID
    TypeConstant
    Valueyour saved channel id from your SAP API Business Hub Enterprise API

    1. Choose the Add button again and enter the data from the table above:

    2. Choose Save.

  5. Navigate to the Body Tag and insert the following body:

    Code snippet
    { "text": "Message successful processed with Purchase Order ID: ${property.poid}" }
    Copy code

    1. Choose Save.

Task 3: Send Notification/Message to a Slack Channel

Steps

  1. Send notification/message to a Slack channel.

    1. Set a CallExternal CallRequest Replay.

    2. Set a ParticipantsReceiver and name it Slack_Supplier.

  2. Create a HTTP communication between the "sendMessage" Request Reply and the receicer "Slack_Supplier" and configure it.

    Use the following data:

    FieldValue
    Addressyour saved url with the channel id property as a variable ${property.ChannelID}
    Add within this url the channel ID property, for example: "https://host:443/v1/Slack/channels/${property.ChannelID}/messages"
    Proxy TypeInternet
    MethodPOST
    AuthenticationNone

    1. Create a HTTP communication between the "sendMessage" Request Reply and the receicer "Slack_Supplier"

    2. Enter the data from the table above.

    3. Save your work as Version and give a comment.

Task 4: Prepare for Testing

Steps

  1. Add a timer.

    For testing purposes we simulate an incoming PO message with a timer.

    1. Click on Edit.

    2. Delete the Start message icon.

    3. Instead set an EventsTimer with Run Once on the Scheduler tab.

    4. Set a new Message TransformersContent Modifier, with nametest, after the timer and link everything together

    5. Open the test Content Modifier and choose the tab Message Body and insert the following data.

      <PurchaseOrderID>45000000111721</PurchaseOrderID>
    6. To deploy the hole process, choose Deploy on the top right and confirm the following two pop ups.

    7. Change to the Operation view on the left navigation bar and find your started process at Manage Integration Content. Change the Log Level to Trace.

    8. Deploy your process again.

    9. Click on the link Monitor Message Processing.

    10. Click on the last message.

    11. Click on the Trace link in the Logs area to debug the process.

    12. Choose Message Content and find the data on the Payload tab.

    13. Go to Slack and find your message within your channel.

    14. If your process run, save your test installation as a version in the Design view (Save as version).

    15. Navigate back to the Design view in your package PO_scenario.

    16. In the Artifacts tab, click on the Version link of your PO_Slack iFlow.

    17. When hovering over the left side of the pop up window with the mouse, a small icon is displayed with the name Click To Revert. Click on this icon to revert to the last working version. In our case we switch from version 1.0.6 back to version 1.0.4

Result

In this module, a second iFlow was created to send a notification to Slack, using the SAP API Business Hub Enterprise API.

Summary of the Lesson: Building a Second iFlow and Additional Resources

You have stored the PO data in the CI tenant's Data Store for 30 days and configured the second branch to run another iFlow, which is configured to include the Slack use case in the next lesson. Both branches are executed in parallel.

Additional information on the Data Store feature can be found here.

Save progress to your learning plan by logging in or creating an account

Login or Register