Overview

The Dialogue powers provide the ability to return a tag object in a dialogue (chat) response in the Andi window. This power can only be used in conjunction with the fileAttachment power to return a stored data file to the user. This article covers composing and returning a tag as part of a dialogue.

In this Article

 

What are the Dialogue Powers

The Dialogue powers are accessible via the dialogue property of the Andi powers.

skillContext.powers.andi.dialogue

There are two types of Dialogue powers: composeDialogueTag and sendDialogueResponseWithTags.

composeDialogueTag

The composeDialogueTag power is similar to the field tag powers and is used to compose the tag message. It is stored as an object of the type ITag to be used as a parameter in the sendDialogueResponseWithTags power. More than one dialogue tag can be composed. The tag consists of the following shape:

skillContext.powers.andi.dialogue.composeDialogueTag(
name,
tagType,
text,
onClick,
customIcon?
)

name

The name parameter, which is a required parameter entered as a string, is a unique value used to identify the field tag when it runs in the application.

"provide-latest-exception-approval-contact-list"

tagType

The tagType parameter, which is a required parameter, is where you will indicate the tag type, which will determine the color of the tag displayed in the window. Click here for definitions and colors of the available tag types. You will indicate the type using

andiSkills.FieldTagTypes.typeNameSelectionHere

Available options that will display when using this power are:

  • Info
  • Warning
  • ValueForTarget

text

The text parameter, which is a required parameter entered as a string or predefined variable (recommended and further recommended to define the variable using skill configurations), is where you will enter the message that will display in the field tag. This parameter cannot be left blank.

Click here to view the individuals to contact for an exception request.

onClick

The onClick parameter, which is a required parameter, indicates the command to invoke when the tag is clicked. Since this power is used in conjunction with the fileAttachment power, which will allow the user to download a csv file, the following command name and argument will be entered as an object in an array:

[{ name: downloadConversationFileAttachment, args: [response.fileId]}]

customIcon?

customIcon is an optional parameter, that if defined, allows you to display an icon that represents your organization next to the field tag message.

  • If an icon has not been uploaded to the Andi® Skill Manager for your organization or to upload an icon representing a different organziation, then you will need to provide the icon url for an svg file.
  • If an icon has been uploaded to the Andi® Skill Manager for your organization (for which the icon will appear by default) or you do not want to include an icon (if one has not been uploaded), then you can choose to either enter a value of 'null' or skip entry of any parameter.

 

sendDialogueResponseWithTags

The sendDialogueResponseWithTags power is similar to the sendFieldTags power and is used to compose the tag message. More than one tag can be returned as part of this power. It consists of the following shape:

skillContext.powers.andi.dialogue.sendDialogueResponseWithTags(
message,
tags
)

name

The message parameter, which is a required parameter entered as a string, is the text that will be displayed as the header for the message that will return. It acts similar to the headerText in the section parameter of a field tag.

"Exception Approval Contacts"

tags

The tags parameter, which is a required parameter, is entered as an array of elements that will be returned when the skill executes. It's recommended to store 

[exceptionApprovalContactMessage]

 

How to use the dialogue powers

In conjunction with the fileAttachment power, the dialogue powers would be used as follows in the run.ts file of a chat skill to return an attachment to a user to download in the application as part of a dialogue:

const csv = skillContext.powers.andi.storage.currentSkill
.getCSVFileOf("exceptioncontacts.csv") return skillContext.powers.andi.fileAttachments.conversation .storeCsvFileForCurrentUser(csv) .then((response) => { const exceptionApprovalContactMessage = skillContext.powers.andi
.dialogue.composeDialogueTag( "provide-latest-exception-approval-contact-list", FieldTagTypes.Info, "Click here to view the individuals to contact for an exception request.", [ { name: "downloadConversationFileAttachment", args: [response.fileId] } ] ) return skillContext.powers.andi.dialogue.sendDialogueResponseWithTags("Exception Approval Contacts", [exceptionApprovalContactMessage]) });
Was this article helpful?
0 out of 0 found this helpful