SmallTalk Bot Data Adapter

SmallTalk Bot Data Adapter

SmallTalk Bot Data Adapter

Asset Version: 1.0
  • Version 1.0
Last Published: Apr 20, 2017 By: Kony Team
15 0 0 2
Create a chat buddy in your application using this API.ai connector. Your users will never be lonely again. Happy Chatting!

Requirements

  • MobileFabric
 

Features

  • Quickly create chatbot in your application
  • Intelligent to converse small talks with your users
  • Builds connection with api.ai Small Talk Agent
  • Easy to make API calls and view responses

Prerequisites

  • Kony Account
  • Kony MobileFabric 7.3

Small Talk is a data adapter that helps you rapidly build mobile apps with conversational interface. A mobile app integrated with the Small Talk data adapter is intelligent enough to understand user queries and answer as a real person. The Small Talk data adapter makes use of the capabilities of API.AI Small Talk Agent.

API.AI Small Talk is a pre built agent developed with a set of basic questions and answers. You can customize the agent's responses to fit into your use case. For more information, refer API.AI Small Talk and API.AI Prebuilt Agents.

Here is a use case that describes the use of the Small Talk data adapter.

Use Case

Consider a case that you want to develop a chatbot for your e-commerce mobile app. The chatbot should be able to greet users, ask users to provide their details, such as name, phone number, interested products, and so on, and try to answer basic questions asked by the users. You can use the Small Talk data adapter to fulfill your requirement. The Small Talk data adapter is easy to integrate into your mobile app and is intelligent to converse small talks with your users.

The following sections help you use the Small Talk data adapter:

Prerequisites

Before you start using the Small Talk data adapter, ensure you have the following:

  1. Client access token and developer access token
  2. A Kony account
  3. Kony MobileFabric 7.3.

Importing the SmallTalk Data Adapter

You can import Small Talk into MobileFabric directly from Kony Marketplace or by importing the data adapter zip file.

To import the data adapter from Marketplace, do the following:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Customer Data Adapters tab. The Custom Data Adapter page appears.
  4. Click Import. The Import Data Adapter dialog appears.
  5. Click IMPORT FROM KONY MARKETPLACE. The Import Data Adapter from Kony Marketplace dialog appears with a list of available data adapters.
  6. Find and select the SmallTalk data adapter, and click IMPORT. The SmallTalk Bot data adapter is listed on the Custom Data Adapters page.

To import the data adapter zip file, do the following:

  1. Perform steps 1 to 4 in the above procedure.
  2. Drag the data adapter zip file into the Drag a Data Adapter box.

    Alternatively, click browse. The Open dialog appears.

    Navigate to the location where you downloaded the data adapter (zip file) on your computer, select the component, and click Open. The Import Data Adapter dialog shows the selected component.

    Note:

    If the selected data adapter zip file is not the one that you want to import, click Remove.

  3. Click Import. The SmallTalk Bot data adapter is listed on the Custom Data Adapters page.

Creating an Integration Service with SmallTalk Bot

After you import Small Talk into MobileFabric, you must create an integration service with service type as SmallTalk Bot to connect with your API.AI Webhook.

To create an integration service with SmallTalk Bot, do the following:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. Click CONFIGURE NEW. The Service Definition tab opens.
  5. In the Name box, type a unique name for your service.
  6. From the Service Type list, select SmallTalk Bot.
    Note:

    The SmallTalk Bot is listed only after you import the Small Talk data adapter into MobileFabric.

  7. Click Save.

If the details provided are valid, the MobileFabric service connects to the API.AI Small Talk Agent and allows you to make the API calls.

Refer to Integration Services for more information on creating and using integration services.

Creating an Operation

To make any API call in the MobileFabric console, you must create an operation for the respective API and then execute the operation. Executing an operation involves making the API call and displaying the response. For more information, see Executing an Operation.

Steps to create an operation for the get API:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration page appears with a list of existing integration services.
  4. From the list of integration services, select the integration service that you have created with service type as SmallTalk Bot. The Service Definition tab of the selected integration service opens by default.
  5. Click the Operations List tab. The Operations List tab opens.
  6. Click the context menu arrow to expand the Please Select list. The SmallTalk Bot is displayed.
  7. Click the plus icon to expand the SmallTalk Bot list.
  8. Click the plus icon to expand the Services list, and select get/query.
  9. Click ADD OPERATION. The get_query operation is listed in the Configured Operations section.
Note:

You can follow the above steps to create operations for the post API.

You can create the operations with required APIs and save them in the Configured Operations section. You can then execute the operations when ever required.

Executing an Operation

Executing an operation involves making the API call by setting the necessary parameters and displaying the response. The procedure to execute any operation is same, but the request parameters of the APIs vary.

This section provides steps to execute the get_query. (explained in Creating an Operation).

Steps to execute the get_query operation:

  1. Log on to your Kony account. The Dashboard page appears by default.
  2. In the left pane, click the API Management menu. The APIs tab opens by default.
  3. Click the Integration tab. The Integration tab opens with a list of existing integration services.
  4. From the list of integration services, select the integration service that you have created with service type as SmallTalk Bot. The Service Definition tab of the selected integration service opens by default.
  5. Click the Operations List tab.
  6. Under the Configured Operations section, click the get_query operation. The get_query tab opens with the Request Input sub-tab and Body section opened by default.
  7. In the Name box, the name of the operation is displayed by default. If you want, you can change the name.
  8. On the Request Input tab, in the Body section, for the following parameters, specify the values in the respective boxes under the Test Value column.
    • v: Specify the version in the YYYYMMDD format. For example, 20150910. Specify the value from June 1, 2015. For more information, refer API.AI Versioning.
    • query: Specify a query as string. For example, How are you?.
    • lang: Specify the language tag. For example, "en" is the tag for English language.
    • sessionId: Specify a string token to mange the session parameters.
  9. Click Header. The Header section opens.
  10. Click Add Parameter. A new row adds to provide parameter values.
  11. In the box under the NAME column, type Authorization.
  12. In the boxes under the TEST VALUE and DEFAULT VALUE columns, type the developer access token generated when you created an app in API.AI.
  13. Click SAVE OPERATION.
  14. Click the Test tab, and then click SAVE AND FETCH RESPONSE. The Output Result dialog appears with a response.

You can follow the above steps to execute the post_query operation, but the request parameters of the post API vary. The following is the list of parameters that you must specify for the post_query operation.

  • v: Specify the version in the YYYYMMDD format. For example, 20150910. Specify the value from June 1, 2015.
  • query: Specify array of queries. For example, [Who are you?, How are you?].
  • lang: Specify the language tag. For example, "en" is the tag for English language.
  • sessionId: Specify a string token to mange the session parameters.
  • contexts: Specify the array of context objects.
  • timezone: Optional parameter. Specify the time zone from the IANA time zone database.