New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chattycrow

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chattycrow

Chatty Crow client library to call Chatty Crow API.

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

!http://chattycrow.com/crow3logo.png!

h1. ChattyCrow - Node JS library

This library makes easier to call ChattyCrow API (http://chattycrow.com/).

h2. Installation

npm install chattycrow

h2. Usage

var chattycrow = require('chattycrow').createClient('token', 'default_channel');

h3. Optional parameters

Every sender and contacts methods header:

send(payload, callback, contacts, options);

h3. Email notification - TODO

Not yet implemented!

h3. IOS Push notification

// Callback function
function pushResponse(res, body, err) {
  if (err) {
    console.log(err.message);
  }

  if (res) {
    console.log(res);
  }

  if (body) {
    console.log(body);
  }
}

// Send push
chattycrow.sendIos({ payload: { 'hello' }}, pushResponse, [ 'contacts', 'contact2' ], {channel: 'other', token: 'not_default'})

h3. Android Push notification

// Send message
chattycrow.sendAndroid({ payload: { data : { key1 : 'hello' }}, pushResponse, [ 'new_ios_id1', 'contact2' ], {channel: 'other', token: 'not_default'})

h3. Skype notification

// Send request
chattycrow.sendSkype('Skype message', pushResponse, [ 'skype', 'skype2' ])

h3. Jabber notification

// Send request
chattycrow.sendJabber('Jabber message', pushResponse)

h3. SMS notification (only Czech Republic yet)

// Sms notification
chattycrow.sendJabber('SMS message', pushResponse, [ '+420 123 456 789' ])

h2. Working with contacts via API

It's actually very usable, you can automatically add or remove contacts in your application after user was registered.

h3. Contact list

function contactList(res, body, err) {
  if (err) {
    console.log(err.message);
  }

  if (res) {
    console.log(res);
  }

  if (body) {
    console.log(body.contacts);
  }
}

// Get contacts
chattycrow.getContacts(contactList, { channel: 'other than default' })

h3. Add contact

function contactAddResult(res, body, err) {
  if (err) {
    console.log(err.message);
  }

  if (res) {
    console.log(res);
  }

  if (body) {
    console.log('Status: ' + body.status);
    console.log('Message: ' + body.msg);
    console.log('Stats: ' + body.stats.success + '/' + body.stats.exists + '/' + body.stats.failed);
  }
}

// Add contacts
chattycrow.addContacts(['test1', 'test2'], contactAddResult, { channel: 'other than default' })

h3. Remove contact

function contactRemoveResult(res, body, err) {
  if (err) {
    console.log(err.message);
  }

  if (res) {
    console.log(res);
  }

  if (body) {
    console.log('Status: ' + body.status);
    console.log('Message: ' + body.msg);
    console.log('Stats: ' + body.stats.success + '/' + body.stats.failed);
  }
}

// Add contacts
chattycrow.removeContacts(['test1', 'test2'], contactRemoveResult, { channel: 'other than default' });

Keywords

FAQs

Package last updated on 01 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc