jeroentvb / IFTTT-webhooks-channel

Tiny package to trigger an IFTTT event using the webhooks channel

Home Page:https://www.npmjs.com/package/ifttt-webhooks-channel

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ifttt-webhooks-channel

npm version Maintainability
Tiny package to trigger an IFTTT event using the webhooks channel

Table of contents

Installation

npm install ifttt-webhooks-channel

Usage

// Import the module in your project
import IFTTT from 'ifttt-webhooks-channel'

// Create a new IFTTT instance
const Ifttt = new IFTTT(key) // key is where your webhooks channel key goes

Methods

A list of methods that IFTTT contains

Post

Sends a post request to the webhooks channel to trigger an ifttt event.

Ifttt.post(eventName, value)
  .then(res => console.log(res))
  .catch(err => console.error(err))

eventName is the name of the event you should have created on the webhooks channel.
value should be an array containing at most 3 values. These can be used in the action you attatch to the event when it's triggered, e.g. a notification.

The function returns the response object if the post was succesful. If there was some kind of error it returns an error object.

Example

import IFTTT from 'ifttt-webhooks-channel'
const Ifttt = new IFTTT('your_webhooks_channel_key')

Ifttt.post('event_name', [
  'value 1',
  'item 2',
  'string 3'
])
  .then(res => console.log(res))
  .catch(err => console.error(err))

About

Tiny package to trigger an IFTTT event using the webhooks channel

https://www.npmjs.com/package/ifttt-webhooks-channel

License:MIT License


Languages

Language:JavaScript 100.0%