I'm trying to use
Docusign's Esignature API with Loopback. I was hoping to implement a custom connector for this, similar to the
Sendgrid connector. I've done a bunch of reading about
non-database connectors, and
building them.
I'd like for the API to work similarly to the one from the
Sendgrid and
Twilio connectors. For each of these connectors, you add a new datasource to datasources.json, and add a model to model-config.json. Then, you should be able to access the API Sendgrid from the Loopback global.
datasources.json
...
"twilio": {
"name": "twilio",
"connector": "loopback-connector-twilio",
"accountSid": "YOUR_TWILIO_ACCOUNT_SID",
"authToken": "YOUR_TWILIO_AUTH_TOKEN"
}
...
"Twilio": {
"dataSource": "twilio",
"public": true
}
Then, in your models, you can use
Twilio.sendTwilio.send(options, callback);
I believe I've got my Docusign connector set up to work similarly.
Unfortunately, when I add docusign to my datasources.json and to my model-config.json, I get the following error.
/Users/DudeOfAwesome/Github/loopback-connector-docusign/node_modules/loopback/lib/registry.js:310
throw new Error(g.f('Model not found: %s', modelName));
^
Error: Model not found: Docusign
at Registry.getModel (/Users/DudeOfAwesome/Github/loopback-connector-docusign/node_modules/loopback/lib/registry.js:310:9)
at /Users/DudeOfAwesome/Github/loopback-connector-docusign/node_modules/loopback-boot/lib/executor.js:233:24
at Array.forEach (native)
at defineModels (/Users/DudeOfAwesome/Github/loopback-connector-docusign/node_modules/loopback-boot/lib/executor.js:228:23)
at setupModels (/Users/DudeOfAwesome/Github/loopback-connector-docusign/node_modules/loopback-boot/lib/executor.js:196:3)
at execute (/Users/DudeOfAwesome/Github/loopback-connector-docusign/node_modules/loopback-boot/lib/executor.js:39:3)
at bootLoopBackApp (/Users/DudeOfAwesome/Github/loopback-connector-docusign/node_modules/loopback-boot/index.js:154:3)
at Object.<anonymous> (/Users/DudeOfAwesome/Github/loopback-connector-docusign/example/server/server.js:22:1)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
When I don't add the snippet to the model-config.json, then the connector initializes correctly.
Am I going in the right direction? Is there a better way to make this work?