# graphcool-webhook-invoker

> Invoke webhooks from your command line without re-adding the data

Latest version **0.0.3** (published 2017-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install graphcool-webhook-invoker
pnpm add graphcool-webhook-invoker
yarn add graphcool-webhook-invoker
bun add graphcool-webhook-invoker
```

Provides the command `graphcool-webhook-invoker`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2017-04-21 |
| First published | 2017-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Emanuel Jöbstl |
| Maintainers | ejoebstl |
| Keywords | graphql, graphcool, mutation, testing, data |

## Links

- npm: https://www.npmjs.com/package/graphcool-webhook-invoker
- Repository: https://github.com/ejoebstl/graphcool-webhook-invoker
- Homepage: https://github.com/ejoebstl/graphql-webhook-invoker#readme
- Issues: https://github.com/ejoebstl/graphql-webhook-invoker/issues
- npm.io page: https://npm.io/package/graphcool-webhook-invoker

## Dependencies (3)

- [chai](https://npm.io/package/chai.md) ^3.5.0
- [popsicle](https://npm.io/package/popsicle.md) ^9.1.0
- [babel-runtime](https://npm.io/package/babel-runtime.md) ^6.23.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 0.0.3 (latest) — 2017-04-21
- 0.0.2 — 2017-04-07
- 0.0.1 — 2017-04-07

## README

![Build Status](https://travis-ci.org/ejoebstl/graphcool-webhook-invoker.svg?branch=master)

# graphcool-webhook-invoker

Test driven development, what could go wrong? :rocket: :see_no_evil:

Manually invokes [graphcool](http://graph.cool) webhooks with existing data.

Useful for testing, but please use with care.  

## Usage

#### As command line tool

```sh
npm install -g graphcool-webhook-invoker
```

```sh
graphcool-webhook-invoker \
    cj17fjzs741pu0113oub8rndw \ # The ID of your project 
    cj17fk4k8b1750141v5mpai88 \ # The node ID to call the hook for
    CREATE \ # The type of trigger to call the hook for
    eyJhbGciOiJub25lIiwidHlwIj... # Your JWT access token
```


#### As module

```sh
npm install --save graphcool-webhook-invoker
```

```javascript
import invoke from 'graphql-webhook-invoker'

const projectId = 'cj17fjzs741pu0113oub8rndw' // The ID of your project
const nodeId = 'cj17fk4k8b1750141v5mpai88' // The node ID to call the hook for
const trigger = 'CREATE' // The type of trigger to call the hook for
const token = 'eyJhbGciOiJub25lIiwidHlwIj...' // Your JWT access token

invoke(projectId, nodeId, trigger, token)
    .catch(error => console.log('Oh no: ', error)) 
    .then(res => 
        res.map(r => 
            console.log('Invoked: ', r.webhook, r.data, r.response)))

```

This will example would call the `CREATE` webhook for the node with id `cj17fk4k8b1750141v5mpai88` of project `cj17fjzs741pu0113oub8rndw`, as if it was called by graphcool .

## Limitations

`graphcool-webhook-invoker` is built upon undocumented APIs of graphcool. It might break without notice. 

Also, this project uses a very hacky way of resolving fragments for the webhook payload. It will, besides other things, break as soon as there are unmatching curly braces (`{`, `}`) inside strings.

## Why should I use this? 

Architectures that tie many services together are easy to build with graphcool. These services are usually connected via webhooks. Webhooks which are coming from graphcool might be painful to debug, since fireing a webhook requires mutation of the corresponding data. This tool allows you to fire a webhook for a node without touching the corresponding data. 

While you should never use `graphcool-webhook-invoker` in production, it can be incredibly helpful when debugging webhooks.

---
_Source: https://npm.io/package/graphcool-webhook-invoker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
