
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
sendwithus
Advanced tools
npm install sendwithus
All callbacks accept err
and response
:
const callback = function(err, response) {
if (err) {
console.log({message: err.message, status: response.status, statusText: response.statusText});
} else {
console.log(response);
}
};
var api = require('sendwithus')('API_KEY');
api.templates(callback);
var api = require('sendwithus')('API_KEY');
var data = { name: 'name', subject: 'subject', html: '<html><head></head><body></body></html>', text: 'some text' };
api.createTemplate(data, callback);
var api = require('sendwithus')('API_KEY');
var data = { name: 'name', subject: 'subject', html: '<html><head></head><body></body></html>', text: 'some text' };
api.createTemplateVersion(TEMPLATE_ID, data, callback);
NOTE - If a customer does not exist by the specified email (recipient address), the send call will create a customer.
The template_data
field is optional, but highly recommended!
var api = require('sendwithus')('API_KEY');
api.send({
template: 'TEMPLATE_ID',
recipient: { address: 'us@sendwithus.com' }
}, callback);
var api = require('sendwithus')('API_KEY');
api.send({
template: 'TEMPLATE_ID',
recipient: {
address: 'us@sendwithus.com', // required
name: 'Matt and Brad'
},
template_data: { first_name: 'Matt' }
}, callback);
sender['address']
is a required sender field
var api = require('sendwithus')('API_KEY');
api.send({
template: 'TEMPLATE_ID',
recipient: { address: 'us@sendwithus.com' },
template_data: { first_name: 'Matt' },
sender: {
address: 'company@company.com', // required
name: 'Company'
}
}, callback);
sender['name']
and sender['reply_to']
are both optional
var api = require('sendwithus')('API_KEY');
api.send({
template: 'TEMPLATE_ID',
recipient: { address: 'us@sendwithus.com' },
template_data: { first_name: 'Matt' },
sender: {
address: 'company@company.com', // required
name: 'Company',
reply_to: 'info@company.com'
}
}, callback);
var api = require('sendwithus')('API_KEY');
api.send({
template: TEMPLATE_ID,
recipient: { address: 'us@sendwithus.com' },
bcc: [{ address: 'bcc@sendwithus.com' }],
cc: [
{ address: 'cc1@sendwithus.com' },
{ address: 'cc2@sendwithus.com' }
]
}, callback);
var api = require('sendwithus')('API_KEY');
api.send({
template: TEMPLATE_ID,
recipient: { address: 'us@sendwithus.com' },
headers:{ 'X-HEADER-ONE': 'header-value' }
}, callback);
var api = require('sendwithus')('API_KEY');
api.send({
template: TEMPLATE_ID,
recipient: { address: 'us@sendwithus.com' },
esp_account:'esp_1234asdf1234'
}, callback);
var api = require('sendwithus')('API_KEY');
api.send({
template: TEMPLATE_ID,
recipient: { address: 'us@sendwithus.com' },
locale:'en-US'
}, callback);
var api = require('sendwithus')('API_KEY');
api.send({
template: TEMPLATE_ID,
recipient: { address: 'us@sendwithus.com' },
version_name:'Version A'
}, callback);
var api = require('sendwithus')('API_KEY');
api.customersUpdateOrCreate({
email: 'foo@bar.com',
locale: 'fr-CA'
}, callback);
var api = require('sendwithus')('API_KEY');
api.customersDelete('foo@bar.com', callback);
var api = require('sendwithus')('API_KEY');
api.dripCampaignList(callback);
var api = require('sendwithus')('API_KEY');
api.dripCampaignDetails('DRIP_CAMPAIGN_ID', callback);
var api = require('sendwithus')('API_KEY');
var data = {
recipient: {
address: 'RECIPIENT_ADDRESS',
name: 'RECIPIENT_NAME'
},
email_data: {
country: 'Latveria'
}
}
api.dripCampaignActivate('DRIP_CAMPAIGN_ID', data, callback);
var api = require('sendwithus')('API_KEY');
var data = { recipient_address: 'RECIPIENT_ADDRESS' };
api.dripCampaignDeactivate('DRIP_CAMPAIGN_ID', data, callback);
var api = require('sendwithus')('API_KEY');
var data = { recipient_address: 'RECIPIENT_ADDRESS' };
api.dripCampaignDeactivateAll(data, callback);
> response.status;
OK
> response.success;
True
> response.receipt_id;
'numeric-receipt-id'
> err.statusCode;
400
> err.statusCode;
403
var api = require('sendwithus')('API_KEY');
api.render({ template: 'SAMPLE_TEMPLATE_ID', template_data: { name: 'Bob' }, strict: true }, callback);
var api = require('sendwithus')('API_KEY');
api.render({
template: 'SAMPLE_TEMPLATE_ID',
template_data: { name: 'Bob' },
locale: 'en-US',
strict: true
}, callback);
var api = require('sendwithus')('API_KEY');
api.render({
template: 'SAMPLE_TEMPLATE_ID',
template_data: { name: 'Bob' },
version_id: 'SAMPLE_VERSION_ID',
strict: true
}, callback);
{
"success": true,
"status": "OK",
"template": {
"id": "ver_r4nd0ml3tt3rsv15h4l0l",
"name": "Template name",
"version_name": "Template version name",
"locale": "en-US"
},
"subject": "RENDERED SUBJECT WITH DATA",
"html": "RENDERED HTML BODY WITH DATA",
"text": "RENDERED TEXT BODY WITH DATA"
}
var api = require('sendwithus')('API_KEY');
api.resend({"log_id": "log_asdf123456qwerty"}, callback);
var api = require('sendwithus')('API_KEY');
api.batch([{
"path": "/api/v1/send",
"method": "POST",
"body": {
"template": "TEMPLATE_ID",
"recipient": {
"address": "test+1@mydomain.com"
}
}
}, {
"path": "/api/v1/send",
"method": "POST",
"body": {
"template": "TEMPLATE_ID",
"recipient": {
"address": "test+2@mydomain.com"
}
}
}], callback);
request: function(method, url, headers, body)
- emitted when a request has been sent to Sendwithusresponse: function(statusCode, body, response)
- emitted when a response has been received back from SendwithusInstall requirements
npm install
Run Unit Tests
npm test
Debug mode prints out the underlying request information as well as the data payload that gets sent to Sendwithus. You will most likely find this information in your logs. To enable it, simply put debug=true
as a parameter when instantiating the API object. Use the debug mode to compare the data payload getting sent to Sendwithus' API docs.
var api = require('sendwithus')('API_KEY', debug=true);
Sendwithus' API typically sends responses back in these ranges:
If you're receiving an error in the 400 response range follow these steps:
FAQs
Sendwithus.com Node.js client
The npm package sendwithus receives a total of 1,829 weekly downloads. As such, sendwithus popularity was classified as popular.
We found that sendwithus demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.