R
R
rexetbandityt2021-10-29 00:43:07
In contact with
rexetbandityt, 2021-10-29 00:43:07

How to check for payload in vk api keyboard?

How to check the contents of payload in vk api if my Payload is: "payload": "{\"button\": \"3\"}"

I do everything on Node JS

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Kuzyakin, 2021-10-29
@rexetbandityt

const pld = {"payload":"{\"button\": \"3\"}"};
const payloadObj = JSON.parse(pld.payload);  // преобразуем строку в объект

if (Number(payloadObj.button) === 3) {
 // тут выполняете нужный код
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question