How do you send a variable to a bucket from a custom widget.

How do you send a variable to a bucket from a custom widget.

Hi 

I would like to send a variable created in a custom widget script to the bucket of the device where the data for the widget is coming from.

Thanks.