Send Hipchat Message via Scripting Lanugage?

I am scripting within a scripting lanugage called Pnuts. I am automating our migration process and would like to incorporate a way to send notifications to our teams room within the script itself. Basically, when the user selects "Create Migration" then pnuts code will send a message to our teams hipchat room stating "A new migration was created by _____________. " or something like that.

 

Basically, looking for a way to have my code automate the messaging functionality to hipchat.

1 answer

0 vote

Hi Trevor,

I'm not familiar with Pnuts, but to send a message to a specific Hipchat room you could use the API interface.

For example to send a message to room 6 you could use the command:

curl -d '{"message": "A new migration was created by $variable.", "notify": false, "message_format": "text"}' -H 'Content-Type: application/json' 'https://<hipchatserver>/v2/room/6/message?auth_token=xxxxxxxxxxxxxxxxxxxx'

A using the send_message endpoint only allows you to use text, so perhap, if you want the message to standout use the send_room_notification endpoint, which has a more extensive configuration

Have a look at the full API reference at
https://www.hipchat.com/docs/apiv2/method/send_message - to send a text message
https://www.hipchat.com/docs/apiv2/method/send_room_notification - to send a notification, for example in html

Note:
To be able to make API calls you will need to create an API token first
An API tokens can be created in your profile settings when you are logged in with the webinterface.

Best Regards,

Ryans

Where would I run that command from?... command line? if so do i have to install anything or be in a certain environment to actually be able to run the command?

Hi Trevor

The curl command can be executed from the terminal on any system that has curl installed.

Most linux/unix/OS X systems have that pre installed.

note:

The curl command was only an example how make the API call. Any application that can make json API calls would do.

Best Regards,

Ryans

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Mar 26, 2018 in Hipchat Data Center

Migration of Hipchat server to Data Center - a retrospective

Background While our Hipchat server environment was reliable and performing well, as a significant and growing part of our business, the need to leverage the benefits of Hipchat Data Center&nbs...

458 views 2 6
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