Checkout the following links/search:
http://www.postfix.org/postconf.5.html - Search for "check_recipient_access"
http://www.postfix.org/access.5.html - Search for the "FILTER" action
For reference: This is how I call Spamassassin. Note the call to spamc in master.cf. You could change that to be your script.
# cat /etc/postfix/mail.cf
smtpd_recipient_restrictions=
...bunch of restrictions
...check_recipient_access=/etc/postfix/SAfilter
# cat /etc/postfix/myfilter
mydomain.com FILTER SAfilter:spamassassin
# cat /etc/postfix/master.cf
SAfilter unix - n n - 10 pipe
flags=Fq
user=spamassassin
argv=/usr/bin/spamc -f -x -e /usr/sbin/sendmail -i -f $sender $recipient