Support Portal

for ProcessRobot and WinAutomation

Start a new topic
Answered

Using a variable in a JSON Body

I am trying to see if I can get winautomation to post to Discord using webhooks.  I have some very basic content to post to a discord channel.


I can can make it work for static text, just use the winautomation web service and the predefined webhook URL and the Request Body being {"content":"my discord post"}


But when I try and use a winautomation variable in the content, the webhook doesn't understand it... Any suggests on whether and if this can be done?

I wanted something like Request Body to be {"content":"%mydiscordpostvar%"}


Best Answer

Yeah - thanks - resolved - what the webhook doesn't like is the mix of free text and variables, so as long as I replace the whole value with a variable, then it works.


ADMIN

Hello Jon!


Thank you very much for reaching out to us.


Please note that we have contacted you from support@softomotive.com, as we would need more information in order to be able to assist you accordingly.


Kind Regards,

Aristos

image


image


Hope this help.


Yes, I tried that. It works fine until i replace any value in the json Request Body with a % sign and then it fails. Either there is a general problem with discord webhooks accepting % signs or its a general json issue. Is there any other way to refer to a variable in winautomation without using the % sign?  I saw some json code using curly braces {{}} to enclose variables but i think this was for the specific application.

Answer

Yeah - thanks - resolved - what the webhook doesn't like is the mix of free text and variables, so as long as I replace the whole value with a variable, then it works.

Login or Signup to post a comment