Skip to content

totallytavi/instatus.ts

This branch is 2 commits ahead of, 3 commits behind Vicente015/instatus.ts:refs/heads/main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

42709ce Β· Nov 24, 2023

History

87 Commits
Apr 17, 2021
Apr 17, 2021
Apr 17, 2021
Feb 28, 2021
Feb 21, 2021
Feb 27, 2021
Apr 17, 2021
Apr 17, 2021
Feb 20, 2021
Apr 17, 2021
Nov 24, 2023
Nov 24, 2023
Jan 15, 2022

Repository files navigation

About

A Node.js library to interact with Instatus API.

  • Written in TypeScript.
  • Object-oriented.

Installation

  • With NPM: npm install instatus.ts
  • With Yarn: yarn add instatus.ts

Example usage

  • JavaScript:
    const { InstatusClient } = require('instatus.ts')
    
    // Create a client to interact with the Instatus
    const Instatus = new InstatusClient({
      key: 'YOUR_API_KEY', // You can get it in https://instatus.com/app/developer
      pageID: 'PAGE_ID' // You can get it with client.pages.get(), default to the first page
    })
    
    // Instatus.pages Returns the information of the page that you have provided in the options or the first one you have, from here you can interact with your page
    
    // Gets the website component ID to interact with it
    let websiteComponent = Instatus.pages.components.getAll().then(components => {
      // Components returns an array, find the component on it
      let websiteComponent = components.find(c => c.name == 'Website')
    
      // Add an incident that affects that component
      Instatus.pages.incidents.add({
        name: 'Website down', // Incident title
        message: 'The website is down, we are investigating it', // Incident description
        components: [websiteComponent], // Affecting components
        started: Date.now(), // The current date
        status: 'INVESTIGATING', // The incident status 
        notify: true, // Notify the users
        statuses: [ // Status of the affected components
          {
            id: websiteComponent,
            status: 'PARTIALOUTAGE' // Status of the component
          }
        ]
      })
    })

Documentation

You can see the documentation here.

About

πŸ“š Library to interact with the Instatus API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.6%
  • JavaScript 0.4%