There are a number of places where mu4e lets you plug in your own
functions:
mu4e-attachment-dir.
mu4e-compose-pre-hook (see
Compose hooks), mu4e-index-updated-hook (see FAQ — Frequently Asked Questions)
You can also write your own functions without using the above. If you want to do
so, key useful functions are mu4e-message-at-point (see below),
mu4e-headers-for-each (to iterate over all headers, see its docstring)
and mu4e-view-mime-parts (a list of all parts/attachments, see its
docstring). There is also mu4e-view-for-each-uri to iterate of all the
URIs in the current message.
Another useful function is
mu4e-headers-find-if which searches for a message matching a
certain pattern; again, see its docstring.