Initiating a phone call

Viewed 1530

Is it possible yet to initiate a phone call? E.g. if I'm making a branch finder action a dialogue might go like:

"Hi, where's my nearest store?"
"Your nearest store is our Oxford Street branch, at 300 Oxford St, Marylebone."
"Call it"
"Sure"

It then initiates a call to the store, like an Android app using an ACTION_DIAL intent.

I would think something like this should be possible, especially considering the current devices supporting Assistant are phones and Google Home, both of which can make calls (I guess future devices with assistant built in might not, but then there can be a check like app.phoneCapabilities). I've tried using .addSuggestionLink with a tel: address with no luck.

3 Answers

You can show a call button which will redirect to the specified number on the dialer app.

Here's a way to do that from fulfillment response:

"buttons": [
   {
    "title": "Call",
    "openUrlAction": {
        "url": "tel:+91123456789",
        "androidApp": {
            "packageName": "com.android.phone"
        },
        "versions": []
    }
  }
]

Add this JSON to your response and it will show a button which will redirect to default call app and shows +91123456789 number filled.

EXTRA

Similarly, if you want to send mail then you can add:

{
    "title": "Send Mail to Jay",
    "openUrlAction": {
        "url": "mailto:Jp9573@gmail.com",
        "androidApp": {
            "packageName": "android.intent.extra.EMAIL"
        },
        "versions": []
    }
}
Related