1. 程式人生 > >Hey Google, I Need Help With My Action

Hey Google, I Need Help With My Action

How can you ask a good question?

StackOverflow has a great page on how to ask a good question. And you should read it before you go any further. It’s suggestions are good for StackOverflow, of course, but many also apply no matter where or how you ask questions. In addition to what they suggest, there are a few additional things that apply to building an Action or working with Dialogflow.

If you are posting on StackOverflow, make sure you tag your question correctly. You can use up to five tags, so make sure you use them well.

  • If your question involves an Action you’re writing that you expect to run from the Assistant, use the actions-on-google tag.
  • If you’re using Dialogflow, make sure to tag it with dialogflow
    and see the additional notes below. (Dialogflow can be used in many ways, and it helps the community out if you’re clear how you’re using it.) If you’re not using Dialogflow, but using the Action SDK with an actions.json file, make sure you say that in the body of your question.
  • There are a few other tags available, but they are used less often. Think before you use them. If you’re building hardware (or sometimes software) that has the Assistant built in, you’ll probably be using and want to tag the question with google-assistant-sdk
    . People often misuse this tag, and you often don’t want to use it. If you have a question that is very specific about using a smart speaker with your Action, then tagging it google-home makes sense, but there aren’t many questions where this is true.
  • Make sure you tag it with the programming language you’re using. Most developers are using node.js, which is a server-based version of JavaScript, but you could be working in any other language of your choice. Sometimes the problem you’re having has nothing to do with Actions on Google, but that may not be obvious, so make sure you include the language tag.
  • If you’re using a particular server technology, such as google-cloud-functions, which is also used by Firebase, or aws-lambda, it can be a good idea to specify this in a tag as well. If you’re using the Dialogflow built-in editor (more on this below), specify this as google-cloud-functions and firebase.

Beyond the tag, there is additional information you should provide up front in the question itself. Partly you should repeat the tag (some people miss the tags when reading the question), but there is additional info as well.

  • If you’re using the Dialogflow built-in editor for your fulfillment webhook, make sure you say so. We don’t want a screen shot of it, but showing us the code (as formatted text!) generally helps.
  • If you are using Dialogflow, and have tagged it as such, make sure you’re clear which Dialogflow technology you’re using. If you’re using fulfillment with a webhook, make sure you say that. If you’re calling Dialogflow’s API from a client (ie: you’re asking Dialogflow to parse something your client is sending), make that clear. If you’re not sure what you’re doing, explain with as much detail as you can how you’re using Dialogflow. Each of these are different, and we don’t want to give you bad information.
  • If you are not using Dialogflow, say so, and make it clear what you’re using.
  • Specify exactly what programming language you’re using.
  • If you are using a library or SDK, say exactly which one. (Even which version, if you can.) For fulfillment, there are several libraries out there if you’re using node.js: actions-on-google, dialogflow-fulfillment, and multivocal are just some examples.

StackOverflow encourages you to post code, and that is probably one of the biggest things you can do to help explain what is happening, but it isn’t the only thing. Explain to us why the code isn’t working, either because you’re getting an error or you’re getting results that you’re not expecting. If you get errors, please post the text of the error rather than a screen shot.

If you are using the simulator to test your Action and are having problems, a screen shot showing the conversation can be helpful. We also like to see the contents of the Request, Response, Debug, and Error tabs, but having those as text is far more helpful than screen shots. You may need to use text to illustrate what you expect the conversation to be like, and understanding that can help us greatly as well.

Screen shots are, however, very useful if you’re describing your Dialogflow Intents and Entities. If you’re expecting an Intent to handle some input, and it doesn’t, show us the Intent’s configuration in Dialogflow so we can see everything about the Context, Sample phrases, and Parameters that are being used. If you have custom Entity Types, include screen shots of them as well.

We may ask some followup questions in the comments. In most cases, you shouldn’t try to answer them in the comments, but rather update your question so it is a better question. (And then mention in the comments that you’ve done so.) Better questions help everyone!

Finally, if the question does help you, accepting and upvoting the answer that helped is always appreciated. You’ll get some reputation for it, the person answering you gets some reputation, and it helps future people with similar problems identify a solution that works. If you find another question that helps you solve your problem, give it an upvote as well.