public string Process() { MySqlConnection con; con = new MySqlConnection(myConnectionString); con.Open(); string title = Args["Title"]; MessageClass m = new MessageClass(); MessageAttachmentsClass attach = new MessageAttachmentsClass(); AttachmentFieldClass field = new AttachmentFieldClass(); field.Title = "Deleted Item"; field.Value = title; attach.AttachField(field); m.Attach(attach); string query = "DELETE FROM todo_list WHERE title=\"" + title + "\" and integ_id=" + IntegrationID.ToString(); MySqlCommand cmd = new MySqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); return(JsonConvert.SerializeObject(m)); }
public string Process() { MessageClass message = new MessageClass(); message.MessageText = "Hello, {0}"; message.MessageText = string.Format(message.MessageText, Args["Name"]); MessageAttachmentsClass attachment = new MessageAttachmentsClass(); attachment.Title = "This is Attachment Title"; attachment.Text = "This is the text of the Message. For more on this please visit 'https://docs.yellowant.com/' "; ButtonCommandsClass Bcc = new ButtonCommandsClass(); Bcc.FunctionName = "hello"; Bcc.ServiceApplication = IntegrationID; Command Cmd = new Command(); Cmd.Name = "Button"; Bcc.Data = Cmd; MessageButtonClass button = new MessageButtonClass(); button.Value = "value"; button.Name = "name"; button.Text = "Test Button"; button.Command = Bcc; attachment.AttachButton(button); message.Attach(attachment); string ToReturn = JsonConvert.SerializeObject(message); MessageClass ToSendMessage = new MessageClass(); ToSendMessage.MessageText = "Sending Message"; var user = db.UserIntegrationContext.Where(a => a.IntegrationID == IntegrationID).FirstOrDefault(); Yellowant ya = new Yellowant { AccessToken = user.YellowantIntegrationToken }; ya.SendMessage(IntegrationID, ToSendMessage); ToSendMessage.MessageText = "Webhook Message"; var ExampleData = new { first_name = "FirstName", last_name = "LastName" }; ToSendMessage.MessageData = ExampleData; //string testData = JsonConvert.SerializeObject(ToSendMessage); ya.SendWebhookMessage(IntegrationID, "webhook", ToSendMessage); return(ToReturn); }
public string Process() { MySqlConnection con; con = new MySqlConnection(myConnectionString); con.Open(); string title = Args["Old-Title"]; string newtitle = ""; string description = ""; if (Args["New-Title"] != null) { newtitle = Args["New-Title"]; } else { newtitle = title; } if (Args["Description"] != null) { description = Args["Description"]; } MessageClass m = new MessageClass(); MessageAttachmentsClass attach = new MessageAttachmentsClass(); AttachmentFieldClass field = new AttachmentFieldClass(); field.Title = "Updated Item"; field.Value = title; attach.AttachField(field); m.Attach(attach); string query = ""; if (description != "") { query = "UPDATE todo_list SET title =\"" + newtitle + "\",description=\"" + description + "\" WHERE integ_id=" + IntegrationID.ToString() + " AND " + " title=\"" + title + "\""; } else { query = "UPDATE todo_list SET title =\"" + newtitle + "\" WHERE integ_id=" + IntegrationID.ToString() + " AND " + " title=\"" + title + "\""; } MySqlCommand cmd = new MySqlCommand(query, con); cmd.ExecuteNonQuery(); con.Close(); return(JsonConvert.SerializeObject(m)); }