Get Bible Verse (ESV)

Posted by nate561, Last update almost 5 years ago

This action is powered by the API provided at You can create an account there ( to get an API token for this action. When you first run this action please enter the token you received from to authenticate.

To use this script either place your cursor in the draft and run the action or select a passage that is already typed out and run the action. If you have no text selected the action will prompt for you to enter a passage reference (ex. John 3:16). If you have a verse reference already written in the draft you can select the text and run the action. The action will see that text is selected and use that to search for a passage.


  • script

    This script use the api located at You must first create an account at this site and then create a project to gain an API token. Once you have the token you can run this scirpt and enter your token when promted to store it for future use. 
    var credential = Credential.create("ESV API", "An API Used to search for bible verses in from the ESV bible translation");
    credential.addPasswordField("token", "Token");
    var sel = editor.getSelectedText(); // retrieve selected text
    var selRange = editor.getSelectedRange();
    if (!sel || sel.length == 0) {
    let p = Prompt.create();
    p.title = "Please enter a verse refrence";
    p.addTextField("Verse", "Verse","",{'wantsFocus':true});
    if (p.buttonPressed == "Search") {
       var sel = p.fieldValues["Verse"];
    var http = HTTP.create();
    //You can set these to "true" or "false" to add different pieces to the verse output
    var include_copyright = "false";
    var include_headings = "false"; 
    var include_passage_ref = "false"
    var include_footnote = "false"
    var endpoint = ""+ encodeURI (sel)+"&include-copyright="+include_copyright+"&include-headings="+include_headings+"&include-passage-references="+include_passage_ref+"&include-footnote-body="+include_footnote;
    var response = http.request({
    	"url": endpoint,
    	"headers": {
    		"Authorization": "Token " + credential.getValue("token")
    if (response.success) {
      var text = response.responseText;
      var data = response.responseData;
    else {
    var passage = JSON.parse(text).passages.toString();
    var ref = JSON.parse(text).canonical;
    var ParseNewLine = /\n/gi;
    var ParseTabs = /   |\v|  /gi;
    passage = passage.replace(ParseNewLine, '');
    passage = passage.replace(ParseTabs, '');
    var returnVal = passage + "\n" + ref; 
    var selRange = editor.getSelectedRange();


  • After Success Nothing
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.