Created
November 30, 2017 17:34
-
-
Save timelincoln7648/968dc449bea3b7de7d7b492e06a98d51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Get Current Connected Xero Org | |
*/ | |
app.intent('getOrgName', { | |
'slots': {}, | |
'utterances': ['{which|what} {|zero} {org|organisation|account|company|file} {|am I} {connected|attached|looking} {|at|to|on|in}'], | |
}, function(req, res) { | |
return checkSession(req) | |
.then(function(xeroDataHelper) { | |
return xeroDataHelper.getOrgName() | |
.then(function(orgName) { | |
res.say(xeroDataHelper.formatOrgName(orgName)).shouldEndSession(false).send(); | |
}) | |
.catch(function(err) { | |
console.log(err.statusCode); | |
var prompt = 'I couldn\'t find the connected org for you. Sorry.'; | |
res.say(prompt).shouldEndSession(true).send(); | |
}); | |
}) | |
.catch(function(err) { | |
console.log(err); | |
res.linkAccount().shouldEndSession(true).say('Your Zero account is not linked. Please use the Alexa App to link your account.'); | |
return true; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment