Similary, how about this for your first question:

In your emacs config:

(defun my/org-macro-hsapi-code (link anchor desc)
  (let* ((link-1 (if (org-string-nw-p anchor)
                     (concat link "#" anchor)
                   link))
         (desc-1 (or (org-string-nw-p desc) link-1)))
    (concat "[[http://www.hammerspoon.org/docs/" link-1 "][" desc-1 "]]")))

In your Org file:

#+macro: hsapi (eval (my/org-macro-hsapi-code $1 $2 $3))
{{{hsapi(hs.notify)}}}
{{{hsapi(hs.notify,show)}}}
{{{hsapi(hs.notify,show,Foo)}}}
--

Kaushal Modi