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

pepipost

v5.0.0

Published

Official nodejs library for sending email using web API v5

Downloads

1,902

Readme

pepipostlogo

npm NpmLicense npm Open Source Helpers Twitter Follow

Official nodejs library of Pepipost

This SDK contains methods for easily interacting with the Pepipost Email Sending API to send emails in a few seconds.

We are trying to make our libraries community driven and we need your help in building the right things the right way you. Your opinion is very much valued so please share comments, create issues and pull requests.

We welcome any sort of contribution to this library.

The latest 2.6.0 version of this library provides is fully compatible with the latest Pepipost v2.0 API.

Table of Contents

Installation

This library relies on Node Package Manager(NPM) which will help in resolving dependencies. Hope you have latest NPM installed, if not please go ahead and follow the instruction to update NPM from here

Prerequisites

  • npm (by default installed when node is installed).
  • node
  • Pepipost library
  • A free account on Pepipost. If you don't have a one, click here to sign-up and get 30,000 emails free every month.

Quick Start

  1. To check if node and npm have been successfully installed, write the following commands in command prompt:

    • node --version
    • npm -version

    Version Check

  2. Since npm is installed, you can directly clone the pepipost reposistory using below command:

    git clone https://github.com/pepipost/pepipost-sdk-nodejs.git pepi-nodejs

    img1

    cd pepi-nodejs
    npm install 

    img2

    Once your package is installed, you will see node_modules folder.

  3. The following section explains how to use the library in a new project:

    1. Open Project Folder

      Open an IDE/Text Editor for JavaScript like Sublime Text. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.

      Click on File and select Open Folder.

      Select the folder of your SDK and click on Select Folder to open it up in Sublime Text. The folder will become visible in the bar on the left.

      Open Project

    2. Creating a Test File

      Now right click on the folder name. Select the New File option to create a new test file.

      Save it as test.js. Now import the Pepipost NodeJS library using the following lines of code:

      var lib = require('./lib');

      Save changes.

      Create new file

    3. Copy and paste the code from SampleUsage in example.js file

      Get your API key and Sending Domain from your Pepipost account.

      • apikey will be available under Login to Pepipost -> Settings -> Integration
      • Sending Domain will be available under Login to Pepiost -> Settings -> Sending Domains
  *Note :: Domains showing with Active status on Sending Domain dashboard are only allowed to send any sort of emails.* In case there are no Sending Domain added under your account, then first add the domain, get the DNS (SPF/DKIM) settings done and get it reviewed by our compliance team for approval. Once the domain is approved, it will be in ACTIVE status and will be ready to send any sort of emails. 
  1. Running the test file

    To run the test.js file, open up the command prompt and navigate to the path where the SDK folder resides. Type the following command to run the file:

      node test.js
{
   "data": {
   	"message_id": "e8820eeb0ee94807f1ce88652b1dd627"
   },
   "message": "OK",
   "status": "success"
}

Usage

'use strict';

const lib = require('lib');
const configuration = lib.Configuration;
const controller = lib.MailSendController;

configuration.apiKey = '4D51B3ECA2D4ED3A67E4E043B3F1A4D1';

let body = new lib.Send();

body.from = new lib.From();
body.from.email = 'hello@your-registered-domain-with-pepipost';
body.from.name = 'Pepipost';
body.subject = 'Pepipost Test Mail from SDK';

body.content = [];
body.content[0] = new lib.Content();
body.content[0].type = lib.TypeEnum.HTML;
body.content[0].value = '<html><body>Hello, Welcome to Pepipost Family.<br>My name is [% name %].<br>my love is sending [% love %]</body> <br></html>';

body.personalizations = [];
body.personalizations[0] = new lib.Personalizations();
body.personalizations[0].attributes = JSON.parse('{"name":"Pepi","love":"Email"}');

body.personalizations[0].attachments = [];
body.personalizations[0].attachments[0] = new lib.Attachments();
body.personalizations[0].attachments[0].content = 'SGVsbG8sIHRoaXMgZmlsZSBpcyBhbiBpbmZvcm1hdGlvbmFsIGZpbGU6OiBTZW5kaW5nIGVtYWlscyB0byB0aGUgaW5ib3ggaXMgd2hhdCB3ZSBkbywgYnV0IHRoYXTigJlzIG5vdCB0aGUgb25seSByZWFzb24gd2h5IGRldmVsb3BlcnMgYW5kIGVudGVycHJpc2VzIGxvdmUgdXMuIFdlIGFyZSB0aGUgb25seSBFU1AgdGhhdCBkb2VzbuKAmXQgY2hhcmdlIGZvciBlbWFpbHMgb3BlbmVkLg==';
body.personalizations[0].attachments[0].name = 'personalized-file.txt';

body.personalizations[0].to = [];
body.personalizations[0].to[0] = new lib.EmailStruct();
body.personalizations[0].to[0].name = 'to-address';
body.personalizations[0].to[0].email = '[email protected]';

body.tags = ['campaign'];

const promise = controller.createGeneratethemailsendrequest(body);

promise.then((response) => {
    // this block will be executed on successful endpoint call

    // `response` will be of type 'object'
}, (err) => {
    // this block will be executed on endpoint call failure

    // `err` is an 'object' containing more information about the error
});

Announcements

v5.0.0 has been released! Please see the release notes for details.

All updates to this library are documented in our releases. For any queries, feel free to reach out us at [email protected]

Roadmap

If you are interested in the future direction of this project, please take a look at our open issues and pull requests. We would love to hear your feedback.

About

pepipost-nodejs-sdk library is guided and supported by the Pepipost Developer Experience Team. This pepipost-nodejs-sdk library is maintained and funded by Pepipost Ltd. The names and logos for pepipost-nodejs-sdk are trademarks of Pepipost Ltd.

License

This code library was semi-automatically generated by APIMATIC v2.0 and licensed under The MIT License (MIT).