FAIR Consulting GroupConnect SAP Hybris Commerce with Slack API’s - FAIR Consulting Group

Connect SAP Hybris Commerce with Slack API’s

Share on facebook
Share on twitter
Share on linkedin

Industry

Services
Platform
Domain

Industry

Services
Platform
Domain

Connect SAP Hybris Commerce with Slack API’s

Slack has experienced a significant increase in its popularity and use since it first launched back in 2014. It has become the go-to collaboration tool for major enterprises of all sizes and industries. The ability to build your own slack apps and easily integrating with other systems makes it even more popular within the tech community. In this blog post, I explore the different features available within a slack app and how they can be leveraged with SAP Hybris Commerce using a quick and dirty prototype.

Scenario Overview

The yIntegration Slack App will be using the following features and functionality of the Slack API:

  • Incoming Webhooks: A simple way to post messages to slack from external sources. In this case, I will be using incoming webhooks to post Hybris Cronjob status messages to slack.
  • Slash Commands: This offers a convenient way to trigger actions for the yIntegration app directly from the slack message box. In this prototype, I have used slash commands to interact with the Hybris Stock Service and get stock updates for products.
  • Bots & Events: We can create a bot user and bundle it with the slack app to interact in a more conversational manner. Event subscriptions are the primary way to interact with the bot events. I have this functionality to connect with the Hybris Stock Service in a more conversational manner.

PoC Explained

integration app uses two slash commands to interact with Hybris Commerce which is explained below:

 
  • /Stock: This command is used to get the stock of all the products and post it into the slack channel. If the product id is also provided as a parameter in the stock command, it will look up the stock for that particular product and get the stock status.

Stock for all products:

 

Stock for specified Product:

  • /add-stock: This command takes two arguments ‘ProductCode‘ and ‘StockCount‘. The command uses the Hybris Stock Service to add the specific stock count for the product code.

 

The yIntegration app also contains a bot which I used to trigger events using the Events API. I have subscribed the ‘hybrisbot’ to “app_mention” event which will be triggered every time the bot is mentioned in the slack chat. There are many other events that are available which can be used to subscribe to bot events.

Another use case which is implemented in the app is to notify slack about the cronjob results. I have extended the OOTB ‘electronics-CartRemovalJob’ to send notifications to slack about the cronjob results using the Slack Incoming Webhooks.

Stay up-to-date with FAIR

Connect with FAIR today and get the latest tips and tricks on improving your customer experience tools and eCommerce platforms. Once you subscribe you will get access to workshops, webinars, recent projects and so much more.