Create Card
Creates a card in the chatbot interaction.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Creates a card in the chatbot interaction. Cards can play or download media, display images, or redirect to an URL address.
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
createCard --title(String) [--subtitle(String)] [--text(String)] --source(CardSource) [--url(String)] [--assetname(String)] [--action(BotCardItemActions)] [--value(String)] (CardItem)=value
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
Designer mode label | Script mode name | Required | Accepted variable types | Description |
---|---|---|---|---|
Title | title |
Required |
Text |
Text that specifies the card's title. |
Subtitle | subtitle |
Optional |
Text |
Text that specifies the card's subtitle. |
Text | text |
Optional |
Text |
Text that specifies the card's contents. |
Source Type | source |
Required |
CardSource |
Source type from which the main card's image is obtained. See the source parameter options for a list of available options. |
URL | url |
Optional |
Text |
Text containing the image URL. |
Asset | assetname |
Optional |
Text |
Image file asset. Note:The asset is loaded from the asset selector and added to the parameter via a variable generated by the Export Asset (
export )
command. |
Action | action |
Optional |
BotCardItemActions |
Action performed by the card. See the action parameter options for a list of available options. |
Value | value |
Optional |
Text |
Value that the action chosen in the Action parameter must perform. |
source
parameter options
The following table displays the options available for the source
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Asset | Asset |
Provide a local file or script's asset as a source. |
Url | Url |
Provide an URL file as an asset. |
action
parameter options
The following table displays the options available for the action
input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
Designer mode label | Script mode name | Description |
---|---|---|
Download File | DownloadFile |
Download the specified file. |
Im Back | ImBack |
No action (default) |
Open URL | OpenURL |
Opens a URL address. |
Play Audio | PlayAudio |
Plays an audio file. |
Play Video | PlayVideo |
Plays a video file. |
Post Back | PostBack |
|
Show Image | ShowImage |
Shows an image from a source file. |
Sign In | SignIn |
Output parameters
Designer mode label | Script mode name | Accepted variable types | Description |
---|---|---|---|
Card | value |
Card Item |
Returns the card generated from what was specified in the input parameters. |
Example
After creating a card titled "IBM" and other specifications, the Bot Ask Carousel (chatAskCarousel
) command is used to prompt the user to click a specific button. Thus,
it redirects to a previously configured action.
defVar --name culture --type Language
defVar --name ibmCard --type CardItem
defVar --name cardList --type List --innertype CardItem
defVar --name selectedButton --type String
defVar --name insertedPhrase --type String
createLanguage --culture "en-US" culture=value
botConnect --type "Chat" --language ${culture} --autoanswer --timeout "00:05:00"
createCard --title "IBM" --subtitle "IBM" --text "IBM test example" --source "Url" --url "https://www.ibm.com/design/language/189b4fc4d43434372d82a514fcbc19f/core_black-on-gray30.svg" --action "DownloadFile" --value "https://www.ibm.com" ibmCard=value
addButtonToCard --card ${ibmCard} --buttonAction "OpenURL" --buttonText "Click Here!" --buttonValue "https://www.ibm.com"
add --collection "${cardList}" --value "${ibmCard}"
// Definition of the question and the cards to be used.
chatAskCarousel --text "Hello! Click the card below:" --cards ${cardList} --timeout "00:05:00" insertedPhrase=value selectedButton=utterance
botDisconnect