Who is Alexa?
To put it simply, Alexa is the artificial intelligence voice assistant for Amazon devices such as the Amazon Echo speaker or Amazon's Fire TV - kind of like Siri for Apple devices such as your iPhone and iPad.
You can verbally instruct Alexa to perform functions such as playing music, answering your questions, and controlling smart home devices such as your lights, fans, and thermostats.
Since it's built in the cloud, Alexa is always gathering more information and becoming smarter. Over time, it adapts to your speech patterns and personal preferences.
In fact, Alexa may even be smarter than Siri, since she is able to store data about you for longer.
How does Alexa come into play with SAP Business One?
Last year, SAP's Solution Architects team developed a prototype of an integration between SAP Business One and Amazon Echo, named B1 Assistant. The integration allows Alexa to give SAP Business One a voice, letting you free your keyboard up for other tasks. *Please note that this is not currently a core function of SAP Business One, and so will not receive any support or warranty.
Using B1 Assistant
Every command you give Alexa with relation to SAP Business One should start with, "Alexa, Open B1", or "Alexa, Ask B1". This will activate the B1 Assistant and allow you to issue commands with relation to SAP Business One.
Things you can ask Alexa include:
- What are my top 5 best selling products?
- What are my sales on Electronics this quarter?
- How is my business doing?
- How did my Sales Pipeline do last quarter?
- How is my best selling product doing on social media?
- Ask B1 for social media updates.
- Read me some positive/negative tweets about (product).
- Ask B1 to read me some positive tweets.
The B1 Assistant will perform a sentiment analysis of tweets with your predefined product hashtag, and respond with the number of positive or negative tweets, or read tweets as requested by you.
You can also have conversations with Alexa.
For example, you can tell Alexa,
"I need sales reports".
She will ask you which item group you want the report for, for which quarter, and for which year. Respond with the parameters you need data on, and Alexa will give you the sales figure for that item group and time period.
Alexa can even make recommendations on purchases based on your purchase history.
"What do you have for me?"
Alexa will start listing products she thinks you may want to (re)purchase, and ask you if you would like to place an order. You should respond "yes" or "no" to each of these questions accordingly.
You can even say, for example,
"I need office supplies."
Alexa will suggest products in this category, such as printer ink, printing paper, and so on.
You can respond with the item in her list of suggestions that you want to purchase (e.g. printer ink), and Alexa will ask you how many you would like to purchase. She may then also make a recommendation on complementary items that are often purchased together with the item of your choice.
For either scenario, if you ask Alexa to make the purchase, she will place the order as instructed, and generate the corresponding document(s) involved.
Things you will need
- An Amazon Developer account
- An Amazon Web Services account
- SAP Business One version 9.2 for HANA, PL04
- (03 will also work, with limited features. Alexa will not be able to make predictions and product recommendations for you.)
- SBODEMOUS schema
- (to work with a different schema, you must adapt all models and procedures).
- An Amazon Echo speaker
- (not compulsory right now - if you don't want to commit to purchasing it at the moment, you can test out B1 Assistant's capabilities on the Amazon Echo Simulator site.)
1. Deploy the B1 Assistant HANA App
You can do either of the following:
- Import the B1 Assistant Application delivery unit into your HANA system
- Clone the code directly from GitHub, and create your own XS project
Whichever option you choose, perform the following step once you have the B1 Assistant package in your HANA system.
Go to your HANA Administration Tools dashboard* and set a username and password for B1 Assistant**. Alexa will use this newly created user to retrieve data and respond to your queries.
**(file: b1Assistant > lib > annonuser.xssqlcc)
You can also access the B1 Assistant Tester* to test your app from the back-end.
2. Create the B1 Assistant Lambda function
Your next step is to activate a Lambda function in Amazon Web Services, so that you can call services within B1 Assistant (e.g. Have Alexa create invoices and item recommendations for you)
Log in to your Amazon Web Services account, change your selected region to Ireland or North Virginia, and select Lambda under Services.
Click on "Get Started Now".
You can now create a new Lambda function, starting with selecting your blueprint. Search for "Alexa", and select the option "alexa-skills-kit-color-expert".
Your next step is to configure triggers related to your function. Select Alexa Skills Kit.
Next, you need to configure your function. Give it a name (b1Assistant) and copy the code in b1Assistant.js from GitHub into the Lambda function code box.
Replace 'YOUR HANA IP Adress’ (sic) with your HANA Server public IP address.
Further down on the same page, fill in the rest of the fields as seen in the screenshot below. The 15 second timeout will let you avoid issues when the B1 Service Layer takes a while to respond.
After you review your settings and create your function, follow the steps in the screenshot below and copy your function's ARN address to a text file so that you can find it later.
3. Set Alexa up for B1 Assistant
Log in to your Amazon Developer site and select ALEXA from the top menu.
Get started with a new Alexa Skills Kit.
Click on Add a New Skill.
Set your Skill Name and Invocation name as seen in the screenshot below (B1 Assistant and be one, respectively) and click Next.
On the next window you should fill the Intent Schema, Custom Slot Types and Sample Utterances (copy each code snippet from GitHub).
Save and proceed to the next step. Set your Alexa skill to the region specified for your Lambda function (Europe if you selected Ireland, and North America if you selected North Virginia).
In your next step, you can start testing your skill to check that it has been set up correctly.
You should now have successfully set up your B1 Assistant. Test it with your Amazon Echo by enabling the skill on your Alexa app, or use the Amazon Echo Simulator.
Watch B1 Assistant in action:
We hope you found this post useful! Special thanks to Yatsea Li and Ralph Oliveira of SAP for the content in this post.
All screenshots, code, and video in this post belong to SAP.
For more useful guides, tips, as well as SME and SAP news, subscribe below.
Feel free to contact us for a free consultation or demo of SAP Business One today.