Action

Email Assistant

Posted by @nahumck, Last update over 6 years ago - Unlisted

Dictate an email to your assistant using your digital assistant. When dictating, speak the first line as the subject, say “new paragraph”, and then speak the body. Tap create to generate the email and send. Option after sending to save it as a draft.

Steps

  • script

    /* --- Email Assistant --- */
    
    // Capture email via dictation
    let text = editor.dictate();
    let t = Draft.create();
    t.content = text;
    let title = t.processTemplate("[[title]]");
    let body = t.processTemplate("[[body]]");
    
    // Contact information
    let name = "assistant's name here";
    let email = "assistant@addressgoeshere.com";
    
    // Set Template Tags for email step
    draft.setTemplateTag("email",email);
    draft.setTemplateTag("name",name);
    draft.setTemplateTag("dictated_title", title);
    draft.setTemplateTag("dictated_body",body);
  • mail

    toRecipients
    [[email]]
    ccRecipients
    bccRecipients
    subjectTemplate
    [[dictated_title]]
    bodyTemplate
    Dear [[name]],

    %%[[dictated_body]]%%

    Regards,
    Tim Nahumck
    tim@nahumck.me
    sendAsHTML
    true
    sendInBackground
    false
  • script

    /* --- Prompt to Save --- */
    
    var p = Prompt.create();
    p.title = "Save email text?"
    p.addButton("Yes");
    p.addButton("No");
    p.show();
    var sel = p.buttonPressed;
    if (sel == "Yes") {
    	var d = Draft.create();
    	d.content = "Email to "+assistant+"\n\n"+text
    	d.update();
    }

Options

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