Amazon Alexa - Orocommerce connector: How Dn'D created a new and intelligent assistant for BtoB ecommerce

At OroVibe, the last event for the ecommerce community and the solutions from the Oro eco-system, we, at Dn'D Agency, unveiled a connector between Amazon Alexa (the intelligent personal assistant developed by Amazon) and OroCommerce (the brand new Open Source ecommerce solution for BtoB).

As a next generation intelligent connected object, Alexa is capable of having multiple voice-based interactions, reading audiobooks, performing task lists, and providing a never-ending list of information in real time.

Following the discovery of Alexa by our teams several months ago and considering their expertise on the new ecommerce B2B solution, we decided to try and connect Alexa to the OroCommerce back-office in order to recover, via voice commands, all the management information useful for the OroCommerce users. Thus, we extended its API in order to obtain the following information:

  • The total income

  • The income since a specific date, and on a specific store

  • The total income on a specific store

  • The best selling product

  • The most sold product since a specific date, and on a specific store

  • The most sold product on a specific store

  • The total average basket

  • The average basket since a specific date, and on a specific store

  • The current orders

From a technical standpoint, the most complex step was to connect Alexa to the OroCommerce platform. Indeed, the NodeJS libraries allowing the authentication to the API, through WSSE, did not work as planned. So we had to try and find a solution. We resolved the issue by creating a script for OroCommerce that could generate the WSSE key, via the OroCommerce native functionalities. This same file is secured by HTTP authentication (usually configured in .htaccess and .htpasswd files if you use Apache), soon to be replaced by an OAuth2 authentication, in the future versions of Oro.

For the NodeJS:

As you can see, the WSSE header generation script is called during each request.

On the Alexa front, it was crucial for us to learn how to build an ergonomic vocal interface. Thus, we had to think in advance about every possible way a user would express a command.

Regarding the code in itself, it is a NodeJs, hosted on AWS Lambda Function. The big upside with AWS Lambda is that it natively provides the SDK. The big upside with AWS is that it encompasses the SDK. But it is also possible to download it to code in local mode, and then export it to a dedicated machine. By the way, if you've been wondering if a Raspberry Pi can also support the Alexa app, the answer is "yes".

But getting back on the AWS track, after all this, you have to go on, and you'll find everything you need to create the app:

  • The steps to add the main informations,

  • The steps to add Alexa's main commands,

  • The configuration that connects AWS Lambda to the Alexa app,

  • "Test", to check the consistency between the sentences for the queries and their answers, or to check Alexa's speech,

  • "Publishing Information", that lists all the information needed for a publication of your app on the Alexa store,

  • "Privacy & Compliance", to inform your potential users on the subject of personnel data collection,

  • … Etc.

There is also the interface that allows you to:

  • Connect Alexa to the wifi,

  • Install applications from the Alexa store,

  • Consult its history of comprehension of the different requests that can be made. This history allows to adjust the sentences defined in order to improve the phonetic recognition based on phonetics.

When Alexa responds thanks to the speech synthesizer, it is possible to order it to use a desired pronunciation. Alexa follows the Speech Synthesis Markup Language (SSML) syntax. This makes it possible to modify its pronunciation. It is possible in particular to adjust its spelling, or speed of speech. To do this, simply go to the "Test">"Voice Simulator" tab.

To debug, you must use the Amazon Lambda function: Action> Configure a test item. Then, in this text field, paste the result of "Service Request" from the "Service Simulator" of

Test results:

I hope that you enjoyed this blog post, and that it helped you learn new things about the endless possibilities of Alexa, and OroCommerce.

The source code for the Dn'D app is available on our Github, and is compatible with all versions of OroCommerce, starting from the 1.0 version.

If you need any information, or want to comment, write a review below, tweet, or send us an email at ;)