Drafts Action Directory

Call

Posted by dchar, Last update 5 months ago
Install

Steps

  • script

    // scan draft for phone numbers
    // define tag for use in prompt if found.
    
    var re = /(\([0-9]{3}\)|[0-9]{3})[ -]?[0-9]{3}[ -]?[0-9]{4}/g;
    var p1 = draft.content.match(re) || [];
    
    var re2 = /[0-9]{3}\.[0-9]{3}\.[0-9]{4}/g;
    var p2 = draft.content.match(re2) || [];
    
    var phoneNumbers = p1.concat(p2);
    
    if (!phoneNumbers || phoneNumbers.length == 0) {
      alert("No phone numbers found.");
      context.cancel();
    }
    else {
       draft.setTemplateTag('phone_numbers', phoneNumbers.join("|"));
    }
  • prompt

    promptKey
    prompt
    promptTitle
    Select phone number
    promptMessage
    promptButtons
    [[phone_numbers]]
    includeTextField
    false
    textFieldDefault
    includeCancelButton
    true
  • url

    template
    tel://[[prompt_button]]
    useSafari
    false
    encodeTags
    true

Options

  • After Success Default
    Notification Info
    Log Level Info

Comments

Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.