Start building your own chatbot now

More and more chatbots are being created every day, basically covering every automatable use case. Most of these chatbots are textual, we can interact with them on Messenger, SMS, website chat, etc. They’re very accessible and easy to use, but I’m sure you’d love to be able to speak to them, as well as write to them.

Sometimes, speaking is the most natural and easiest way to interact, say when you’re at home cooking or reading. I’ve got some news for you: you can build your own Alexa bot backed by SAP Conversational AI! We made this integration very easy, so let’s dive in, step-by-step.

1/ Create your bot

For the purpose of this Alexa integration with SAP Conversational AI we’ll make it easy and use one of our previously created bots: the “joke bot”. This bot simply returns some random good jokes when you ask!
You can see the complete tutorial in this blog post.
Once you’ve created your bot and you’re happy with it, return here and we’ll go to Step 2.

2/ Add a dedicated intent and skill

As we’ll see later, your Amazon Skill will be triggered by using an “invocation” (a.k.a a “keyword”). Using this invocation will start the bot and tell Alexa to go to SAP Conversational AI to handle the conversation. Then, we have to tell your bot how to properly react when the user uses the invocation. If not, your Alexa skill will still work, but it won’t know what to answer and will ask for the Fallback skill, which can be very disappointing for the user.

For that, we’ll create an intent and a skill (or, in this particular case, modify an existing skill).

a/ Go to the Train tab and click +CREATE. I chose to name my intent conversation-start, but you can choose whatever you want.
In this intent, we’ll add a single expression: CONVERSATION_START. This time, don’t use anything but this specific expression. This expression is what Alexa considers the beginning of the conversation with your bot, once you’ve called the “invocation”.

b/ You can create a specific skill to handle the answer of the CONVERSATION_START trigger, but I chose something simpler: the Greetings skill that you already have in your joke bot. The result is that Alexa will answer with a greeting message when using your invocation: “Start funny bot” > “Hello :)”.

On your Build tab, choose the skill Greetings, and go to the Trigger tab. Add a condition with an OR boolean and simply choose “if @conversation-start is present”.

Once you’ve done that, go to the Actions tab and add a condition to the first action, with an OR boolean, and again type “if @conversation-start is present”.
With that done, your bot will use the Greetings when prompting the invocation, as if you were simply greeting it.

This is the only modification you’ll have to do to make your bot Alexa-compatible.

3/ Create an Amazon Alexa developer account

If you already have an Amazon Alexa developer account, nothing more to do! Just log in.
If not, go to https://developer.amazon.com/alexa/console/ask? and create one. It’s completely free!

Once you’ve created an account, don’t create a skill though the Amazon platform. We handle it for you through your bot’s Connect tab.

4/ Authorize Amazon to connect to your SAP Conversational AI

Go to the Connect tab of your bot and click Amazon Alexa. Go to Step 6 (under Amazon Alexa on the Connect tab) and click LOGIN WITH AMAZON. Once you’ve done that, you won’t have to go back to this action.

5/ Choose an invocation name and generate your Alexa Skill

We’re almost done!
Under Amazon Alexa on the Connect tab, stay on Step 6 and choose a name for your Alexa skill. Feel free to personalize it.

Choose an invocation name. As I was previously saying, this is the “magic” word which will make Alexa switch to your SAP Conversational AI bot. I chose funnybot. Note that you can change it later, so don’t worry if you made a mistake!
Once you’ve chosen an invocation name, click the CREATE CHANNEL button and wait. The system will take a few seconds to reload and then the Vendor and Locales lists will be available.

Choose the unique option in the Vendor list and choose US in the Locales list. Then click DEPLOY SKILL TO AMAZON ALEXA.

There we are! Connection’s done!

6/ Test you skill on Alexa.

Go to your Amazon Alexa dev page (https://developer.amazon.com/alexa/console/ask) and refresh the page. Your skill will now appear! Click on your skill’s name and go to the Test tab.

In the Skill testing is enabled in: field at the top left, choose Development to enable the testing window.

Time to test!

Try prompting “Start funnybot”. The skill will answer with a greeting answer. Once you’ve done that, you can follow your conversation as if you were using your bot in another context (test chat, webchat, Messenger, etc.). Type “Can you tell me a joke?” and see what happens!

 

Of course, you can mix both messages and directly ask Alexa “Ask funnybot to tell me a joke”. Again, the most important thing is having the invocation keyword in your sentence.

If you change something in your bot, you don’t have to “rebuild” your Alexa connection. Just refresh the Test page and start a new conversation. Don’t forget to use your invocation before any questions to your bot.

Next steps

Congrats! You now have a talking Alexa chatbot, backed by SAP Conversational AI. 

When you’re ready for production and to make your skill available to every Alexa owner, follow the instructions on your Amazon Alexa dev page, on the Distribution tab.

That’s it, you know everything! Enjoy experimenting and remember you’re very welcome to contact us if you need help, through the comment section below, via Slack, or using our dedicated tag on StackOverflow.

If you’re looking for another tutorial, try to build a chatbot integrated with Slack to search for restaurants on Yelp!

Want to build your own conversational bot? Get started with SAP Conversational AI !

Follow us on
  • Oliver

    Is there are also a german communication between the alexa and CAI possible? Even when I select “DE” in Locales, the communication between Alexa and CAI is only recognized as english. Thanks for feedback.

  • Axel

    Hi Sebastien,

    The connection and deployment to amazon alexa is working fine for the first time (initial connection with locals “DE”).
    Unfortunately, If I like to re-deploy my bot I’m receiving the following error message: “Error loading available vendors”.
    Do you know what it means?
    Thanks,
    Kind regards
    Axel

  • avantika jain

    Thanks for sharing the great info. Chatbots have many benefits. Know the benefits of using chatbots in the business like e-commerce and in marketplaces hope to receive more advanced articles on the same

    • Sebastien Beghelli

      Thanks for your feedback. We have a great article about Conversational Commerce in the pipeline, keep an eye on the blog!

This site uses Akismet to reduce spam. Learn how your comment data is processed.