This script takes the body and relevant data from any email and sends a webhook using CURL to a given http destination, with the payload as JSon.
Use it as the action of an email rule, saving it in the scripts com.apple.mail folder:
/Volumes/HD/Library/Application Scripts/com.apple.mail
Modify according to your webhook's destination url on the curlCommand parameter definition.