Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Active Participant
Hello SAP Experts!

This blog is part of the SAP Conversational AI Tutorial Challenge 2021.

After I read this blog post, and with help of a previous tutorial I felt ready to at least try to build a chatbot using this knowledge. This is the result.


Business Case

A Brazilian Company named "Samba com Feijoada Inc." manufactures cavaquinhos, tamborins and some others Samba Instruments



This company, due to Covid-19, needs to avoid human contact unless it's really necessary. So, when a truck arrives at the company's parking lot, the Logistics Teams needs to know what is the freight order(SAP TM) in order to start the dispatch process.

Earlier, when truck arrives a person would do the first contact with the driver and take the truck data, that is not a option now.


Solution Design

In this scenario, Samba e Feijoada needs a ChatBot, and the tool to connect with this ChatBot will be Telegram (Popular messaging app, light, fit the need to work in almost every smartphone)

Truck Driver arrives, he/she access Telegram on his/her phone, find our Bot and text "check freight order number".

Our solution needs to verify if the Freight Order is in the correct Status, if it is, it needs to verify the deliveries status are ok, if they are, give the possibility to the driver generate a billing document request for the whole freight order (it'll make the waiting in the truck faster) or just wait.

In Brazil, we have a legal requirement to generate the billing prior to the truck leave the plant with the goods


In every case, the solution needs to inform the Logistics Team the truck arrived and the status of the freight order/Deliveries. This communication will be done through e-mail.


Solution Screenshots

This is FejucaBot

First interaction and responses(small talk)

Truck Arrival Solution Part 1

Truck Arrival "Help them"

Websites "Wait"

E-mail example (Sent to Logistics Team)


How did we build FejucaBot

First Steps

Enter SAP CAI Website and create your account or Sign On

Click on New Bot

Choose the type of Bot, FejucaBot is a Perform Actions type

Choose standard skills, FejucaBot knows Greetings, Small Talk and Weather (a real gentleman)

Give a name to your Bot, and choose the main language (you can add more languages later, so don't worry)


Choose Data Policy

Choose Bot Visibility (In this case we chose private because there is a access to a SAP S/4 Hana application, and unfortunately we cannot share it)

Then, click on Create a Bot


We will need three intents for FejucaBot. A initial one to get the Freight Order using phrases like "Check Freight Order 99999999999" or "Check 99999999999", one for Waiting and another for Generate Billing Requests

So click on +Create (Train - Intent)

Insert the phrases that will trigger your skill


Click on Build and then on Add Skill

Click on Skill Name and then in trigger, assign your intent to the skill. This means everytime someone text FejucaBot "check 9999999", SAP CAI will trigger skill Check Freight Order

Then, click on Requirements, insert the fields (Available on Intent) your skill needs, at this moment you can assign an alias.

Now, click on Actions

Fejuca Bot was build using Connect External Service(API), Edit Memory and Send Message.


Connect External Service API 1

In a single GET in CPI, we connect on a S/4 Hana 1909 Application.

First, we build a Custom CDS View for the SAP Transportation Management tables, in this API we get the Status of the document and the deliveries.

Second, in a standard API for Outbound Deliveries, we verify if these deliveries are ready to be invoiced (if needed)

Then CPI send an email to the Logistics Team informing the truck arrival, freight order and status.

Finally it sends back to SAP CAI the status and the Freight Order data.

Send Message 1

Using system variables as $freightorder $status and $address, we send a custom message for each status of Freight Order, If the freight Order does not exists, a message is sent as well.

Connect External Service API 2

After the first CPI interaction, if the status is 100% ok, we have the final destination partner for this Freight Order, then we do another Standard API for Business Partner to get the address of the final destination partner.

Send Message 2

Verify that this message will trigger two skills:

Help Them

It will trigger  a POST API on CPI(Creating the Invoice Requests) and send an email to the team.



It will trigger a simple skill as below and send an email.

It will also trigger  a POST API on CPI(with a different header parameter) and send an email to the team.


To connect to Telegram, click on Connect and then on Telegram, SAP CAI already have a good tutorial about it.


Improvement Ideas

The solution works, but it is not perfect, the good people from IT of Samba com Feijoada Inc already assemble a RoadMap

  • Verify the location of the truckdriver through GPS, to be sure he is close to the plant

  • Verify the IP Address, and provide a Wi-fi connection in the parking lot.

  • Catch the License Plate, name and ID of the driver, and later updates in the Freight Order






I would like to specially thank:

  • diego.lima3, for the CPI part of this solution.

  • phrocha28, for encouraging me.

  • Numen, the best SAP Partner I know, for providing all the tools we need to build this solution.


Also, thank you for reading! Any questions or thoughts please comment!

Labels in this area