- Clone this repo
- Visit https://einstein.ai/
- Log in with your Salesforce credentials
- Download your certificate
- Put your certificate into the root of this project (einstein_platform.pem)
- Install node modules with
npm install
Once the setup steps have been completed, you can run the token script to generate a signed JWT assertion that you will use to get an access token. You must supply your username to the script.
$ USER=kevinohara80@gmail.com node token.js
When the script completes, you will have an access token. It will be output
to you console as well as output to a json file (./access_token.json
). You
can use this token for making future requests.
If you use Postman, there is a Postman collection json config in this repo
that you can import into Postman. You just need to set an access_token
global
variable to make all of the requests. See the previous section for generating
an access token.
In the src folder, you'll find the required src files to set up the vision API.
The example data is similar to what's found in the Apex Quickstart guide on the
Metamind docs site. There is a Predict.page
file that drives a Visualforce page that allows you to test images against their prediction model. Note that you will
need to change the username in VisionController.cls
and also install the certificate into Files
according to the setup guide.