asynchronous post hooks

Updating the PR by Chopachom in #1977.