2017 © Pedro Peláez
 

magento2-module magento2-module-webhook

Webhooks for Magento 2

image

sweettooth/magento2-module-webhook

Webhooks for Magento 2

  • Friday, September 18, 2015
  • by sweettooth
  • Repository
  • 26 Watchers
  • 40 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 16 Forks
  • 5 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Note: This is alpha software and not to be used in production until v1.0.0, (*1)

Webhooks for Magento 2

Preview, (*2)

This module provides webhooks for Magento 2 events. Inspired by Alan Kent's's Webhooks in Magento 2 blog post which mentions a rough timeline for getting webhooks in Magento 2 core:, (*3)

Better support for webhooks is on the backlog, but currently not guaranteed for Magento 2 GA., (*4)

We're hopeful the community can help push this effort forward through this module., (*5)

Getting Started

Install via composer, (*6)

composer require sweettooth/magento2-module-webhook

Add SweetTooth_Webhook to your app/etc/config.php, (*7)

<?php
return array (
  'modules' => 
  array (
    //
    // Bunch of other modules
    // 
    'SweetTooth_Webhook' => 1,
  ),
);

Run database migrations, (*8)

php bin/magento setup:upgrade

Supported Webhooks

Available now - Customer updated - Customer deleted - Order updated - Order deleted - Product updated - Product deleted, (*9)

TODO - Customer created - Order created - Product created - CRUD operations for other resources, (*10)

Roadmap and areas for discussion

Async webhooks (RFC)

Without async webhooks, this module is pretty much a no-go for production shops - the dependency on third party systems is just too risky to do synchronously. The best practice for performing tasks asynchronously is to queue it up on a memory store (redis, memcache, etc) and have a background worker pick up the job and perform it, meanwhile the synchronous request returns immediately. Since there's no native queueing for Magento 2, our best bet might be to use the database as a 'queue' ("Blasphemy!" you say. Chill, magento already does this in the newsletter module) then use the cron to pick up the jobs every minute., (*11)

Serialization (RFC)

Right now serializing the payload of the webhook is super basic, just calling getData() on the model. This is all kinds of bad because it will expose sensitive information like password hashes and such. A better strategy would be to create a serializer for each resource. An even better strategy is if we could re-use the serializer for the REST API so our webhook data has an identical json structure to the API. Boom., (*12)

Extensibility

It would be really cool to make this module extendible so other modules could add events that can be webhook'd, (*13)

Creating webhooks through the API

This is a really legit use case. An app that has API access to a shop may want to register webhooks to receive CRUD events on specific resources that they would otherwise need to poll for every x hours. Both Shopify and Bigcommerce have this endpoint and it's lovely., (*14)

Data formats

We should probably support XML someday. sigh, (*15)

Contributing

Submit a pull request!, (*16)

The Versions

18/09 2015

dev-master

9999999-dev

Webhooks for Magento 2

  Sources   Download

MIT

The Requires

 

17/09 2015

0.2.0

0.2.0.0

Webhooks for Magento 2

  Sources   Download

MIT

The Requires

 

17/09 2015

dev-order-webhooks

dev-order-webhooks

Webhooks for Magento 2

  Sources   Download

MIT

The Requires

 

17/09 2015

dev-product-webhooks

dev-product-webhooks

Webhooks for Magento 2

  Sources   Download

MIT

The Requires

 

17/09 2015

dev-customer-create-webhook

dev-customer-create-webhook

Webhooks for Magento 2

  Sources   Download

MIT

The Requires

 

14/09 2015

0.1.0

0.1.0.0

Webhooks for Magento 2

  Sources   Download

The Requires