Add button to layout.updatemenus with my own custom function
Can I add button as on screenshot, but with my js function? For example I want to add alert or just console.log()

For security purposes we don't allow any JS inside the figure spec, since figures don't always come from trusted sources. You could hack something to achieve your purpose by creating a restyle or relayout call that does nothing, ie set a nonexistent attribute, then listen for that event with that attribute.
We could advance that concept into a real feature by allowing you to just emit an event of your choosing, but do nothing else to the graph. For example, we could make it so this button:
{ args: ['party', 'like it\'s 1999'], label: 'Party Time!', method: 'event' }
would emit a plotly_party event with data "like it's 1999" when clicked. Then you could attach whatever handler you want:
gd.on('plotly_party', e => { console.log(e) })
This feature is probably pretty straightforward to implement, if you'd like to make a PR. It's not likely to be worked on by Plotly staff in the near future but we'd happily help review and merge a PR 😄
You could hack something to achieve your purpose
@alexcjohnson Do you have an example of how to do this?
I was thinking I'd have to write an example but then I stumbled on this codepen (from 2017!) that does exactly what I was imagining. 🙇 @ajoposor
Hi - we are trying to tidy up the stale issues and PRs in Plotly's public repositories so that we can focus on things that are still important to our community. Since this one has been sitting for a while, I'm going to close it; if it is still a concern, please add a comment letting us know what recent version of our software you've checked it with so that I can reopen it and add it to our backlog. Alternatively, if it's a request for tech support, please post in our community forum. Thank you - @gvwilson