Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

email after archive

  • Loading branch information...
commit 510673eab6168b13bbf259891aa70d7b2bb7497e 1 parent 080f052
@rajat-123 rajat-123 authored
View
4 Gemfile
@@ -38,3 +38,7 @@ gem 'rspec', :group => :test
gem 'rack-test', :require => "rack/test", :group => :test
gem 'flexmock', :group => :test
gem 'mock_redis', :group => :test
+
+# Mail Gems
+gem 'rest-client'
+gem 'multimap'
View
3  Gemfile.lock
@@ -83,6 +83,7 @@ GEM
mock_redis (0.6.2)
multi_json (1.3.6)
multi_xml (0.5.1)
+ multimap (1.1.2)
multipart-post (1.1.5)
nokogiri (1.5.5)
nori (2.0.4)
@@ -194,12 +195,14 @@ DEPENDENCIES
jaconda
mail
mock_redis
+ multimap
nokogiri
pry
rack-test
rake
redis
redis-namespace
+ rest-client
restforce
rspec
ruby-trello
View
BIN  apps/email_after_archive/assets/images/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  apps/email_after_archive/assets/images/screenshot.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
24 apps/email_after_archive/assets/views/button/overlay.hbs
@@ -0,0 +1,24 @@
+<!--
+ Set overlay: true in the config
+ This file will be rendered on the overlay
+ The below code sample is taken from the Pivotal App
+-->
+
+<h3>Edit the Story Details</h3>
+{{#each tickets}}
+ {{#ticket}}
+ <ol>
+ <li>
+ <label for="title">Story Title</label>
+ <input name="title" value="{{subject}}">
+ </li>
+ <li>
+ <label for="description">Story Description</label>
+ <textarea name="description">
+{{content.text}} \n
+https://{{../../company.subdomain}}.supportbee.com/tickets/{{id}}
+ </textarea>
+ </li>
+ </ol>
+ {{/ticket}}
+{{/each}}
View
32 apps/email_after_archive/config.yml
@@ -0,0 +1,32 @@
+name: Email_after_archive
+slug: email_after_archive
+access: public
+
+description: "This is to test and a boilerplate app.
+Accepts newline"
+
+category: Integration
+
+tags:
+- tag1
+- tag2
+
+developer:
+ name: <Your Name>
+ email: <Your Email>
+ twitter: "<Your Twitter Handle>"
+ github: <Your Github Handle>
+
+# The following config keys are used by Action Handlers
+# Set button 'overlay' to true, if you want to have an overlay
+# The valid values for screens are [ticket, all, unassigned, my, groups]
+# Remove the following section if you do not want to define Action Handlers
+
+action:
+ button:
+ overlay: false
+ screens:
+ - ticket
+ - all
+ - unassigned
+ label: Send To Email_after_archive
View
53 apps/email_after_archive/email_after_archive.rb
@@ -0,0 +1,53 @@
+module EmailAfterArchive
+ module EventHandler
+ # Handle 'ticket.created' event
+ def ticket_created
+ return true
+ end
+
+ def ticket_archived
+ recd_user = payload.agent.email
+ RestClient.post "https://api:#{settings.API_KEY}" \
+ "@api.mailgun.net/v2/#{mailgun_domain}/messages",
+ :from => "Excited User <rajat188@gmail.com>",
+ :to => "#{payload.agent.email}",
+ :subject => "#{settings.subject}",
+ :text => "#{settings.email_body}"
+ end
+
+ # Handle all events
+ def all_events
+ return true
+ end
+ end
+end
+
+module EmailAfterArchive
+ module ActionHandler
+ def button
+ # Handle Action here
+ [200, "Success"]
+ end
+ end
+end
+
+module EmailAfterArchive
+ class Base < SupportBeeApp::Base
+ # Define Settings
+ string :API_KEY, :required => true, :hint => 'This is the API Key from mailgun console'
+ string :subject, :required => true, :hint => 'Say Hello to your customers'
+ string :email_body, :required => true, :hint => 'The body of the email'
+ string :mailgun_domain, :required => true, :hint => 'The sub domain available in mailgun'
+ # string :name, :required => true, :hint => 'Tell me your name'
+ # string :username, :required => true, :label => 'User Name'
+ # password :password, :required => true
+ # boolean :notify_me, :default => true, :label => 'Notify Me'
+
+ # White list settings for logging
+ # white_list :name, :username
+
+ # Define public and private methods here which will be available
+ # in the EventHandler and ActionHandler modules
+ end
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.