Atlassian Confluence Webhook not calling Play! method using Atlassian Connect Plugin

319 Views Asked by At

I'm trying to use a webhook (login event) to make a call to my Play! app. I need to pass the user and IP address of that user to the method, but I get this error:

[httpclient-callbacks:thread-37]          
[atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] apply Unable to post the information to http://<host>:9000/geoip/login due to null

I don't know what's null and there isn't enough documentation to figure out why? Help please.

atlassian-connect.json:

{
    "baseUrl": "${localBaseUrl}",
    "key": "confluence-webhook",
    "authentication": {
        "type": "jwt"
    },
    "vendor": {
        "name": "Wikistrat",
        "url": "http://www.wikistrat.com"
    },
    "description": "Atlassian Connect add-on that connects to GeoIP2",
    "name": "GeoIP2",
    "lifecycle": {
        "installed": "/installed",
        "uninstalled": "/uninstalled"
    },
    "scopes": [ "READ", "WRITE" ],
    "modules": {
        "webhooks": [
            {    
         "key": "confluence-webhook",
                 "event": "login",
                 "url": "geoip/login"
            }
        ]
    }
}

I've hard-coded the params as I don't know how to include variables.

This is the snippet from Play!'s routes file that corresponds to the url:

POST /geoip/login controllers.GeoIp.getLocation()

The getLocation() method reads the params and does its stuff.

I get this error in ...\Atlassian Run Standalone\amps-standalone\target\confluence-LATEST.log when logging in to Confluence (which should trigger the webhook):

2014-02-19 13:21:11,175 WARN [httpclient-callbacks:thread-29]   
[atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] apply Unable to post the information to http://<host>:9000/geoip/login due to null

I have node app.js running (port 3000) which produces this output:

login
{    timestamp: 1392816071138,
     remoteIP: '0:0:0:0:0:0:0:1',
     user: 'savbalac',
     remoteHost: '0:0:0:0:0:0:0:1' }
POST /login 204 37ms

and this in confluence-latest.log:

2014-02-19 13:21:11,176 WARN [httpclient-callbacks:thread-29] 
[atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] apply Unable to post the information to http://<host>:3000/login due to null

I've turned on all logging in the admin page, I've read the documentation on Webhooks and all the Samples, but still get nowhere. I notice there are many unanswered questions in Atlassian Answers on webhooks - hopefully this one will get one!

1

There are 1 best solutions below

0
On

The Play! app's method was never called because it was protected by its own authentication mechanism, i.e. the method had annotation @Security.Authenticated(Secured.class).

Requests from Confluence need JWT authentication instead.