Skip to content

Instantly share code, notes, and snippets.

@cawfree
Last active November 18, 2017 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cawfree/c7f914ab98ea4749b46f405f3f7ebb86 to your computer and use it in GitHub Desktop.
Save cawfree/c7f914ab98ea4749b46f405f3f7ebb86 to your computer and use it in GitHub Desktop.
An example permissions request for Jovo.
import { SpeechBuilder } from 'jovo-framework/lib/platforms/speechBuilder';
import { jovo } from 'jovo-framework/lib/jovo';
/**
* agent: /intGetNamePermission
* inputContext: <none>
* userStateIn: <none>
* action: ask for the user's name.
* userStateOut: <none>
* outputContext: <none>
*/
export function intGetNamePermission() {
this.googleAction().jovo.platform.response.responseObj = {
"speech": "<speak>Can I have permission for your name?<\/speak>",
"data": {
"google": {
"expectUserResponse": true,
"is_ssml": false,
"noInputPrompts": [],
"richResponse": {
"items": [
{
"simpleResponse": {
"ssml": "<speak>Can I have permission for your name?<\/speak>"
}
}
]
},
"system_intent" : {
"intent" : "assistant.intent.action.PERMISSION",
"data": {
"@type": "type.googleapis.com/google.actions.v2.PermissionValueSpec",
"optContext": "To get to know each other",
"permissions": [
"NAME"
],
}
}
}
}
};
this.googleAction().jovo.emit('respond', this.googleAction().jovo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment