slang_bfsi_assistant 2.0.2 copy "slang_bfsi_assistant: ^2.0.2" to clipboard
slang_bfsi_assistant: ^2.0.2 copied to clipboard

PlatformAndroid

The client library for adding and interacting with Slang CONVA's BFSI In-App Voice Assistant.

Slang BFSI Assistant #

Install the Slang BFSI Assistant package #

Run the below command to install the required packages inside your code repo.

flutter pub add slang_retail_assistant

Once done, run the command 'dart pub get' and ensure Slang assistant is added to the dependencies.

dependencies:
  slang_bfsi_assistant: ^2.0.2

Code Integration #

Initialization #

The next step is to initialize the SDK with the keys you obtained after creating the Assistant in the Slang console.

NOTE This should ideally be done inside the main method.

import 'package:slang_bfsi_assistant/slang_bfsi_assistant.dart';

//Obtain the AssistantId and APIKey for the given assistant
var assistantConfig = AssistantConfiguration()
    ..assistantId = "<AssistantId>"
    ..apiKey = "<APIKey>";

//Initialize the SDK using the configurations specified above
SlangBFSIAssistant.initialize(assistantConfig);

NOTE Before releasing the app to public, make sure the environment variable is set to production. default is set to stage

var assistantConfig = AssistantConfiguration()
    ..assistantId = "<AssistantId>"
    ..apiKey = "<APIKey>"
    ..environment = AssistantEnvironment.production //Set this to .production

Show the Trigger (microphone icon) #

NOTE One can call "show" and "hide" methods as required to control the visibility of the Assistant

SlangBFSIAssistant.getUI().showTrigger() // There is a corresponding hideTrigger too if needed

NOTE The trigger is sticky, which means that it will show up on all Activities after it is made visible. To prevent the trigger from showing up on specific activities, you will need to call: SlangBFSIAssistant.getUI().hideTrigger()

Implement Actions #

Last but not the least, the app needs to implement the Actions associated with the various User Journeys supported by the Assistant. This can be done as shown below

SlangBFSIAssistant.setOnStockSearchListener(
    (stockInfo, searchUserJourney) => {

        //Use stockInfo to perform the stock search operation.
        print(stockInfo.name),
        print(stockInfo.bseCode),
        print(stockInfo.nseCode),
        print(stockInfo.isinNumber),
        print(stockInfo.customId),
        print(stockInfo.action),
        print(stockInfo.utterance),

});

The OnStockSearchListener callback #

(stockInfo, searchUserJourney)

Sample Utterances that could trigger the transaction Info #

  1. "Show me TCS Stock"
  2. "Show me Infosys Stock"

StockInfo Parameter #

The StockInfo contains the breakdown of the original stock search request. Its structure is as described below:

// When the user searches for something like 
// Show me TCS Stock
// This is how the StockInfo parameter would be populated
{
   "name": "Tata Consultancy Services Limited"
   "bseCode": "TCS",
   "nseCode": "TCS",
   "isinNumber": "INE467B01029",
   "customId": "CustomID001",
   "action": "search",
   "utterance": "Show me TCS Stock"
}

NOTE

Action includes :

  1. "search"
  2. "buy"
  3. "sell"
1
likes
130
points
2
downloads

Publisher

unverified uploader

Weekly Downloads

The client library for adding and interacting with Slang CONVA's BFSI In-App Voice Assistant.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on slang_bfsi_assistant

Packages that implement slang_bfsi_assistant