These are the instructions to install and use the JavaScript client library for Tacklebox. Tacklebox is an open-source serverless framework that offers webhooks as a service.
It includes:
- a CLI tool to deploy and manage AWS infrastructure
- 4 client libraries (JavaScript, Ruby, Python, and Go)
- a RESTful API
- a management UI
You can read more about our case study here.
Juan Palma Software Engineer Phoenix, AZ
Kevin Counihan Software Engineer Seattle, WA
Armando Mota Software Engineer Los Angeles, CA
Kayl Thomas Software Engineer Atlanta, GA
To install the JavaScript library for Tacklebox, run:
npm install tacklebox-lib
Once you install the JavaScript library for Tacklebox, you can start using it like so:
const Tacklebox = require('tacklebox-lib');
// Initialize a Tacklebox object using the API Key and API Host
// obtained after running 'tacklebox deploy'
const tacklebox = new Tacklebox(API_KEY, API_HOST);
Note: We recommend using async/await
with all supported operations.
Once you include the package and initialize a Tacklebox object, you can do many things. For example, you can create a service like so:
tacklebox.service.create({ name: 'service1' });
Once you create services, event types, users and subscriptions, you can create a new event like so:
const serviceId = "d90af763-5839-4a90-834c-5512980984f5";
const userId = "cabea1b5-b485-41b7-8146-72ece22dc458";
const eventData = {
event_type: "greet",
payload: {
message: "Hello from the JavaScript wrapper!"
},
idempotency_key: "1"
}
tacklebox.event.create(serviceId, userId, eventData);
If you want to see the message log for a specific user and service:
const serviceId = "d90af763-5839-4a90-834c-5512980984f5";
const userId = "cabea1b5-b485-41b7-8146-72ece22dc458";
tacklebox.message.list(serviceId, userId);