How to connect Oracle Digital Assistant with custom component service hosted on AMCe

Oracle digital assistant

Earlier, I covered how to create a AMCe backend, how to create a oracle chat bot, then how to connect the AMCe backend with oracle chat bot here. Today, I am discussing the next step where how the BotML can make use of the AMCe backend to invoke the APIs. To do that:

  1. Go to the custom component service section of your Bots UI
  2. Make a note of api name under OecCC and ActivityApi parameters.
  3. Go to BotML as shown below and lets say we want to modify GetOpty intent to use API rather static output.
  4. Make the following changes to the BotML
  5. GetOpty:
    component: “ActivityApi”
    properties:
    name: “geting opportunities”
    transitions:
    return: “done”

    So, the ActivityApi is the CC name we created in the earlier posts. And name is the required input parameter to it to pass the value. Nothing fancy here, we are just making the call to custom component to demo it all works.

  6. Run the bot in tester and see what happens as shown in below screenshot:
  7. Bingo!!! the bot is now invoking the API hosted on AMCe. Just to remind where the message is coming from. Then if you remember you created activity.js earlier which below code:
  8. "use strict";
    module.exports = {
    metadata: () => (
    {
    "name": "ActivityApi",
    "properties": {
    "name": { "type": "string", "required": true }
    },
    "supportedActions": []
    }),
    invoke: (conversation, done) => {
    conversation.reply({ text: 'API call successful!' });
    conversation.transition();
    done();

    }};

    The bot SDK is using a simple conversation.reply and then transitioning to the next stage which is nothing in our case. The done() is necessary to indicate that the invocation is finished here.

    Hope you find it useful. In future posts we will discuss how to get actual REST data from Oracle Engagement Cloud in the API here.