wco_email 0.1.1.135 → 0.1.1.136
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c920c0ce8ae8d6be19d6082a242f6d9d61ede4b85bfcdca7a680cca133abcf49
|
|
4
|
+
data.tar.gz: 3cf6dbdf328d8b996ed111df5ad3e7880b4704439ac5be41783d36e4dcd17185
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 41f0243a85a81ca840c9c20d8926e84fe02cdc3b6fad8218c6ea0145e50538fe157e55a9491d9fda3fa9a425c65d52e3330299c9fe4435fdbc453f6abd3ccee6
|
|
7
|
+
data.tar.gz: d323ddf5c01c912a42a2c272a949fdaadc2548e51a3f65a570ce2757bcb07d16c1313c68a096fa376a0fd6e633737a7499d025bfdfa8e081ea7ca739e8cda67b
|
|
@@ -3,6 +3,35 @@ class WcoEmail::MessagesController < WcoEmail::ApplicationController
|
|
|
3
3
|
|
|
4
4
|
before_action :set_lists, except: %i| show_iframe |
|
|
5
5
|
|
|
6
|
+
def autorespond
|
|
7
|
+
@message = WcoEmail::Message.find params[:id]
|
|
8
|
+
authorize! :show, @message
|
|
9
|
+
|
|
10
|
+
task = 'You are an administrative assistant. Write a brief email response to the following email. exclude subject. exclude footer. exclude signature. format as <p></p> html paragraphs.'
|
|
11
|
+
content = @message.part_txt
|
|
12
|
+
outs = Wco::AiWriter.do_call(task, content)
|
|
13
|
+
puts! outs, 'outs'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@ctx = WcoEmail::Context.new({
|
|
17
|
+
bcc_self: true,
|
|
18
|
+
body: outs,
|
|
19
|
+
email_template: WcoEmail::EmailTemplate.blank,
|
|
20
|
+
from_email: @message.to,
|
|
21
|
+
lead: @message.lead,
|
|
22
|
+
reply_to_message_id: @message.id,
|
|
23
|
+
# send_at: Time.now,
|
|
24
|
+
subject: @message.subject,
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
if @ctx.save
|
|
28
|
+
flash_notice 'Saved.'
|
|
29
|
+
else
|
|
30
|
+
flash_alert @ctx
|
|
31
|
+
end
|
|
32
|
+
redirect_to request.referrer
|
|
33
|
+
end
|
|
34
|
+
|
|
6
35
|
def show
|
|
7
36
|
@client ||= Aws::S3::Client.new(::SES_S3_CREDENTIALS)
|
|
8
37
|
@message = WcoEmail::Message.find params[:id]
|
|
@@ -46,4 +46,5 @@
|
|
|
46
46
|
= paginate @messages, param_name: :messages_page
|
|
47
47
|
|
|
48
48
|
- msg = @messages.last
|
|
49
|
-
= render '/wco_email/contexts/form_reply', lead_id: msg.lead_id, message: msg, ctx: WcoEmail::Context.new({ from_email: msg.to&.downcase, subject: msg.subject, email_template_id: ET.find_by( slug: 'blank').id })
|
|
49
|
+
= render '/wco_email/contexts/form_reply', lead_id: msg.lead_id, message: msg, ctx: WcoEmail::Context.new({ from_email: msg.to&.downcase, subject: msg.subject, email_template_id: ET.find_by( slug: 'blank').id })
|
|
50
|
+
= button_to 'autorespond', message_autorespond_path(msg), data: { confirm: 'Are you sure?' }
|
data/config/routes.rb
CHANGED
|
@@ -60,7 +60,8 @@ WcoEmail::Engine.routes.draw do
|
|
|
60
60
|
resources :lead_action_templates
|
|
61
61
|
resources :lead_actions
|
|
62
62
|
|
|
63
|
-
get
|
|
63
|
+
get 'messages/:id/iframe', to: 'messages#show_iframe', as: :message_iframe
|
|
64
|
+
post 'messages/:id/autorespond', to: 'messages#autorespond', as: :message_autorespond
|
|
64
65
|
resources :messages
|
|
65
66
|
|
|
66
67
|
post 'message_stub/:id/churn', to: 'message_stubs#churn', as: :churn_message_stub
|