npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

amply.js

v0.0.3

Published

This is the Amply Javascript SDK that integrates with the [v1 API](https://docs.sendamply.com/docs/api/docs/Introduction.md).

Downloads

7,590

Readme

Amply.js

This is the Amply Javascript SDK that integrates with the v1 API.

Table of Contents

Install

Prerequisites

Access Token

Obtain your access token from the Amply UI.

Install Package

npm install amply.js

Domain Verification

Add domains you want to send from via the Verified Domains tab on your dashboard.

Any emails you attempt to send from an unverified domain will be rejected. Once verified, Amply immediately starts warming up your domain and IP reputation. This warmup process will take approximately one week before maximal deliverability has been reached.

Quick Start

The following is the minimum needed code to send a simple email. Use this example, and modify the to and from variables:

const amply = require ('amply.js');
amply.setAccessToken(process.env.AMPLY_ACCESS_TOKEN);

//ES6
amply.email.create({
  to: '[email protected]',
  from: '[email protected]',
  subject: 'My first Amply email!',
  text: 'This is easy',
  html: '<strong>and fun :)</strong>'
}).then(msg => console.log(msg))
.catch(err => console.log(err.response));

Once you execute this code, you should have an email in the inbox of the recipient. You can check the status of your email in the UI from the Search, SQL, or Users page.

Methods

email

Parameter(s) | Description :---------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- to, cc, bcc | Email address of the recipient(s). This may be a string Test <[email protected]>, an object {name: 'Test', email: '[email protected]'}, or an array of strings and objects. personalizations | For fine tuned access, you may override the to, cc, and bcc keys and use advanced personalizations. See the API guide here. from | Email address of the sender. This may be formatted as a string or object. An array of senders is not allowed. subject | Subject of the message. html | HTML portion of the message. text | Text portion of the message. content | An array of objects containing the following keys: type (required), value (required). template | The template to use. This may be a string (the UUID of the template), an array of UUID's (useful for A/B/... testing where one is randomly selected), or an object of the format {template1Uuid: 0.25, template2Uuid: 0.75} (useful for weighted A/B/... testing). dynamicTemplateData | The dynamic data to be replaced in your template. This is an object of the format {variable1: 'replacement1', ...}. Variables should be defined in your template body using handlebars syntax {{variable1}}. replyTo |Email address of who should receive replies. This may be a string or an object with name and email keys. headers | An object where the header name is the key and header value is the value. ipOrPoolUuid | The UUID of the IP address or IP pool you want to send from. Default is your Global pool. unsubscribeGroupUuid | The UUID of the unsubscribe group you want to associate with this email. attachments[][content] | A base64 encoded string of your attachment's content. attachments[][type] | The MIME type of your attachment. attachments[][filename] | The filename of your attachment. attachments[][disposition] | The disposition of your attachment (inline or attachment). attachments[][content_id] | The content ID of your attachment. clicktracking | Enable or disable clicktracking. categories | An array of email categories you can associate with your message. substitutions | An object of the format {subFrom: 'subTo', ...} of substitutions. sendAt | Delay sending until a specified time. An ISO8601 formatted string with timezone information.

Example

amply.email.create({
  to:   '[email protected]',
  from: 'From <[email protected]>',
  text: 'Text part',
  html: 'HTML part',
  personalizations: [{to: [{name: 'Override To', email: '[email protected]'}]}],
  content: [{type: 'text/testing', value: 'some custom content type'}],
  subject: 'A new email!',
  replyTo: 'Reply To <[email protected]>',
  template: 'faecb75b-371e-4062-89d5-372b8ff0effd',
  dynamicTemplateData: {name: 'Jimmy'},
  unsubscribeGroupUuid: '5ac48b43-6e7e-4c51-817d-f81ea0a09816',
  ipOrPoolUuid: '2e378fc9-3e23-4853-bccb-2990fda83ca9',
  attachments: [{content: 'dGVzdA==', filename: 'test.txt', type: 'text/plain', disposition: 'inline'}],
  headers: {'X-Testing': 'Test'},
  categories: ['Test'],
  clicktracking: true,
  substitutions: {'sub1': 'replacement1'},
  sendAt: "2021-06-23T15:26:03-07:00"
}).then(msg => console.log(msg))
.catch(err => console.log(err.response));