public static List <string> GetAllUsers(string token) { HipchatClient client = new HipchatClient(token); HipchatGetAllUsersResponse users = client.GetAllUsers(); List <string> UserNames = new List <string>(); foreach (HipchatUser user in users.Items) { UserNames.Add(user.Name); } return(UserNames); }
public static void SendPM(string message, string username, string token) { try { HipchatClient client = new HipchatClient(token); HipchatGetAllUsersResponse users = client.GetAllUsers(); foreach (HipchatUser user in users.Items) { if (user.Name == username) { client.PrivateMessageUser(user.Id.ToString(), message, true, HipchatMessageFormat.Text); break; } } } catch (Exception ex) { } }