** cio: short for Context.io
A lightweight toolkit to add support for Context.io to your Meteor App.
Includes:
- Wraps context.io node.js api client library ContextIO-node
- Utility methods for easy integration.
- UI controls to add cio accounts
- UI controls to associate cio mailboxes to cio accounts
If you are not yet familiar with Context.io, read their documentation first and play around a bit with their api explorer and make sure you understand how-it-works.
Even though the package contains some utilities to make integration easier, it is still a wrapper of ContextIO-node which is still in beta (i think) so be sure to check it's documentation on it's own repo.
- Simply add via console
meteor add rapito:contextio
- Setup cio credentials on your meteor project
settings.json
file.
-
Initialize cio:
- Use singleton by setting up credentials on settings.json as the library looks for
Meteor.settings.services.contextio
. (readsettings.example.json
)var cio = Cio; //"Cio" is available globally
- Or Manually create the client:
var cio = ContextIOClient.get(apiKey,apiSecret);
- Use singleton by setting up credentials on settings.json as the library looks for
-
Create cio accounts:
var userCioAccount = cio.createAccount(primaryEmailAddress,firstName,lastName);
-
Connecting mailboxes:
Template.registerHelper('userCioAccount', function(){ return userCioAccount; });
{{> connectMailboxButton account=userCioAccountId}}
-
Use npm package directly:
var cioNode = cio.client;
- connectMailboxButton: Adds a Button which initiates negotiation to connect a new mailbox. (Hotmail or Gmail only)
- required:
account
account id to connect mailbox to. - optional:
cio
to specify wrapper to be used. defaults to singleton - optional:
classes
to override button style. - optional:
callbackUrl
to redirect client to after mailbox registration. - optional:
label
Button Label.
- required:
- auto-sync meteor accounts: hook to create a user account on your cio account for each registered user.
- Check out the
examples/
folder for simple use cases. - Apps using this package (pull request to add more):
- running examples:
cd example/simple/
thenmeteor --settings settings.example.json
- munit tests:
meteor test-packages rapito:contextio --port 1234 --settings settings.example.json