I got a token to work with a community widget via vkminiapps and getcommunityToken, and now I want to update the widget via a Python script, but to display information about the user, such as the name, here is an example of a widget code
var test = api.users.get () @. first_name;
Return {
"Title": "Widget header",
"TEXT": Test [0],
"Descr": "Description"
};
In the widget, the name of the user who went to the page should be shown
The request is made to the appwidgets.update method, with a token and type = text, but it turns out an error
One of the Parameters Specified Was Missing or Invalid: Text IS Empty
That is, the API simply returns empty text, that is, I did not find anything, although if the same code is sent to the Execute method, then information about the current user is displayed.
Question:
How do applications work that updated widgets? Or what am I doing wrong?
Answer 1
In general, I figured out, it was necessary to use args.uid – Idi of the user who went to the page
var test = api.users.get ({user_id: args.uid}) @. first_name;
Return {
"Title": "Widget header",
"TEXT": Test [0],
"Descr": "Description"
};