Connect Your SAP Conversational AI Chatbot To Amazon Alexa
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.
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!
Nice blog! Can you help me with one question? If I want to actually use the skill in a Echo device I need to submit the skill for certification. When doing this the certification tests ask to fix some issues related to securing the end-point, for example:
"The skill end-point is not validating the signatures for incoming requests and is accepting requests with an empty signature URL."
Without this they wont allow me to publish the custom skill and use it on my device. Is there any way to fix this?
Thanks and regards!
I have followed the exact steps and I'm facing difficulty in deploying the application as skill in Alexa.
The deployment is taking hours and there is no message of successful deployment.
Is this an issue?
But i can see the skill listed in the Alexa console but when I go inside the skill and click on test tab and I'm getting an issue "Test is disabled for this skill."
Is there any configuration needs to be done before going to test tab?
Your response is much appreciated.
I have successfully connected my SAP CAI Chatbot with Amoazon Alexa but it fails to understand my intent's expression and it only trigger back the greetings skills only and for rest of the skills did not behave like what i am expected.
Please give me a suggestion what's wrong with my SAP CAI Bot.
Thanks in advance.
I followed all the steps but when I start testing,I get the following message:
can you tell me what the problem might be?
Thanks in advance for your answer!
Even I am also facing the same issue. All steps completed but when I test, it is displaying the same message.
I have CONVERSATION_START intent as well.
Great Blog! I have used SAP CAI with both Alexa and Google Assistant. I would like to know when we deploy SAP CAI bot using Alexa channel, how is the pricing done ? Would Alexa also charge for chats along with SAP CAI ?