Client Web Fragment Plugin Modules

Post-Receive Hook Plugin Module

Deprecated in 5.0

The post-receive module type has been deprecated in Bitbucket Server 5.0 and will be removed in 6.0. Please use the repository hook module type instead. More details can be found in the Repository Hooks and Merge Checks Guide.


Post-receive hooks are similar to pre-receive-hooks except that the push cannot be cancelled. They are useful for outputting messages to the client. If no message is required consider listening for RepositoryPushEvent instead.

Note This hook module is enabled across all repositories.



keyYesThe identifier of the plugin module. This key must be unique within the plugin where it is defined.N/A
classYesThe fully qualified Java class name of the hook. This class must implement com.atlassian.bitbucket.hook.PostReceiveHook.N/A
nameThe human-readable name of the plugin module. I.e. the human-readable name of the hook.N/A
weight The (integer) weight of the plugin module. Hooks with a higher weight will be processed later. It should almost never be necessary to set this. Your hook implementation should not rely on a particular order for it to function correctly as the absolute ordering also depends on the weight set on other hooks. 1000


description The description of the plugin module. The 'key' attribute can be specified to declare a localisation key for the value instead of text in the element body. I.e. the description of the servlet. N/A


Here is an example atlassian-plugin.xml file containing a single merge check:

<atlassian-plugin name="My Merge Request Check" key="example.plugin.preceive" plugins-version="2">
        <description>A basic component import module test</description>
        <vendor name="My Company" url=""/>

    <post-receive-hook key="myPostReceiveHook" name="Show some example" class="com.mycompany.example.plugin.myhook.MyPostReceiveHook">
        <description>A post-receive hook example that thanks the user for pushing</description>

And the corresponding hook:

package com.mycompany.example.plugin.myhook;

import com.atlassian.bitbucket.hook.HookResponse;
import com.atlassian.bitbucket.hook.PostReceiveHook;

public class MyPostReceiveHook implements PostReceiveHook {

    public void onReceive(Repository repository, Collection<RefChange> refChanges, HookResponse hookResponse) {
        hookResponse.out().println("Thank you for pushing to Bitbucket Server");

Rate this page: