Last active
August 29, 2015 13:57
-
-
Save jwatson/9421522 to your computer and use it in GitHub Desktop.
A simple function for sending messages to a HipChat room.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks John!