npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

medusa-plugin-webhooks

v0.1.0

Published

A Medusa plugin that gives webhooks functioanlity

Readme

Medusa Plugin Webhooks

Banner

About

Participants

Description

A Medusa plugin giving the power of webhooks to your Medusa store. Receive notifications on discord, slack or anywhere where webhooks can be consumed on events on from your store.

Features

  • A helper function to send webhooks from your custom code
  • A webhook for order-related events
  • Ability to assign custom webhook urls to every event

Preview

Flowchart

Setting up the Medusa Webhooks Plugin

Prerequisites

Install and Setup the Webhooks Plugin

To install the plugin using NPM, run the following command in your Medusa server directory:

npm install medusa-plugin-webhooks

If you prefer using Yarn, run the following command in your Medusa server directory:

yarn add medusa-plugin-webhooks

Once the plugin is installed, we need to add it to the plugins array in the medusa-config.js file in your Medusa server directory:

const plugins = [
  ...{
    resolve: "medusa-plugin-webhooks",
    options: {
      webhook_url: "https://mystore.com/events", // REQUIRED: CHANGE THIS TO A VALID WEBHOOK ENDPOINT
      webhook_headers: {
        "x-api-key": "supersecretapikey", // You can add custom headers (for example, for authentication)
      },
      webhook_config: {
        "order.placed": {
          enabled: true,
          overrideUrl: "https://mystore.com/events/order-placed", // You can override the URL on a per-event basis,
          overrideHeaders: {
            "x-api-key": "supersecretorderplacedapikey", // You can override the headers on a per-event basis
          },
        },
      },
    },
  },
];

Currently these 4 events are supported:

  • order.placed
  • order.updated
  • order.completed
  • order.canceled

By default, notifications for all events are disabled. To enable notifications for any of the above events, set the enabled property to true in the webhook_config object. (see example above)

You can override the URL or headers for any of the above events by setting the overrideUrl or overrideHeaders properties in the webhook_config object. (see example above)

Sending a webhook event from your custom code

You can post a webhook from your code by resolving the webhooks service and then using the postWebhook function. For example:

const webhooksService = scope.resolve("webhooksService");
await webhooksService.postWebhook(
  {
    event: "order.placed",
    data: {
      order_id: "order_id",
      customer_id: "customer_id",
      total_price: 1000,
      currency_code: "USD",
      metadata: {},
    },
  },
  "mystore.com/events/custom", // You can pass in an URL override here as well
  {
    "x-api-key": "customeventsapikey", // You can pass in custom headers here as well
  }
);

If you face any issues or have any questions, feel free to open an issue

Contributing

If you want to suggest a new feature, open a new issue with the feature request template. For bug reports, use the bug report issue template.

To make a pr, fork the repository, clone it, create a new branch that describes the new feature or the bug it is fixing. Then make the required changes, commit them (we strongly recommend that you follow the Conventional Commits specification and gitmojis are welcome as well). The next step is to create a pull request and a maintainer will review it as soon as possible.

License

This project is licensed under the MIT License - see the LICENSE file for more details.

The plugin structure was inspired by the official Sendgrid plugin and borrows some code from it.

Resources