It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to use curl to add file to hipchat

Im trying to upload a file to a specific HipChat room as an attachment.

I cant seem to figure out the syntax using the API help.

Tried so many:

curl  -i -X POST -H 'Content-Type: text/plain' -F "file=@filename" <URL>/v2/room/<roomID>/notification?auth_token=<auth_token>

2 answers

1 vote
crivers Atlassian Team Mar 22, 2017

I think the API you're looking for is the /share/file API. The one you mention above is actually just for text-based notifications. The example on the API documentation shows the format that's expected (using multipart/related Content-Type).

I've done searches online and it's quite difficult to find documentation on how to simply send a file to rooms via curl. The /share/file API seems considerably complicated compared to how easy the old API was.

Oddly enough, though, hubot seems to send images without any difficulty, yet if you try to write a coffeescript to send the same images, it's quite difficult. There's a little bit of help in their xmpp documentation here, but it's not enough:
https://ecosystem.atlassian.net/wiki/display/HCDEV/HipChat+XMPP+Protocol+Documentation#HipChatXMPPProtocolDocumentation-Room(new)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Hipchat

Hipchat Cloud and Stride have reached End of Life (updated)

All good things come to an end - thanks to all our customers and partners who have been along the Hipchat and Stride journey with us.  As of Feb 15th 2019, Hipchat Cloud and Stride have reached ...

35,195 views 9 8
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you