JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q67322F
  • License MIT

Package Exports

  • @hirvi/intellipush-sdk

Readme

https://www.intellipush.com/

Unofficial Nodejs SDK for Intellipush

This SDK is actively developed and maintained by HIRVI - an official Intellipush partner.

Installation

For compatibility with Node.js versions < 12, please install the globalThis polyfill.

Via NPM

npm install @hirvi/intellipush-sdk

Via Yarn

yarn add @hirvi/intellipush-sdk

Example

// const globalThis = require('globalthis')(); // uncomment if NodeJS < NodeJS versions < 12
import { Intellipush } from '@hirvi/intellipush-sdk';

// Initialize client
const intellipush = new Intellipush({
    clientId: process.env.INTELLIPUSH_CLIENT_ID,
    clientSecret: process.env.INTELLIPUSH_CLIENT_SECRET,
})

// OAuth2 authentication
await intellipush.authenticate()

// Create SMS and send
try {
    const result = await intellipush.sms.create({
        message: 'Intellipush rocks!',
        countrycode: '0047',
        phonenumber: '1234567890'
    })

    console.log(result)
} catch (err: any) {
    return console.log(err)
}

Contact - Swagger Doc

Create contact

// Initialize and authenticate first. See above.

try {
    // Add your data directly in the create method
    const result1: IContactResponse = await intellipush.contact.create({
        name: "Tim Apple",
        countrycode: "0047",
        phonenumber: "12345678",
        email: "tim@example.com",
        company: "Apple",
        country: "USA"
    })
    
    console.log(result1) // See IContactCreateRequest
  
    // Or construct your data using our datamodels;
    const contact = new ContactModel()
            .setName('Tim cook')
            .setCountrycode('0047')
            .setPhonenumber('95091818')
            .setEmail('tim@example.com');

    const result2: IContactResponse = await intellipush.contact.create(contact)

    console.log(result2) // See IContactCreateRequest
} catch (err: any) {
    return console.log(err)
}

Update contact

// Initialize and authenticate first. See above.

try {
    const result: IContactResponse = await intellipush.contact.update({
        id: "0123456",
        name: "Tim Cook"
    })

    console.log(result) // See IContactResponse
} catch (err: any) {
    return console.log(err)
}

Get single contact

// Initialize and authenticate first. See above.

try {
    const result: IContactResponse = await intellipush.contact.get('0123456')

    console.log(result) // See IContactResponse
} catch (err: any) {
    return console.log(err)
}

List or search for contacts

// Initialize and authenticate first. See above.

try {
    const result: IContactResponse = await intellipush.contact.getContacts({
        items: 10, // Defaults to 20
        page: 1, // Defaults to 1
        query: 'Tim'
    })

    console.log(result) // See IContactsResponse
} catch (err: any) {
    return console.log(err)
}

Development status

  • Authentication
    • authenticate
    • getToken
    • setToken
  • API Resources
    • Contact
      • create
      • update
      • get
      • getContacts
      • delete
    • ContactList
      • create
      • update
      • get
      • getContactLists
      • getContactsInList
      • delete
    • SMS
      • create
      • createBatch
      • get
      • status
    • TwoFactor
      • generate
      • validate
    • Url
      • generate
      • generateChild
      • details
    • User
      • me

Need help? Feel free to contact us.

MIT