Notify API improvements.

- Return JSON.
- Fix email template context.