How sallaapp/webhook-actions-js works
Project type and purpose
• This is an open-source Node.js library/module (“@salla.sa/webhooks-actions”) designed to simplify receiving and handling webhooks from the Salla e-commerce platform.
• It provides a dispatcher (SallaWebhook) that validates incoming HTTP POSTs, matches events against user-defined listeners or action files, and invokes the correct handler.
File structure
• Top-level:
– .github/, dependabot.yml → CI/CD and security scanning configs
– package.json, package-lock.json → module metadata and dependencies
– README.md → high-level overview and usage patterns
• src/Actions.js → core dispatcher implementation
• example/… → a sample Express.js app showing two integration patterns:
– “using listeners” (programmatic registration)
– “using folder structure” (auto-load JS files under example/Actions)
• test/ → unit tests for Actions.js
• dynamic/github-code-scanning → security code-scanning config (CodeQL)
Key insights from the README
• Two integration modes: listeners vs. folder-based loading of action files
• Environment variables (SALLA_WEBHOOK_SECRET, OAuth credentials) drive authorization and mode
• Central workflow: Salla invokes your HTTP endpoint → SallaWebhook.checkActions() → validate secret/auth header → dispatch to handler
• Predefined action names mapped to files under an Actions directory (e.g., order.created, customer.login)