[SOLVED] Payload in web hook rule

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [X ] Documentation issue or request

Environment

  • [X ] Self hosted with docker
  • [ ] Self hosted with IIS
  • [ ] Self hosted with other version
  • [ ] Cloud version

Version: 7.8.0

Browser:

  • [ ] Chrome (desktop)
  • [ ] Chrome (Android)
  • [ ] Chrome (iOS)
  • [ ] Firefox
  • [ ] Safari (desktop)
  • [ ] Safari (iOS)
  • [ ] IE
  • [ ] Edge

Hi Sebastian,

This rule used to work, but I changed something and now the request body is the payload submitted as text. Instead of the enriched data.

I have the following script:

getReference(event.data.order.iv, function (references) {
	var order = references[0].data;

	var jsonObject = {
	    id: event.id,
		shippingUrl: event.data.shippingUrl.iv,
		givenName: order.ShippingAddress.iv.GivenName,
		familyName: order.ShippingAddress.iv.FamilyName,
		email: order.ShippingAddress.iv.Email,
		carrier: event.data.carrier.iv,
		trackingCode: event.data.trackingCode.iv,
		mollieId: order.MollieId.iv
	};
	complete(JSON.strigify(jsonObject));
})

and this Action Data:

{ "method": "POST", "requestUrl": "https://22c5-204-168-146-209.ngrok-free.app/api/v1/Shipping/SendShippingMail", "requestSignature": "ZyKO1v2gi0lgmuY3KNtuBZZmIo7K/RAgj6rFoUfdkt8=", "requestBody": "getReference(event.data.order.iv, function (references) {\n\tvar order = references[0].data;\n\n\tvar jsonObject = {\n\t id: event.id,\n\t\tshippingUrl: event.data.shippingUrl.iv,\n\t\tgivenName: order.ShippingAddress.iv.GivenName,\n\t\tfamilyName: order.ShippingAddress.iv.FamilyName,\n\t\temail: order.ShippingAddress.iv.Email,\n\t\tcarrier: event.data.carrier.iv,\n\t\ttrackingCode: event.data.trackingCode.iv,\n\t\tmollieId: order.MollieId.iv\n\t};\n\t\n\tconsole.log(jsonObject);\n\t\n\t\n\tcomplete(JSON.strigify(jsonObject));\n})", "requestBodyType": "application/json", "headers": { "XApiKey": "jO3!EFKtmm9@vHhZYcHrua43^321e4tdssdfsd24323sdfeEFsds" } }

But I want the request body to be something like this:
{ id: "12345", shippingUrl: "https://squidex.io", givenName: "Martijn" }

Can you help me out?

Weird. Can you verify that the rule is saved properly. Have a look to the browser network log and see if the action contains something like Script( ... ) as a wrapper.

It is a bug, it will be fixed today:

it should work if you switch to text mode for the rule and use

Script(
    your script
) 

or save the changes using postman. Just as a workaround, until the fix is ready.

1 Like

Thanks for the quick response, I’ll wait for the fix.

Can you try docker tag dev-7643.

That solves the problem! Thanks

1 Like

This topic was automatically closed after 2 days. New replies are no longer allowed.