/// <summary> /// Attachment created to be send in slack without any interactive button /// </summary> /// <param name="leaveRequestId">leave request Id</param> /// <param name="replyText">reply text of leave to be send on slack</param> /// <returns>attachment to be send on slack</returns> public List<SlashAttachment> SlackResponseAttachmentWithoutButton(string leaveRequestId, string replyText) { List<SlashAttachment> attachment = new List<SlashAttachment>(); SlashAttachment attachmentList = new SlashAttachment(); // Fallback as a string on attachment attachmentList.Fallback = _stringConstant.Fallback; // attaching reply text as title of attachment attachmentList.Title = replyText; // assigning callbackId of attachment with leaveRequestId attachmentList.CallbackId = leaveRequestId; // assigning color of attachment as string format attachmentList.Color = _stringConstant.Color; // Assigning attachment type as default attachmentList.AttachmentType = _stringConstant.AttachmentType; attachment.Add(attachmentList); return attachment; }
/// <summary> /// Method to create attchment of slack with a text as reply, can be used generically /// </summary> /// <param name="leaveRequestId"></param> /// <param name="replyText"></param> /// <returns>string attachment</returns> public List <SlashAttachment> SlackResponseAttachment(string leaveRequestId, string replyText) { List <SlashAttachmentAction> ActionList = new List <SlashAttachmentAction>(); List <SlashAttachment> attachment = new List <SlashAttachment>(); SlashAttachment attachmentList = new SlashAttachment(); SlashAttachmentAction Approved = new SlashAttachmentAction() { Name = _stringConstant.Approved, Text = _stringConstant.Approved, Type = _stringConstant.Button, Value = _stringConstant.Approved, }; ActionList.Add(Approved); SlashAttachmentAction Rejected = new SlashAttachmentAction() { Name = _stringConstant.Rejected, Text = _stringConstant.Rejected, Type = _stringConstant.Button, Value = _stringConstant.Rejected, }; ActionList.Add(Rejected); // Adding action button on attachment attachmentList.Actions = ActionList; // Fallback as a string on attachment attachmentList.Fallback = _stringConstant.Fallback; // attaching reply text as title of attachment attachmentList.Title = replyText; // assigning callbackId of attachment with leaveRequestId attachmentList.CallbackId = leaveRequestId; // assigning color of attachment as string format attachmentList.Color = _stringConstant.Color; // Assigning attachment type as default attachmentList.AttachmentType = _stringConstant.AttachmentType; attachment.Add(attachmentList); return(attachment); }