Blockly (JS Library) help needed

I am working on Blockly as part of my final year project .
How can i Use JavaScript to assign values to the block of codes then use JavaScript popups(like the prompt() script) to insert the value into a textbox and return it as a blockly block on the blockly interface instead of drag and drop.
Thank you