Title: JSON Webhook Doesn&#8217;t Work
Last modified: November 13, 2021

---

# JSON Webhook Doesn’t Work

 *  Resolved [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/)
 * I created a JSON Webhook and while the notification is triggering the resulting
   JSON output is broken. It seems as though the ability to use merge tags with 
   the JSON Webhook pretty much breaks all JSON formatting.
 * Here is an example of the JSON I’m trying to send:
 *     ```
       {
           "attachments":[
               {
                   "text":"A new plugin was activated at {plugin_activation_date_time}",
                   "color":"warning",
                   "fields":[
                       {
                           "title":"Plugin Name",
                           "value":"<{plugin_url}|{plugin_name}>",
                           "short":true
                       },
                       {
                           "title":"Plugin Version",
                           "value":"{plugin_version}",
                           "short":true
                       }
                   ]
               }
           ]
       }
       ```
   
    -  This topic was modified 4 years, 6 months ago by [Tim Nolte](https://wordpress.org/support/users/tnolte/).

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Thread Starter [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15071635)
 * So a follow-up with a wonky workaround. I was sort of able to get the basics 
   of what I was after but not using the JSON Webhook, which seems to be broken.
   I ended up using the regular Webhook, with the JSON flag, and set arguments of`
   pretext`,`color`, and `text`. I can’t use the JSON Webhook as it just doesn’t
   seem to work. If there is some special text formatting that should be used it
   would be helpful to know what that is.
 *  Thread Starter [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15071656)
 * After some more testing it just seems as though the merge tag processing just
   simply breaks any real potential use of the JSON Webhook. I’m pretty sure that
   since the merge tags are essentially a form of JSON, from a text representation
   perspective, that essentially you can’t have merge tags and JSON data.
 *  Plugin Author [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * (@kubitomakita)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15072222)
 * Yes, the merge tag format seems to be problematic when used within JSON, but 
   we already updated our regex to fix at least some of the issues.
 * We’ll test your specific scenario to see why it fails and hopefully, that will
   be an easy fix.
 *  Plugin Author [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * (@kubitomakita)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15078491)
 * [@tnolte](https://wordpress.org/support/users/tnolte/) are you using the latest
   version of the Notification plugin and you’re sure the JSON is consumed correctly
   by Slack (if I guessed correctly what’s processing the webhook)?
 * Our JSON vs Merge Tag parsing works as expected as you can see here: [https://regex101.com/r/Xovlh5/1](https://regex101.com/r/Xovlh5/1)
 *  Thread Starter [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15078738)
 * Sorry, I should have included my versions in my original post.
 * WordPress: 5.8.2
    Notification: 8.0.3
 * I did just see that a version 8.0.5 was released. Does that perhaps have a fix?
   Here is a screenshot of my latest attempt, which doesn’t work either:
 * [https://i.imgur.com/uNLGHm3.png](https://i.imgur.com/uNLGHm3.png)
 *  Thread Starter [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15078758)
 * I don’t get a notification and when I look at the notification log I can see 
   the following JSON was sent:
 *     ```
       {
           'attachments':
               }
           ]
       }
       ```
   
 *  Thread Starter [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15079465)
 * I’ve also just again tried combinations such as:
    `"text":"A new plugin was activated
   at {plugin_activation_date_time}"` or `{"text":"A new plugin was activated at{
   plugin_activation_date_time}"}` and I get nothing coming through to Slack and
   I see in the notification log:
 * **Carrier data**
    json = `"text":"A new plugin was activated at November 17, 
   2021 9:43 pm"`
 * and
 * **Carrier data**
    json =
 * respectively. This is now on the latest 8.0.5 version now as well.
    -  This reply was modified 4 years, 6 months ago by [Tim Nolte](https://wordpress.org/support/users/tnolte/).
    -  This reply was modified 4 years, 6 months ago by [Tim Nolte](https://wordpress.org/support/users/tnolte/).
 *  Plugin Author [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * (@kubitomakita)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15083887)
 * I found the issue! The empty Merge Tag stripping option was misreading JSON and
   it treated the whole structure like:
 * `{"text":"A new plugin was activated at {plugin_activation_date_time}"}`
 * as an unresolved merge tag.
 * I’ve patched it immediately so updating to 8.0.6 should help 🙂
 *  Thread Starter [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15094355)
 * [@kubitomakita](https://wordpress.org/support/users/kubitomakita/) so this still
   doesn’t work for the following example:
 *     ```
       {
           "attachments":[
               {
                   "text":"A new plugin was activated at {plugin_activation_date_time}",
                   "color":"warning",
                   "fields":[
                       {
                           "title":"Plugin Name",
                           "value":"<{plugin_url}|{plugin_name}>",
                           "short":true
                       },
                       {
                           "title":"Plugin Version",
                           "value":"{plugin_version}",
                           "short":true
                       }
                   ]
               }
           ]
       }
       ```
   
 *  Thread Starter [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15094368)
 * [@kubitomakita](https://wordpress.org/support/users/kubitomakita/) I tested your
   code changes with my JSON string, and even tested your original `clear()` regular
   expression pattern, and that’s not the problem with the code. You can test it
   out here [here](https://www.phpliveregex.com/p/CKC).
    -  This reply was modified 4 years, 6 months ago by [Tim Nolte](https://wordpress.org/support/users/tnolte/).
    -  This reply was modified 4 years, 6 months ago by [Tim Nolte](https://wordpress.org/support/users/tnolte/).
    -  This reply was modified 4 years, 6 months ago by [Tim Nolte](https://wordpress.org/support/users/tnolte/).
 *  Plugin Author [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * (@kubitomakita)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15096538)
 * That’s weird. I tested with your specific scenario. The cleaning happen when 
   all the rest merge tags are resolved.
 * See this clearer examples:
 * Old regex: [https://regex101.com/r/dutwpF/1](https://regex101.com/r/dutwpF/1)
   
   New regex: [https://regex101.com/r/HcQmvs/1](https://regex101.com/r/HcQmvs/1)
 * I’ve replaced correct merge tags with `Rendered` string.
 * You say updating to v8.0.6 doesn’t give correct results?
 *  Thread Starter [Tim Nolte](https://wordpress.org/support/users/tnolte/)
 * (@tnolte)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15096716)
 * Correct I’m using the latest version of WordPress and the latest version of the
   Notification plugin and I get no notifications to the webhook and I still end
   up with the following in the Notification logs:
 *     ```
       {
           'attachments':
               }
           ]
       }
       ```
   
 * If it test the “simple” single text field version it works now.
 *  Plugin Author [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * (@kubitomakita)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15103209)
 * I just found out that it works on my local but not on another live host, so this
   much be something related to how the regex is parsed. I’m investigating it.
 *  Plugin Author [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * (@kubitomakita)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15131997)
 * Another fix has been released in v8.0.7. It was related to shortcode stripping
   option as well.

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘JSON Webhook Doesn’t Work’ is closed to new replies.

 * ![](https://ps.w.org/notification/assets/icon-256x256.gif?rev=3476901)
 * [Notification - Custom Notifications and Alerts for WordPress](https://wordpress.org/plugins/notification/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/notification/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/notification/)
 * [Active Topics](https://wordpress.org/support/plugin/notification/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/notification/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/notification/reviews/)

## Tags

 * [json](https://wordpress.org/support/topic-tag/json/)
 * [webhook](https://wordpress.org/support/topic-tag/webhook/)

 * 14 replies
 * 2 participants
 * Last reply from: [Kuba Mikita](https://wordpress.org/support/users/kubitomakita/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/json-webhook-doesnt-work/#post-15131997)
 * Status: resolved