Search

I, once again, have decided to jump back into learning Symphony through creating extensions. For this particular one, I wanted to provide Symphony with the ability to attach custom webhooks to section content.

Basically, the way it works is for each new webhook you specify the section you want to associate it with. Then, you attach it to an add, edit or delete event for the associated entries of the chosen section. Finally, you just give it a URL to notify when the hook is triggered.

When you add an entry to your 'Articles' section, Symphony will automagically send a notification, using the appropriate HTTP methods (POST|PUT|DELETE), to the associated URL. The notification will be an XML representation of the entry.

It's nothing complex, but it's a good exercise.

Anyhow, I'm posting about it here because I want some feedback from you guys. It's a simple plugin, but it can be quite useful in terms of creating notification and synchronisation services. What would be some things you'd like to see implemented?

I'll keep you all posted on my progress!

There is a Rest API extension already.

@welhelm, correct me if I'm wrong, but @michael, it seems this is the exact opposite of the Rest API extension. This extension will not accept the POST,PUT,DELETE but send them to other applications.

Sounds pretty handy! It could be useful to leave enough room for customised formats though, then this extension can also be used to export invoices to PDF (for instance), or to manage a static site on S3.

@wilhelm, take a look at the Scaffolds extension. This is meant for Symphony structure, but also creates a META language to export Symphony information. I believe it uses JSON format. Maybe you can format your meta information in the same way to create a more unified approach.

Ah, I see, I understood this wrong. It's s great idea indeed!

Take a looksee at designermonkey's Twitter Notifier. I haven't used it yet, but I think it can be set up to do the same sort of thing.

Which, incidentally is based on Willhelm's original Twitter Notifier.

The Twitter Notifier is set up to specifically use oAuth and Twitter's oAuth system, so I don't know how customizable it would be.

@michael-e Yep, I suppose, conceptually, this would be the opposite of a RESTful API. This is mainly for push notifications only.

@creativedutchmen Yessir, I'm definitely considering implementing another (sub)extension API dedicated to this extension later on down the road. I'm thinking something along the lines of how GitHub implements webhooks.

Something like, selecting from dropdown list containing supported external services like, Twitter, Facebook, etc.., automatically populating the rest of the form, configuring the service and saving it.

@remie Different output formats are also on the roadmap. I really like the idea of a unified approach concerning a JSON-based META language. Perhaps a way of adding custom output formats to select from as well. Could be implemented using the aforementioned (sub)extension idea.

@nickdun & @designermonkey Yeah, I kind of lost a lot of free time around when I originally wrote that extension. Though, this extension could potentially replace the twitter notifier all together.

At the moment, I want to get the first iteration out the door. Taking a minimum viable product approach with this one so people can start playing with it immediately.

Thanks for your interest, peeps! Currently at the Adelaide airport Vigin Lounge, so I don't have the luxury of being able to post screenshots of my progress and such. Though, I'll admit, writing this extension gave me another idea; boilerplate extension libraries. I see myself repeating a lot of steps in order to get up and running when creating extensions.

another idea; boilerplate extension libraries. I see myself repeating a lot of steps in order to get up and running when creating extensions

Try the Symphony Developer Extension Kit and fork and patch if you fancy taking it further :-)

Though, this extension could potentially replace the twitter notifier all together.

Which could quite annoy me. It took me a long time to do that, and only because the community wanted it, as I won't use it myself.

@designermonkey Haha, YOU CAN'T STOP PROGRESS!!! On a serious note, if I were to integrate some kind of Twitter sub extension (not a priority), it wouldn't be anywhere near as advanced as yours. Besides, not everyone is going to want a full-blown push notification feature. I recon most users would be more than happy with the one you made, sir.

  • monocle

Tiny status update on this for those who are still interested. I've decided to go ahead and create a plugin architecture so others can easily write plugins for integration with other types of services. Working the design at the moment, but, once I'm finished, it shouldn't take long at all to throw together.

This extension idea has a very high potential. I am really looking forward to get my hands dirty with it. :-)

So you'd be able to add an image entry to a flickr set for example? (at least once we have a way to save JIT as a new image)

@newnomad: Sure, I don't see why it wouldn't/shouldn't do something like this. :) @micheal-e: I'm looking forward to finishing it!

Alright, so it's taking a bit longer to get the ideal plugin architecture out the door (work-related stuff), so I'm going to go ahead and put the initial version of this thing out the door.

For those who are wondering, the default payload will be in the following JSON format:

[
   {
      "id":"1",
      "element_name":"title",
      "type":"input",
      "location":"main",
      "value":{
         "value":"Push Test (PUT)",
         "handle":"push-test-put"
      }
   },
   {
      "id":"2",
      "element_name":"body",
      "type":"textarea",
      "location":"main",
      "value":{
         "value":"<p>This is a test.</p>",
         "value_formatted":"<p>This is a test.</p>"
      }
   },
   {
      "id":"23",
      "element_name":"documents",
      "type":"subsectionmanager",
      "location":"sidebar",
      "value":'/path/to/document.doc'
   }
]

I did manage to run into a small issue with class.gateway.php. Unfortunately, the current version does not support the standard set of HTTP verbs, so I couldn't create a notification using the relevant header information in the HTTP request. At least, not without including a more extensive HTTP request lib or modifying the existing gateway class.

I have bigger plans for this extension, but its current state will have to do until I find a bit more time. Just need to throw together some decent documentation and get a working build up for testing. :)

Current build is here: webhooks @github

At least, not without including a more extensive HTTP request lib or modifying the existing gateway class.

If you want to modify the Gateway class so that it does work with the HTTP verbs, I'd be happy to look at it and merge it into the core.

Sweet, I'll be sure to do that and initiate a pull request when I'm done. :)

@wilhelm, any further update on your WebHooks extension?

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details