Bixby Developer Center

References

Phone Call (bixby.phoneCall)

The bixby.phoneCall library capsule provides a way for your capsule to make phone calls, while respecting legal and privacy concerns for the user. Before placing the call, this capsule will prompt the user for confirmation. If the user agrees, it will immediately place the call.

A sample capsule demonstrating the bixby.phoneCall library is available as library-phone-call-example in the Bixby Capsule Samples Collection on GitHub.

This reference lists out several of the models available in this library capsule. Some sections contain tables listing information about those concepts or actions.

Usage

First import the capsule in your capsule-imports block.

The Phone Call library provides a structure concept, CallingInfo, that contains a phone number and a named-consumer link to the phone.MakeCall action, which are listed in the below table. (A named-consumer explicitly links a concept to an action, letting capsules refer to the action with notation similar to property projection.)

PropertyTypeKindNotes
phoneNumbercontact.PhoneNumbertext
callnamed-consumeractionlinks to MakeCall action

To use CallingInfo, your capsule should create a new CallingInfo structure that extends the library model:

structure (CallingInfo) {
extends (phone.CallingInfo)
}

Then, define a constructor action that takes a model with a phone number property and outputs a CallingInfo model, and add training examples with a CallingInfo#call goal (the named-consumer linked action).

Example

Imagine a capsule with a Business concept that includes a phoneNumber property. In a result view that displays a business's information, users should be able to say "Call this business", tap a "Call Business" conversation driver, or tap on the card to place a call to the business's phone number.

To do this, the capsule imports the latest version of bixby.phoneCall as phone, and extends the library CallingInfo structure as shown above. Then, a constructor action takes a Business model as an input and returns CallingInfo:

Action:

action (BuildCallingInfo) {
type (Constructor)
description (Use business's phone number property to create CallingInfo)
collect {
input (business) {
type (Business)
min (Required) max (One)
}
}
output (CallingInfo)
}

JavaScript implementation:

export function buildCallingInfo(input) {
const { business } = input
return { phoneNumber: business.phoneNumber }
}

Then, create a training example for placing a call. This is the Aligned NL for such an example, showing a goal of CallingInfo#call and a continuation of Business:

[g:CallingInfo#call:continue:Business] Call business

The capsule could also have a conversation driver in the result view:

conversation-driver {
template ("Call Business")
}

Also, it could define an intent in the on-click component of a card:

on-click {
intent {
goal: CallingInfo#call
value: $expr(business)
}
}

Note that the JavaScript implementation for BuildCallingInfo could just as easily have obtained the phone number from an API. This could be useful, for example, for calling a customer service number that might change depending on the user's location or specific kind of help request.

Video Tutorial: Enable Your Capsule to Make Phone Calls

The following video demonstrates how to incorporate the phoneCall library capsule so your capsule can make phone calls using the phone-call sample capsule.