How do i read the webhook data from Hipchat?


I've created a custom slash command to return data when a user writes in a specific room. This is only working if I hard code a value on my API endpoint. I'd really like to return "12345" from a message sent like "/notes 12345"


I can't figure out how I need to configure my node API endpoint to get the value contained in the message body. Would i need to have something specific to handle the incoming data?"/notes", function(req, res, body) {
  var value = req.body.message;
//This works if I use Postman but I want it to be from the entered value in the room
//by the user.


I've used RequestBin to get the raw data

	"event": "room_message",
	"item": {
		"message": {
			"date": "2016-11-01T16:24:35.109356+00:00",
			"from": {
				"id": int,
				"links": {
					"self": "string"
				"mention_name": "DannyDainton",
				"name": "Danny Dainton",
				"version": "string"
			"id": "string",
			"mentions": [],
			"message": "/notes 67898",  <<<---- I want this value
			"type": "message"
		"room": {
			"id": int,
			"is_archived": bool,
			"links": {
				"members": "string",
				"participants": "string",
				"self": "string",
				"webhooks": "string"
			"name": "string",
			"privacy": "string",
			"version": "string"
	"oauth_client_id": "string",
	"webhook_id": int


How would I get this working on a POST request to my node express API. Would I need to use JSON.parse or stringify or something like that? I really am clueless at this point.

Many Thanks in Advance,


1 answer

1 accepted

0 vote

It sounds like you're using the tutorial for Node connect-expression. I think the example you're looking for can be found at:'/echo-webhook',
    addon.authenticate(), //JWT validation
    function(req, res) {
		var messageTxt = req.body.item.message.message;
     	hipchat.sendMessage(req.clientInfo, req.identity.roomId, messageTxt)

The data you're looking for should be able to be found in req.body.item.message.message. You shouldn't need to do any special JSON parsing, that part is already done for you by the framework.

Thanks Chris!

It wasn't a tutorial i was following, it was my own attempt to knock something together.

Your answer gave my brain a kick though and the "req.body.item.message.message" help me out loads and now it's all working great!!

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Published Oct 07, 2017 in Hipchat

Bringing Structure to your HipChat Instance

...have mention name FirstnameLastname. Fe.: @MaartenCautreels This certainly helps to know who is being mentioned in a conversation. Imagine your colleague sends the following message...

470 views 1 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot