Skip to main content
Question

Add my own attributes to Webhook JSON-response?

  • October 18, 2023
  • 1 reply
  • 20 views

Hi,

 

I'm looking for a way to add my own key:value pairs/object to the Webhook JSON-response.

 

The default webhook JSON response is:

{"serviceResponse": {
   "jobID": 294,
   "statusInfo": {
      "mode": "sync",
      "status": "success"
   }
}}

Woud like to add something like:

{"serviceResponse": {
   "jobID": 294,
   "statusInfo": {
      "mode": "sync",
      "status": "success"
   }
   "productData" : {
      "productVariant" : "type1" // = $(productVariant)
   }
}}

 Not sure if it is possible at all. All suggestions are welcome.

Thanks!

 

1 reply

siennaatsafe
Safer
Forum|alt.badge.img+12
  • Safer
  • 214 replies
  • October 20, 2023

Hi @michielzoer​ ,

 

The only way I can think of to customize the JSON is to create another writer in your workspace and use the data streaming service to send JSON back to the user.

 

In FME, you can write JSON. Then, you can set up the data streaming service to stream the JSON. 2023-10-20_13-14-50Then, you can step up a webhook using the data streaming service. Please Part 2: Webhook URLs and the Data Streaming Service in this article.