Attribute in a data

(Biewl Henrique) #1

Hello Guys!

Well, I want to send a “Send a Card” with the values ​​of a “Make HTTP Request”. But the value “Data” always changes and I want it to be chosen according to a message that the user will send.

For example:
New Message: “/filter Test” > Split Text: “Text2=Test” > Make HTTP Request > Send a card: “{{HTTP_Request.data__{{Text2}}__0 __name}}”

But I do not know how to send this value of Text2 into the date value.I think only with “Code Action” is possible, but I do not know how to make this code and how would the logic to be used.

Can anyone help me?

(Daniel Beckett) #2

Hi @BiewlHenrique

Unfortunately nested variables aren’t supported so things like {{HTTP_Request.data__{{Text2}}__0 __name}} won’t work. You’re right in that it could be possible with the right code but I’m pretty limited in what advice I can offer there. You may want to try other communities like Stack Overflow to see if anybody can help you put together the JavaScript request

(Biewl Henrique) #3

Hi Daniel,
thanks for the help. As always fast on the stand!

I don’t know anything about JavaScript. And i did not know this Stack Overflow community! I’ll see if anyone can help me with this so.

Thank’s Man!

#4

HI @BiewlHenrique,

Create a Code Action with input named userKey and assign to it {{Text2}}
in code write something like this:

var data = {{HTTP_Request.data}};

resolve(data[inputs.userKey][0]["name"]);

I don’t try it :wink:

1 Like