Issue in make a phone call within Google Assistant App

只愿长相守 提交于 2020-04-07 08:08:12

问题


I try to implement button in basic card i got an error

API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: "(expected_inputs[0].input_prompt.rich_initial_prompt.items[1].basic_card.buttons[0].open_url_action) versions: Cannot find field." HTTP Status Code: 200.

 conv.ask(new BasicCard({
    text: `This is a basic card.  Text in a basic card can include "quotes" and`,
    subtitle: 'This is a subtitle',

    buttons: [
     {
      "title": "Call",
      "openUrlAction": {
          "url": "tel:+91123456789",
          "androidApp": {
              "packageName": "com.android.phone"
          },
          "versions": []
       }
    },
   ],
    "formattedText": "Some text",
    image: new Image({
      url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
      alt: 'Image alternate text',
    }),
    "title": "Card Title"
  }));

and I tried all the ways add another empty object in button array also same error:

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

Tried code below got error:

expected_inputs[0].input_prompt.rich_initial_prompt.items[1].basic_card.buttons[0].open_url_action: the protocol must be http or https.

buttons: new Button({
      "title": "button text",
      'url': "tel:+91123456789",
      "androidApp": {
        "packageName": "com.android.phone"
      }
})

got response in action console simulator:

"buttons": [
                  {
                    "title": "button text",
                    "openUrlAction": {
                      "url": "tel:+919177723773"
                    }
                  }
           ]

回答1:


You cannot open a tel: URL through the Assistant.

As the error noted:

expected_inputs[0].input_prompt.rich_initial_prompt.items[1].basic_card.buttons[0].open_url_action: the protocol must be http or https.

Keep in mind that the Assistant runs on devices that do not support tel: URLs, even if they support https: URLs.




回答2:


The URL property that you are using includes a phonenumber. The link property can only use links to a webpage. This also comes back in the error message that you are getting:

"the protocol must be http or https.".

So if you want to fix the error, you need to include a http or https link in your button instead of a phonenumber.

As for calling a phonenumber from the Google Assistant App, I'm not sure if this feature is supported at the moment.



来源:https://stackoverflow.com/questions/60596851/issue-in-make-a-phone-call-within-google-assistant-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!