django-rest-hooks icon indicating copy to clipboard operation
django-rest-hooks copied to clipboard

Hook Data Templates

Open lylepratt opened this issue 10 years ago • 3 comments

Hi!

We've been thinking about our shiny new RestHooks and thought that it would be neat if there was another column in the Hooks table that let you define an option "template" for the hook data if the hook destination needed it in an alternative format.

Very Simple example. Say I have this normal hook response defined in serialize_hook, but the data destination is expecting "phone_number" instead of "from_number":

data  = {
   'from_number': self.from_number
}

With hook templates I could change that to:

{
    'phone_number': {from_number}
}

Thoughts?

-Lyle

lylepratt avatar Nov 21 '13 17:11 lylepratt