Moved the request body evaluation to the specific handler. Bitbucket is sending the request form encoded in a form value called payload.
Added command expansion. The value "{repository}" in the command will be replaced with the name of the repository when using the bitbucket deployment hook.