Table of Contents
This is a Webhook Microservice project. Moleculer, a microservices framework, was used to create this microservice. The goal of this project is to create an API that allows many webhooks to be invoked at the same time.
The following are the features provided by this microservice:
- Registers new target URL's into system
- Lists out all the target URL's
- Updates the specific target URL
- Invokes all the target URL's parallely
βββ webhooks-microservice-dyte/
βββ data/
β βββ webhooks.db
βββ mixins/
β βββ db.mixin.js
βββ public/
β βββ index.html
βββ services/
β βββ api-service.js
β βββ webhooks.service.js
βββ utils/
β βββ sendRequest.js
βββ .dockerignore
βββ .editorconfig
βββ .eslintrc.js
βββ .gitignore
βββ docker-compose.env
βββ docker-compose.yml
βββ Dockerfile
βββ k8s.yaml
βββ moleculer.config.js
βββ package-lock.json
βββ package.json
βββ README.md
Make sure you have NodeJS and the Mongodb installed.
git clone https://github.com/SreemanthG/webhooks-microservice-dyte.git
cd webhooks-microservice-dyte
npm install
Development
npm run dev
Production
npm run start
Docker
docker-compose up
- Registering a target URL:
- Listing out target URL's:
- Updating a target URL:
- Trigerring all the target URL's:
- Registering a target URL:
- Listing out target URL's:
- Updating a target URL:
- Trigerring all the target URL's:
Example: http://localhost:3000/api/webhooks/register
Request body(JSON):
{
"targetUrl":"http://www.google.com"
}
Response body:
{
"_id": "iEKJVNnLPYGwPvVk"
}
Example: http://localhost:3000/api/webhooks/register
Request body(JSON):
{}
Response body:
{
"rows": [
{
"_id": "iEKJVNnLPYGwPvVk",
"targetUrl": "http://www.google.com/"
}
]
"total": 1,
"page": 1,
"pageSize": 10,
"totalPages": 1
}
Example: http://localhost:3000/api/webhooks/update/JAP611ZUF0yaVaLt
Request body(JSON):
{
"newTargetUrl":"http://www.youtube.com"
}
Response body:
{
"_id": "JAP611ZUF0yaVaLt",
"targetUrl": "http://www.google.com/"
}
Example: http://localhost:3000/api/webhooks/ip
Request body(JSON):
{
"ipAddress":"198.168.0.1"
}
Response body:
[
{
"targetUrl": "http://www.google.com/",
"_id": "JAP611ZUF0yaVaLt",
"status": 201,
"retries": 0
}
]
Feel free to send feedback on [Twitter](https://twitter.com/GSreemanth) or [file an issue](https://github.com/SreemanthG/webhooks-microservice-dyte/issues/new). Feature requests are always welcome. You can contact me at sreemanth2001@gmail.com