-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter51.amp
More file actions
52 lines (47 loc) · 2.3 KB
/
chapter51.amp
File metadata and controls
52 lines (47 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
%%[
/* Retrieve RMM data */
SET @replySubject = _RMM_ReplySubject
SET @replyBodyText = _RMM_ReplyBodyText
SET @replyBodyHTML = _RMM_ReplyBodyHTML
SET @replyHeaders = _RMM_Headers
SET @jobID = _RMM_JobID
SET @listID = _RMM_ListID
SET @batchID = _RMM_BatchID
SET @subscriberID = _RMM_SubscriberID
SET @recipientEmail = _RMM_RecipientEmailAddress
SET @subscriberKey = _RMM_RecipientSubscriberKey
/* Retrieve subscriber data */
SET @firstName = AttributeValue("FirstName")
SET @feedback = @replyBodyText /* Assume text-based feedback for simplicity */
/* Determine if the feedback is positive or negative */
IF (IndexOf(@feedback, "good") > 0) OR (IndexOf(@feedback, "excellent") > 0) THEN
SET @feedbackStatus = "Positive"
ELSE
SET @feedbackStatus = "Negative"
ENDIF
/* Store reply content into the Data Extension */
/* Assuming there's a Data Extension called 'Customer_Feedback' with the following columns:
SubscriberKey, FeedbackStatus, FeedbackContent, ReplySubject, ReplyBodyText, ReplyBodyHTML, Headers */
InsertDE("Customer_Feedback",
"SubscriberKey", @subscriberKey,
"FeedbackStatus", @feedbackStatus,
"FeedbackContent", @feedback,
"ReplySubject", @replySubject,
"ReplyBodyText", @replyBodyText,
"ReplyBodyHTML", @replyBodyHTML,
"ReplyHeaders", @replyHeaders,
"JobID", @jobID,
"ListID", @listID,
"BatchID", @batchID
)
/* Personalize thank-you message based on feedback */
IF @feedbackStatus == "Positive" THEN
SET @thankYouSubject = "Thank You for Your Positive Feedback!"
SET @thankYouMessage = Concat("Dear ", @firstName, ", Thank you for your positive feedback on our product! We’re thrilled to hear you loved it.")
ELSE
SET @thankYouSubject = "Thank You for Your Feedback - We’re Here to Help!"
SET @thankYouMessage = Concat("Dear ", @firstName, ", We appreciate your feedback on our product. We’re sorry it didn’t meet your expectations. Please let us know how we can improve your experience.")
ENDIF
/* Send the personalized thank-you email */
OutputLine(v(@thankYouMessage))
]%%