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

upflo

v1.1.0

Published

A library to help automate backend customer service and marketing tasks.

Downloads

10

Readme

Upflo

Upflo is a versatile backend library, developed in TypeScript. It offers functionalities that simplify and automate many common and repeatable tasks, including managing HelpDesk tickets, managing contacts, and email sending. This allows developers to focus on creating solutions that deliver outstanding customer experiences and improve marketing efficiency.

Features:

  1. Contacts: Provides functionality to manipulate contact data in your database such as creating, updating, retrieving, and deleting contacts.
  2. Help Desk: Provides a simple and efficient mechanism to manage helpdesk tickets ranging from creating, updating, deleting, to comprehensive listing functionalities.
  3. Email: Helps you to integrate with email provider Mailgun for seamless transmission of information to your contact list.
  4. Workflows: Helps you create, manage, and execute workflows.

How to install:

$ npm install upflo

How to use:

//upflo.js

import { Upflo, MailgunProvider } from "upflo";
import { DataSourceOptions } from "typeorm";

const options: DataSourceOptions = {
  /* Your database options */
  database: "mydb.sql",
  type: "sqlite",
};

const emailProvider = new MailgunProvider({
  username: "api",
  key: "api-key",
  domain: "your_domain",
});

const upflo = new Upflo(options, emailProvider);

export upflo

Documentation:

Workflows

The Workflows module in the Upflo library allows you to create, manage, and execute workflows for sending email events at specified times.

Building Workflows

The package provides a fluent API for building workflows. Here's how you can create a new workflow:

const workflow1 = upflo.workflows
  .create()
  .setName("workflow1")
  .setDescription("workflow description")
  .addEmailEvent({
    body: "Hello test",
    sendDelay: 0,
    sendFrom: "[email protected]",
    subject: "This is a test",
  })
  .build();

Starting Workflows

You can start a previously defined workflow for a specific contact by using the startWorkflow method:

await upfloWorkflows.startWorkflow(workflow1, "[email protected]");

Managing Workflows

You can manage workflows with the following methods:

// Save a workflow to the database
await upflo.workflows.save(workflow);

// Retrieve a workflow
const workflow = await upflo.workflows.retrieve(workflowID);

// Delete a workflow
await upflo.workflows.delete(workflowId);

// List a workflow
const workflows = await upflo.workflows.list();

Handling Events

Upflo provides an event handling mechanism using the Node.js EventEmitter class. You can use this to listen to and emit custom events within your application.

on(event: string, listener: (...args: any[]) => void)

The on method allows you to register event listeners. When the specified event is emitted, the listener function will be executed.

  • event (string): The name of the event you want to listen to.

  • listener (function): The function to be called when the event is emitted. It can accept any number of arguments.

emit(event: string, ...args: any[])

The emit method allows you to trigger (emit) a custom event with optional data arguments.

  • event (string): The name of the event to emit.

  • ...args (any[]): Optional data arguments to pass to event listeners.

Example:

// Register an event listener
upflo.on("contact.created", (contactId: number) => {
  console.log(`Contact with ID ${contactId} has been created.`);
});

// Emit a custom event
upflo.emit("contact.created", 123);

Contacts

The Contacts class within the Upflo library provides methods for managing contacts. It includes functionalities such as retrieving, creating, updating, and deleting contacts.

// Retrieve a contact
const contact = await upflo.contacts.retrieve(contactId);

// Create a contact
const newContact = await upflo.contacts.create(contactData);

// Update a contact
const updatedContact = await upflo.contacts.update(contactId, contactData);

// Delete a contact
await upflo.contacts.delete(contactId);

Lists

The Lists class within the Upflo library provides methods for managing lists. It includes functionalities such as retrieving, creating, updating, deleting lists, and managing contacts within a list.

// Retrieve a list
const list = await upflo.contacts.lists.retrieve(listId);

// Create a list
const newList = await upflo.contacts.lists.create(listData);

// Update a list
const updatedList = await upflo.contacts.lists.update(listId, listData);

// Delete a list
await upflo.contacts.lists.delete(listId);

// List all lists
const lists = await upflo.contacts.lists.list();

// Add a contact to a list
const modifiedList = await upflo.contacts.lists.addContact(
  listAddContactParams
);

// Remove a contact from a list
await upflo.contacts.lists.removeContact(listRemoveContactParams);

Tags

The Tags class within the Upflo library provides methods for managing tags. It includes functionalities such as retrieving, creating, updating, deleting tags, and assigning/removing tags to/from contacts.

// Retrieve a tag
const tag = await upflo.contacts.tags.retrieve(tagIdentifier);

// Create a tag
const newTag = await upflo.contacts.tags.create(tagData);

// Update a tag
const updatedTag = await upflo.contacts.tags.update(tagId, tagData);

// Delete a tag
await upflo.contacts.tags.delete(tagId);

// List all tags
const tags = await upflo.contacts.tags.list();

// Assign a tag to a contact
const modifiedTag = await upflo.contacts.tags.assign(tagAssignParams);

// Remove a tag from a contact
await upflo.contacts.tags.removeTag(tagRemoveParams);

HelpDesk

The HelpDesk class within the Upflo library is responsible for managing helpdesk tickets. It provides functionality to retrieve, create, update, and delete tickets.

// Retrieve a ticket
const ticket = await upflo.helpdesk.tickets.retrieve(ticketId);

// Create a ticket
const newTicket = await upflo.helpdesk.tickets.create(ticketData);

// Update a ticket
const updatedTicket = await upflo.helpdesk.tickets.update(ticketId, ticketData);

// Delete a ticket
await upflo.helpdesk.tickets.delete(ticketId);

Email

The Email class within the Upflo library allows the sending of emails. It requires an existing database connection and an EmailProvider to send the email through the specified email provider.

// Send an email
await upflo.email.sendEmail(to, subject, body);

Getting Help:

If you have questions or need further guidance on using this library, please file an issue on the GitHub repository.

License:

Upflo is provided under the MIT License