Skip to content

Instantly share code, notes, and snippets.

@jwatson
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwatson/9421522 to your computer and use it in GitHub Desktop.
Save jwatson/9421522 to your computer and use it in GitHub Desktop.
A simple function for sending messages to a HipChat room.
static void SendHipChatMessage(NSString *token, NSString *room, NSString *message)
{
NSDictionary *params = @{
@"auth_token": token,
@"format": @"json",
@"room_id": room,
@"from": @"Mapkin App",
@"message": message,
@"message_format": @"text",
@"notify": @1,
@"color": @"purple",
};
NSURL *url = [NSURL URLWithString:@"https://api.hipchat.com/v1"];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:url];
[client setDefaultHeader:@"Accept" value:@"application/json"];
[client postPath:@"rooms/message"
parameters:params
success:NULL
failure:NULL];
}
@marcregan
Copy link

Thanks John!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment