add code for API-triggered widget