https://github.com/confuser/node-dotmailer
A 3rd party dotMailer v2 REST API implementation
https://github.com/confuser/node-dotmailer
dotmailer nodejs
Last synced: 9 months ago
JSON representation
A 3rd party dotMailer v2 REST API implementation
- Host: GitHub
- URL: https://github.com/confuser/node-dotmailer
- Owner: confuser
- License: isc
- Created: 2014-06-03T13:38:07.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2024-12-07T06:32:50.000Z (over 1 year ago)
- Last Synced: 2025-09-04T00:20:48.761Z (10 months ago)
- Topics: dotmailer, nodejs
- Language: JavaScript
- Homepage:
- Size: 761 KB
- Stars: 4
- Watchers: 3
- Forks: 5
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# dotMailer
[](http://travis-ci.org/confuser/node-dotmailer)
[](https://snyk.io/test/github/confuser/node-dotmailer?targetFile=package.json)
A 3rd party dotMailer v2 REST API implementation
## Installation
```
npm install dotmailer --save
```
## Usage
```dotMailer({endpoint, tokens, config, callback})```
- (Required) endpoint (String) - Function name, e.g. 'PostAddressBooks'
- (Optional) tokens (Array) - Query parameters that are passed as additional function arguments, can be String or Number, e.g. 123456
- (Required) config (Object) - Request type & options.
```
Example:
{
type: 'json',
options: {
Name: 'Test Address Book',
Visibility: 'Private'
}
}
```
- (Required) callback (Function) - (error, response) Executed on completion
Tokens may be required depending on the endpoint. Required tokens that are not used will throw an error.
Some requests return 204 meaning response within the callback will be undefined if successful.
## Documentation
Full documentation for the dotMailer API can be found at http://api.dotmailer.com/v2/help/wadl
## Example
```js
var config =
{ auth:
{ user: '', pass: '' }
baseUrl: 'https://r1-api.dotmailer.com/v2/' // Account region endpoint
// Any other 'request' options here
}
, dotmailer = require('dotmailer')(config)
, addressBookId = 123456
dotmailer({
endpoint: 'DeleteAddressBookContacts',
tokens: [addressBookId],
config: {
type: 'json',
options: {}
}
callback: (error, res) => {
console.log(error, res)
})
```
## Tests
An integration test is provided which is not a part of ```npm test```
This test will create, update & delete an address book named 'Test Address Book'
To run:
```
USER=username@apiconnector.com
PASS=pass
$ mocha test/integration/dotmailer.integration.test.js
```
## Credits
- [James Mortemore](https://github.com/confuser/)
- [John Field](https://johnfield.github.io/)
- [Ian Crowther](https://github.com/iancrowther/)