Bixby Developer Center

Guides
References

type

optionalvalue optional

Specifies the action type. When choosing an action type, select the narrowest possible value. The available types and examples of each are listed below.

Examples

Calculation

An isolated computation on the inputs guaranteed to return a result.

action (RollDice) {
collect{
input (numDice) {
type (NumDiceConcept)
min (Required)
max (One)
}

input (numSides) {
type (NumSidesConcept)
min (Required)
max (One)
}
}
output (RollResultConcept)
type (Calculation)
}

View on GitHub

Constructor

An isolated construction of the output using only the provided inputs.

action (GetQuantity) {
type (Constructor)
collect {
input (quantity) {
type(Quantity)
min(Required)
max(One)
plan-behavior (Never)
prompt-behavior (AlwaysElicitation)
}
}
output (PromptedQuantity) {
evaluate { $expr(quantity) }
}
}

View on GitHub

Fetch

A simple retrieval of additional data directly related to an input.

action (FetchMovieCredits) {
description ("Fetch movie credits lazily from a secondary endpoint")
type (Fetch)
collect {
input (movie) {
type (Movie)
min (Required)
max (One)
}
}
output (core.Text)
}

View on GitHub

Search

A search for related data using the inputs as constraints.

action (FindShoe) {
type (Search)
collect {
input (name) {
type (Name)
min (Optional)
}
input (type) {
type (Type)
min (Optional)
}
input (minPrice) {
type (money.MinPrice)
min (Optional)
max (One)
}
input (maxPrice) {
type (money.MaxPrice)
min (Optional)
max (One)
}
}
output (Shoe)
}

View on GitHub

BeginTransaction

Outputs a concept in a transaction.

action (CreateOrder) {
type (BeginTransaction)
collect {
input (initialItems) {
type (InitialItems)
min (Required)
max (One)
default-init {
intent: goal: CreateItems
}
}
}
output (Order)
}

View on GitHub

UpdateTransaction

Update a concept in transaction. The output is a concept in a transaction and should also appear as an input to the action.

action (UpdateOrder) {
type (UpdateTransaction)
collect {
//the order that is updated
input (order) {
type (Order)
min (Required)
}
input-group (updates){
requires (OneOrMoreOf)
collect {
input (addedItems) {
type (AddedItems)
min (Optional)
max (One)
}
input (changedItems) {
type (ChangedItems)
min (Optional)
max (One)
}
input (removedItems) {
type (RemovedItems)
min (Optional)
max (One)
}
}
}
}
//returns the updated order
output (Order) {
throws {

error(NoItems) {
on-catch {
halt {
dialog {
template-macro (NoItemsInCart)
}
}
}
}
}
}
}

View on GitHub

CancelTransaction

Aborts a concept in a transaction. The transaction concept should appear as an input to the action.

action (CancelOrder) {
type (CancelTransaction)
collect {
input (order) {
type (Order)
min (Optional)
validate {
if (!exists(order)) {
halt {
dialog {
template ("Okay.")
}
}
}
}
}
}
output (Receipt)
}

View on GitHub

Commit

Finalize a concept in a transaction. The transaction concept should appear as an input to the action.

action (CommitOrder) {
type (Commit)
collect {
input (order) {
type (Order)
min (Required)
}
}

confirm {
by (core.Confirmation)
}

output (Receipt)
}

View on GitHub

RefreshActivity

Refresh a concept in an activity. The action's output is a concept in an activity and should also appear as one of the inputs.

action (CheckStatus) {
type (RefreshActivity)
collect {
input (receipt) {
type (Receipt)
min (Required)
default-init {
intent {
goal: FindLastReceipt
}
}
}
}
output (Receipt)
}

View on GitHub

UpdateActivity

Updates a concept in an activity. The action's output is a concept in an activity and should also appear as one of the inputs.

CancelActivity

Aborts a concept in an activity. The action's output is a concept in an activity and should also appear as one of the inputs.

action (CancelCommittedOrder) {

type (CancelActivity)

confirm {
by (core.Confirmation)
}

collect {
input(receipt){
type(Receipt)
min (Optional)

default-init {
intent {
goal: FindLastReceipt
}
}

validate {
if (!exists(receipt)) {
halt {
dialog {
template("Not sure what to cancel. I didn't find any recent shirt orders.")
}
}
}
if (exists(receipt) && receipt.orderState != 'Ordered') {
halt {
dialog{
template("This order is already #{value (receipt.orderState)}!")
}
}
}
}
}
}

output(Receipt)
}

View on GitHub

ArchiveLookup

An action that leverages the Transactions API with no side effects on external systems.

action (FindLastReceipt) {
output (Receipt)
type (ArchiveLookup)
}

View on GitHub

Here is the corresponding JavaScript file that uses the transaction API:

var transaction = require('transaction')
// FindLastReceipt
exports.function = function() {
//look up last receipt from viv cloud
return transaction.retrieve("example.shirt.Receipt", "ALL", 1)
}

View on GitHub