This is a good question and you would need to call an API to make this happen or by calling a webhook. Typically you would need your own server to do this, but some automation services like Integromat, n8n, and possibly Tray (help?) now allow you to run Javascript within modules or nodes.