HipChat - cURL Bold & Colors

Hello,

 

is there any way to forrmat the Text Bold or in Colors in HipChat messages?
Maybe even with the curl command? I would like to send messages in bold and colors...


curl -d '{"color":"green","message":"My first notification (yey)","notify":false,"message_format":"text"}' -H 'Content-Type: application/json' https://chat.XXX.XXX/v2/room/XX/notification?auth_token=XXXXX

 

Regards.

2 answers

1 accepted

This widget could not be displayed.
Nick Turskyi Atlassian Team Jun 09, 2017

Hi Manuel,

You can use "message_format": "html" and use simple HTML formatting in the "message" field.

More information in the API call documentation: https://developer.atlassian.com/hipchat/guide/sending-messages

Regards,

Nick

Thanks perfect! This is working now! :D

Can i also color the messages? If i use <font color="#FF0099"> (eg) i get this error:

  "error": {
    "code": 400,
    "message": "The request body cannot be parsed as valid JSON: Expecting ',' delimiter or '}': line 1 column 132 (char 131)",
    "type": "Bad Request"

Any idea about this?

Nick Turskyi Atlassian Team Jun 09, 2017

Unfortunately, font tag isn't supported.

As per the documentation, "Allowed HTML tags: a, b, i, strong, em, br, img, pre, code, lists, tables".

As of the error, I'm pretty sure it's because you're using double quotes around the color, which effectively terminates the "message" field of JSON, which is itself enclosed in double quotes. Try escaping the inner quotes with backslashes:

"message":"My first<font color=\"#ff0099\"> notification</font>"

If I escape them the Message look like

My first<font color="#FF0099">notification</font>

but it is not in color.
Is there even a way to color them? Ive seen Screens where it was possible?

 

This widget could not be displayed.
Jeremy Mooiman Community Champion Jun 09, 2017

Dear Manuel,

For the regular Hipchat user this is not possible, see;

https://jira.atlassian.com/browse/HCPUB-300

Although it is possible in certain situations with Nick his answer.

Friendly Regards,

Jeremy

Thank you! :D

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published Aug 10, 2018 in Hipchat

What should I think about when migrating HipChat to Slack?

...from the beginning. We have built up a lot of content in HipChat, with it being a core tool in our distributed company model. While it is true that we didn’t need to move to Slack immediately, we felt it...

241 views 1 9
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