1.3.0 • Published 8 years ago
grpc-webhook v1.3.0
gRPC webhook
A simple gRPC webhook service backed by Cassandra.
Installation
$ npm i grpc-webhook -g
Usage
$ env CASSANDRA_HOSTS="cs01,cs02,cs03" \
CASSANDRA_KEYSPACE="test" \
GRPC_PORT="55000" \
grpc-webhook
[*] Server listening on 0.0.0.0:55000
Definition
See webhook.proto for full definition.
Webhook object
message Webhook {
string hash = 1; // a unique hash identifier. eg: a user id
string event = 2; // an event associated with this hash
string method = 3; // HTTP method to use when webhook is triggered
string url = 4; // HTTP url to call when webhook is triggered
}
Methods
register
Register a new webhook.
client.register({
hash: '68ff8fc67850e32a738a5c328e6cfd03',
event: 'job:complete',
method: 'POST',
url: 'http://example.com/webhooks/job/{{hash}}?event={{event}}'
});
trigger
Trigger a webhook.
client.trigger({
hash: '68ff8fc67850e32a738a5c328e6cfd03',
event: 'job:complete'
});
TODO
- Improve documentation
- HTTPS support
- Support for gRPC Credentials
- Trigger webhook with optional metadata
License
MIT