Comments (11)
The libraries that Violet is using are listed here:
https://github.com/salesforce/violet-conversations/blob/master/package.json#L32,L47
To see the violetStoreSF
code, go here:
https://github.com/salesforce/violet-conversations/blob/master/lib/violetStoreSF.js
Posting your code and the error message will likely allow me to help you better.
from violet-samples.
I haven't done the code yet using the violet library because I was facing an error with nforce and Alexa SDK (As I also mentioned in my question) and now when I deployed sf-leadsAndOpportunities script on Heroku server with required credential, still I'm facing the same error as I mentioned in my question(Unable to perform query method of nforce with Alexa SDK v2). Here is a video link for the query operation.
Query operation
from violet-samples.
Can you post the error that you on the server with the above video?
from violet-samples.
@kunalanant1 - I just tested the script above and it works for me.
Perhaps your salesforce org security model is preventing the query from happening? Maybe try a simple nforce
query to it (without Violet or any other dependencies)?
from violet-samples.
Can you post the error that you on the server with the above video?
Here the screenshot of error on Heroku server log.
from violet-samples.
@vineet-sinha How Persistence(violetStoreSF) will work while account linking process via Alexa (without hard-coded values of V_SFDC_CLIENT_ID,V_SFDC_CLIENT_SECRET,V_SFDC_USERNAME,V_SFDC_PASSWORD ).Could you explain ?
from violet-samples.
@kunalanant1 - I think you need to try and let me know the answer to a few basic questions first:
- Have you tried a simple
nforce
query to it (without Violet or any other dependencies)? - Have you tried running the sample app locally with no code changes and the right environment variables set?
Once that is set, ...
- The second error message is likely related/caused by the first one.
- The question is why are you having problems with
instance_url
.
Finally, I personally have not done web flow authentication with Violet yet - in part because it is different for Alexa vs Dialogflow. This is on my roadmap. I know people have done the Alexa authentication part successfully with Violet - I am just not sure if they made a copy of violetStoreSF
to make that happen, i.e. violetStoreSF
) might require minor changes to account for account linking.
If it does require changes, do let me know.
I would start with:
a. first get account linking working with Violet.
b. once that is working then get the accessToken from response.platReq.request.sessionDetails.user.accessToken
c. then try using nforce directly to see if you can get it working
d. finally try using violetStoreSF
, making a copy of it and adding changes if necessary.
If you have problems with the above, let me know which ones you were successful with and which ones you have problems with.
from violet-samples.
d. finally try using
violetStoreSF
, making a copy of it and adding changes if necessary.
@vineet-sinha I have done the query operation with nforce successfully without any dependencies and I have also gone through the Violet trailhead for Alexa (https://trailhead.salesforce.com/en/content/learn/projects/quickstart-violet/get-started-with-violet) which is deployed locally.
And I had resolved this instance_url
issue but still, if I'm creating new lead it is not showing in my salesforce Org after success lead creation message and now query operation working correctly.
As I told you earlier that I had tried to done web flow authentication via the account linking process with nforce and alexa-sdk but in that, I'm unable to perform query operation with nforce that's why I'm confused whether it will work or not because in violetStoreSF
and violet
there is the same prototype (nforce and alexa-sdk same version )that I had used earlier.
And yes you are right that we have to make some changes in violetStoreSF
for account linking process and I will try with your given steps and also let you know about this.
from violet-samples.
I have tried to done account linking with violet but facing some 'Handler 'handler' missing on module', i think it might not get on which server it is working.
As I had deployed my code on aws server with this Alexa skill model on Alexa developer console
var violet = require('violet').script();
var nforce = require('nforce');
var request = require('sync-request');
var APP_ID = 'amzn1.ask.skill.edffd17c-2468-4435-878e-391972bc1379'; // skill id
var org = nforce.createConnection({
clientId: "NA",
clientSecret: "NA",
redirectUri: "NA"
});
//Getting instanceurl with access token
violet.respondTo({
expecting: [
'Login to my org',
'Open my org'
],
resolve: function (response) {
var access = response.platReq.request.sessionDetails.user.accessToken;
console.log('accesstoken '+response.platReq.request.sessionDetails.user.accessToken); // access token
if(!access)
{
var res = request('GET', 'https://login.salesforce.com/services/oauth2/userinfo?oauth_token='+access, {
headers: {
'Content-Type': 'application/json',
},
});
var data = res.getBody();
var parserData =JSON.parse(data.toString('utf8'));
instanceUrl = parserData.urls.custom_domain;
response.say(`Welcome to your salesforce org`);
}
response.say(`Sorry`);
}});
// help script
violet.respondTo({
expecting: [
'Can you help me',
'What can I do'
],
resolve: function (response) {
response.say(`I can help you with your current account balance, with
financial planning, budgeting, investing, or taking out a
loan`);
}});
violet.appName = APP_ID;
module.exports = violet;
Alexa Skill Model
{
"interactionModel": {
"languageModel": {
"invocationName": "salesforce",
"intents": [
{
"name": "Launch",
"slots": [],
"samples": [
"Can you help me",
"What can I do "
]
},
{
"name": "LoginIntent",
"slots": [],
"samples": [
"Login to my org",
" Open my org"
]
},
{
"name": "AMAZON.NavigateHomeIntent",
"samples": []
},
{
"name": "AMAZON.CancelIntent",
"samples": []
},
{
"name": "AMAZON.HelpIntent",
"samples": []
},
{
"name": "AMAZON.StopIntent",
"samples": []
},
{
"name": "AMAZON.FallbackIntent",
"samples": []
}
],
"types": []
}
}
}
Alexa skill developer
Aws server log
from violet-samples.
@kunalanant1 - that above code should work on a server where you are running the app by itself, i.e. either locally, AWS EC2, Heroku, etc.
If you want to use AWS Lambda you will need to do a few things differently. We have not put documentation out for doing so because of the complexities involved have many developers have a hard time in doing so.
from violet-samples.
Given the above, I'm going to have to close this, but please re-open if you feel there is an issue with Violet.
from violet-samples.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from violet-samples.