Send a message to a Hipchat room from within MS Access 2013

Hey there,

I want to be able to send some data to my teams hipchat room, exception reports, things to follow up etc etc.

I have a mysql database, Access front end and want to 'in time' be able to assemble data and send from a small form I have that contains the data.

I have this code that I am testing with at the moment;

Dim TargetURL As String
Dim HTTPReq As Object

TargetURL = "https://hipchat.al.com.au/v2/room/ROOMNUMBER HERE/notification?auth_token=MY TOKEN GOES HERE"
Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
HTTPReq.Option(4) = 13056 '
HTTPReq.Open "POST", TargetURL, False

HTTPReq.send "'{""color"":""red"", ""from"":""SLS"" ,""message"":""TEST"", ""message_format"":""text""}'"
MsgBox (HTTPReq.responseText)

 

But whenever I press the button to send I get this error;

Code:400

The request body cannot be parsed as valid JSON: Expecting value: line 1 column 1 (char 0)

Bad Request

I am not sure what to do in order to get this to simply send my test message working, let alone the more complicated data package to send over.

 

Any ideas?

 

 

1 answer

I'll answer this myself..  I had an extra ' in the mix at both ends!  basic message send is working.

Now to figure out how to send a nicely formated block of text?!

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 Tuesday in Hipchat

Moving from Hipchat to Stride? Here’s what you’ll love

Heya, Hipchat friends! We’re so happy you’re checking out   Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...

116 views 3 8
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