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

apigum-sdk

v1.0.2

Published

apigum is npm library for managing integrations between popular cloud applications like Twilio, SendGrid, Shopify and others.

Downloads

18

Readme

apigum-sdk

Build Status Dependencies NPM version

apigum-sdk is npm library for managing integrations between popular cloud applications like Twilio, SendGrid, Shopify and others.

Installation

  • npm install apigum-sdk --save

Usage

  • Log into your apigum.com account to obtain your API Key.
  • You'll also need to obtain the relevant application keys. For example secret key for Stripe or Subdomain and Api Key for Freshdesk.
  • This library makes calls to the apigum REST API.
  • This SDK includes a current snapshot of supported integrations. This of course can be overriden by picking up new integration ids @ apigum.com.

Import Module

  // Import a module
  const {Integration, Apps, AppHelper} = require('apigum-sdk')

Setup

  const freshdeskCredentials = {}
  const stripeCredentials = {}

  //set up credentials
  freshdeskCredentials[Apps.Freshdesk.Keys.Apikey] = "<your Freshdesk api key>"
  freshdeskCredentials[Apps.Freshdesk.Keys.Subdomain] = "<your Freshdesk subdomain>"

  //set up credentials
  stripeCredentials[Apps.Stripe.Keys.Secretkey] = "<your Stripe secret key>"

  //obtain api key at https://account.apigum.com/api
  const apiKey = "<Your API key>"
  //create integration instance
  const integration = new Integration(apiKey);

Create Integration

  const freshdesk = AppHelper.configure(Apps.Freshdesk.AppId, this.freshdeskCredentials);
  const stripe = AppHelper.configure(Apps.Stripe.AppId, this.stripeCredentials);

  integration.create(freshdesk, stripe,
      Apps.Freshdesk.Integrations.CREATE_FRESHDESK_CONTACT_FOR_NEW_STRIPE_CUSTOMERS)
      .then(id => {
          // returns id of created integration
      })
      .catch(err => console.log(err));

  //You may clone other integrations on apigum.com by using the id (last part) in the URL:
  //e.g.: https://www.apigum.com/Integrations/{integration-id}

Update Integration

    const script = fs.readFileSync(path.resolve(__dirname, "./integration.js"), "utf8");
    
    integration.updateScript(integrationId , script)
        .catch(err => console.log(err));  

Sample integration.js

//Integration code for => "Create Freshdesk contact for new Stripe customers"
  var freshdesk={};

  function setElements(stripe) {
      freshdesk.name = stripe.description;
      freshdesk.email = stripe.email;

  }

  function template() {
      return `{
    "name": "${freshdesk.name}",
    "email": "${freshdesk.email}",
    "other_emails": []
  }`;
  }

  module.exports = function (context, events) {

      let actions = [];

      for (let event of events.body) {
          setElements(event);
          actions.push(template());
      }

      context.res = {
          body: actions
      };

      context.done();
  };            

Delete Integration

  integration.delete(integrationId)
    .catch(err => console.log(err));

Start Running

  //by default integrations start running when created
  //this method may be used if integration has been stopped.
  integration.publish(integrationId)
    .catch(err => console.log(err));

Stop Running

  //suspends integration data synchronization
  integration.unpublish(integrationId)
    .catch(err => console.log(err));

For product information please visit our site at https://www.apigum.com