@buildable/events
Version:
Custom Events for Buildable
41 lines (32 loc) • 827 B
Markdown
# @buildable/events
## A NodeJS SDK for handling `Events` with Buildable workflows.
<br/>
## Emit
### NodeJS
```javascript
// require
const { createClient } = require('@buildable/events')
const client = createClient(process.env.MY_BUILDABLE_SECRET)
// ...
const successful = client.emit('EVENT-NAME', { myEssentialValue: 'Buildable rocks' });
```
### Using Curl
```bash
curl --location --request POST 'https://development-events.buildable.io/emit' \
--header 'X-Buildable-Secret: <YOUR SECRET 🤫>' \
--header 'Content-Type: application/json' \
--data-raw '{
<ANY KEY>: <ANY VALUE>,
...
}'
```
## Listen
```javascript
// import
const { createClient } = require('@buildable/events');
const client = createClient(process.env.MY_BUILDABLE_SECRET)
// ...
client.on('EVENT-NAME', (event) => {
//do stuff
})
```