After reading the source code and BitBucket REST API documentation, I believe Drone is using the wrong REST API resource.
Drone currently uses /rest/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled, using the PostReceive hook plugin (which will only trigger a call to drone when one does git push but will not generate a Pull Request related call).
Drone should be using the new webhook API: /rest/projects/{projectKey}/repos/{repositorySlug}/webhooks, this API allows one to specify all the different types of events such as push, pull request, etc.
I am not sure if the payload generated by both types of hooks is identical - if so, we can just swap out the REST API calls. I’ll see if I can find out.
Here’s my sample Python code using the requests module to call the webhoosk API. I am not yet a Go person, but I’ll try to see if I can create a Pull Request.
username = "some-user"
password = "some-password"
url = "https://bitbucket.mydomain.com/rest/api/1.0//projects/MYPROJ/repos/drone-test/webhooks"
data = { u'active': True,
u'configuration': {u'secret': u'foobar'},
u'events': [u'pr:reviewer:approved',
u'pr:merged',
u'pr:opened',
u'repo:refs_changed'],
u'name': u'some-name-for-webhook',
u'url': u'https://some-url/'}
# without this header, Atlassian complains of XSRF
headers = {"X-Atlassian-Token": "no-check"}
r = requests.post(url, json=data, headers=headers, auth=(username, password))