{"_id":"@activeprospect/sailthru-client","_rev":"69-a4a68ed45209f0739af5b2013c3cc69c","name":"@activeprospect/sailthru-client","dist-tags":{"latest":"4.0.0"},"versions":{"4.0.0":{"name":"@activeprospect/sailthru-client","version":"4.0.0","author":{"url":"http://www.sailthru.com","name":"George Liao","email":"gliao@sailthru.com"},"license":"MIT","_id":"@activeprospect/sailthru-client@4.0.0","maintainers":[{"name":"philga","email":"maestro7@gmail.com"},{"name":"jgrayson03","email":"jonathan@activeprospect.com"},{"name":"apadmin","email":"dev@activeprospect.com"},{"name":"alexkwolfe","email":"alexkwolfe@gmail.com"},{"name":"kellym","email":"kellymartinv@gmail.com"},{"name":"cgrayson","email":"cgrayson@airpost.net"},{"name":"steveodom","email":"steve.odom@gmail.com"},{"name":"mikebetts","email":"mike.betts@activeprospect.com"},{"name":"justinwinslow","email":"justin@jwin.me"},{"name":"sborrazas","email":"hi@sborrazas.com"},{"name":"samullen","email":"samullen@gmail.com"},{"name":"jarrmiller","email":"jarrod.miller@activeprospect.com"},{"name":"ddaskal","email":"dean+npm@activeprospect.com"},{"name":"nathanielinman","email":"nate@theoestudio.com"},{"name":"benjmartin","email":"benjamin.martin2010@gmail.com"},{"name":"sammarten","email":"sam.marten@activeprospect.com"},{"name":"cullentaylor","email":"cullen.taylor@activeprospect.com"},{"name":"phoenix16t","email":"jimenez.eddie@gmail.com"},{"name":"rford-ap","email":"richard.ford@activeprospect.com"},{"name":"gabriel.roldan.ap","email":"gabriel.roldan@activeprospect.com"}],"homepage":"https://github.com/activeprospect/sailthru-node-client#readme","bugs":{"url":"https://github.com/activeprospect/sailthru-node-client/issues"},"dist":{"shasum":"703f8267bf58923292aeee02aadccbb58d1e5326","tarball":"https://registry.npmjs.org/@activeprospect/sailthru-client/-/sailthru-client-4.0.0.tgz","fileCount":13,"integrity":"sha512-Mh6n4vqlKi+c3hQiv61pzQ+LxQSLp3TEora7/Mxpa5OmGBd+9gDidbJSQ8LlJq1JcuHmZI2Y7QYaLh22EV/4vQ==","signatures":[{"sig":"MEYCIQDsupLwfDeA45gXywdv9o8IJtgeo0AUWld+dMOPFv2wwQIhAPKltmeookaAS6p2AnQLTB2TJPXce3inIohuB3U/XFcB","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":61816,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgks2rCRA9TVsSAnZWagAAz+YP/j9eXum6tl/Q+YwJJExD\nuvzjEELsv3f1XdCyjqi4hovOZkGNCkPcglJoIk0d6pctQakaEiY4u0GIrkoq\niz3bLKqlzknunT83P5KBbNSUV3WX2kOk6a+cmG6VwRCcS9qwB8kovalci1Bb\naF5JqpzRU8OvngVyvRCiSG4LwlyH1v1FS9IJe5JdpyHI6ifQnkNcTH58LGgc\nYNXgot+b/HLnUPqr2dKgB1NIEs++LD7p+FYpvUG5KDl5TBipjkACmDdueQ8c\nrC2LNH1XbKv5PGBZlLKzQ7D2nwvr8G2jIcsNptEDzbqKFRrjtU77MUk7ckjM\nOEGacLSIacrL0LBfUEBBPigOkVj8uWVouBzQT+/u6idvFPsDYDuazzRmmwAo\noh52aKfGQEQMnU3dMBotCW3YPFeZtEdtot8sgiuobgzhhvF7UH0Y7ZlBDK+1\nukDJhlO9F/VR0fJfo8AtU4zWrtrh7dvqdkPiJGpCUJXBIEt37s6P/F2np16V\nPMic7tN1fzzAYfL1IVf+2Qxp3O/LAFLXBIZ8H1BRBXG7OrRz8gY6K+zkU3/w\nxjMWX2qQwOIbHRm0fpNgpJ08m+bHW4/6On1WwiH3bir+a9caKvsoEut7un0c\n80EA4mco+MB8DjDxKOMydbtjCIrxx+XYm3PclmXlHRH3ICoxkZ1FSvABWfL+\nIpm8\r\n=FIBt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/sailthru.js","engines":{"node":">=0.4"},"gitHead":"94deb5171f04f3527d52d550fbcc1ec2f1060c6d","_npmUser":{"name":"cgrayson","email":"cgrayson@airpost.net"},"repository":{"url":"git+ssh://git@github.com/activeprospect/sailthru-node-client.git","type":"git"},"_npmVersion":"6.14.8","description":"Node.js client for Sailthru API","directories":{},"_nodeVersion":"12.19.0","dependencies":{"grunt-cli":"^1.3.2","restler-base":"^3.4.6"},"_hasShrinkwrap":false,"devDependencies":{"nock":"^9.0.2","grunt":"^1.0.1","nodeunit":"^0.10.2","mock-require":"^2.0.0","grunt-contrib-nodeunit":"^1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sailthru-client_4.0.0_1620233642798_0.5086847308194027","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-05-05T16:54:02.798Z","modified":"2026-10-01T07:48:35.038Z","4.0.0":"2021-05-05T16:54:02.992Z"},"bugs":{"url":"https://github.com/activeprospect/sailthru-node-client/issues"},"author":{"url":"http://www.sailthru.com","name":"George Liao","email":"gliao@sailthru.com"},"license":"MIT","homepage":"https://github.com/activeprospect/sailthru-node-client#readme","repository":{"url":"git+ssh://git@github.com/activeprospect/sailthru-node-client.git","type":"git"},"description":"Node.js client for Sailthru API","maintainers":[{"email":"dev@activeprospect.com","name":"apadmin"},{"email":"alexkwolfe@gmail.com","name":"alexkwolfe"},{"email":"steve.odom@gmail.com","name":"steveodom"},{"email":"dpjones09@gmail.com","name":"dpjones09"},{"email":"john.bench@activeprospect.com","name":"johnb2"},{"email":"Luis.Ferreira@activeprospect.com","name":"ap_luisferreira"},{"email":"alison.simbanegavi@activeprospect.com","name":"alisimbanegavi"},{"email":"benjamin.martin2010@gmail.com","name":"benjmartin"},{"email":"omar.vazquez@activeprospect.com","name":"vzqzacap"},{"email":"sam.marten@activeprospect.com","name":"sammarten"},{"email":"gabriel.roldan@activeprospect.com","name":"gabriel.roldan.ap"},{"email":"steven.fuchs@activeprospect.com","name":"stwf-ap"},{"email":"jose.salina@activeprospect.com","name":"josevsp"},{"email":"shoeb.khan@activeprospect.com","name":"apshoebkhan"},{"email":"ricky.mcmurtrey@activeprospect.com","name":"rickymcmurtrey"},{"email":"matteo.pandolfi@activeprospect.com","name":"matteo.pandolfi"},{"email":"carl.hannusch@activeprospect.com","name":"carlhannusch"},{"email":"petra.terbe@activeprospect.com","name":"terbepetra"},{"email":"jarrmill@outlook.com","name":"jarrodbmiller"},{"email":"stefano.santonocito@activeprospect.com","name":"stefano.santonocito"},{"email":"carlo.anselmi@activeprospect.com","name":"carlo.anselmi"},{"email":"josh.evensen@activeprospect.com","name":"jevensen"},{"email":"christian.celora@leadsbridge.com","name":"celolb"},{"email":"dusan.pantelic@activeprospect.com","name":"dusan.pantelic.ap"},{"email":"chris.snyder@activeprospect.com","name":"jastingo"},{"email":"it@activeprospect.com","name":"it-activeprospect"},{"email":"santiago.ferreira@activeprospect.com","name":"santiago.ferreira"},{"email":"fellipe.fingoli@activeprospect.com","name":"fellipe.fingoli"},{"email":"matteo.leggieri@activeprospect.com","name":"matteo.leggieri"},{"email":"ludwig.olaru@activeprospect.com","name":"lolaru-ap"},{"email":"matias.delgado@activeprospect.com","name":"matiasdelgado"},{"email":"benjamin.hanisch@activeprospect.com","name":"benjaminhanischactiveprospect"}],"readme":"sailthru-node-client\n====================\n\nFor installation instructions, documentation, and examples please visit:\n<http://getstarted.sailthru.com/new-for-developers-overview/api-client-library/node-js-npm>\n\nA simple client library to remotely access the `Sailthru REST API` as per <http://getstarted.sailthru.com/new-for-developers-overview/api/api-overview/>\n\nBy default, it will make request in `JSON` format. `XML` format is not supported.\n\nInstallation\n------------\n\n```\nnpm install sailthru-client --save\n```\n\nExamples\n--------\n\n### Initialization\n\n``` js\nvar apiKey = '******',\n    apiSecret = '*****',\n    sailthru = require('sailthru-client').createSailthruClient(apiKey, apiSecret);\n```\n\n### Getting version\n\n``` js\nvar version = require('sailthru-client').VERSION;\n```\n\n### Enable / Disable Logging\n\n``` js\nsailthru.enableLogging();\nsailthru.disableLogging();\n```\n\n### Making POST Request\n\n``` js\nvar data = {\n    email: 'foo@example.com',\n    lists: {\n        'list-a': 1\n    }\n};\nsailthru.apiPost('email', data, function(err, response) {\n    if (!err) {\n        console.log(response);\n    } else {\n        console.log('Error!');\n        console.log(err);\n    }\n});\n```\n\n### Making POST Request with multipart (Eg: Job API call with import type)\n\n``` js\n// Making import /job API POST call\n// MUltipart call\nvar data = {\n    job: 'import',\n    list: 'test-list',\n    file: './emails.txt'\n};\nvar multipart_params = ['file']; // this is required to mark file as a multipart upload item'\nsailthru.apiPost('job', data, multipart_params, function(err, response) {\n   console.log(response);\n});\n```\n\n\n### Making GET Request\n``` js\n// Making /send API GET call\nvar send_id = 'TE8EZ3-LmosnAgAA';\nsailthru.apiGet('send', {send_id: send_id}, function(err, response) {\n    console.log(response);\n});\n```\n\n### Making DELETE Request\n``` js\n// /send API DELETE call\nvar send_id = 'TE8EZ3-LmosnAgAA';\nsailthru.apiDelete('send', {send_id: send_id}, function(err, response) {\n    console.log(response);\n});\n```\n\n### [send](http://getstarted.sailthru.com/api/send)\n\n``` js\n//send\nvar template = 'my-template',\n    email = 'foo@example.com',\n    options = {\n        'vars': {\n            'name': 'Foo Bar',\n            'address': 'Queens, NY'\n        },\n        'options': {\n            'test': 1,\n            'replyto': 'bar@example.com'\n        }\n    };\nsailthru.send(template, email, options, function(err, response) {\n    if (err) {\n        console.log(\"Status Code: \" + err.statusCode);\n        console.log(\"Error Code: \" + err.error);\n        console.log(\"Error Message: \" + err.errormsg);\n    } else {\n        //process output\n    }\n});\n\n//multi-send\nvar emails = ['blah@example.com', 'foo@example.com', 'bar@example.com'],\n    template = 'multi-template',\n    options = {\n        'options': {\n            'test': 1\n        }\n    };\nsailthru.multiSend(template, emails, options, function(err, response) {\n    if (err) {\n        //Process error\n    } else {\n        //process JSON output\n    }\n});\n```\n\n### Rate Limit Information\n\nThe library allows inspection of the 'X-Rate-Limit-*' headers returned by the Sailthru API. The `getLastRateLimitInfo(action, method)` function allows you to retrieve the last known rate limit information for the given action / method combination. It must follow an API call. For example, if you do a `/send POST`, you can follow up with a call to `getLastRateLimitInfo('send', 'POST')` as shown below:\n\n``` js\n// make API call as normal\nsailthru.apiPost('send', {'template': 'my template', 'email': 'foo@example.com'}, function(err, response) {\n    if (!err) {\n        console.log(response);\n    } else {\n        console.log('Error!');\n        console.log(err);\n    }\n});\n\n// check rate limit information\nvar rateLimitInfo = sailthru.getLastRateLimitInfo('send', 'POST');\n```\n\nThe return type will be `undefined` if there is no rate limit information for the given action / method combination (e.g. if you have not yet made a request to that endpoint). Otherwise, it will be an object in the following format:\n\n``` js\n{\n    limit: 1234, // <Number representing the limit of requests/minute for this action / method combination>\n    remaining: 1230, // <Number representing how many requests remain in the current minute>\n    reset: 1459381680 // <Number representing the UNIX epoch timestamp of when the next minute starts, and when the rate limit resets>\n}\n```\n\nDevelopment\n-----------\n\n```\nnpm install -g grunt-cli\nnpm install # to install dependencies locally\ngrunt # for running tests\n```\n","readmeFilename":"README.md"}