Update Customer Preference and Send Message
Overview
This scenario creates an event for an existing customer. The event message also contains customer attributes and customer preference data, which is saved in the customer profile before the message is sent. The event belongs to a valid Connect customer who is already subscribed to the campaign's conversation.
Assumptions
The Gender attribute and Favorite Color preference were created in Connect.
The Gender attribute is a string data type and is bounded by the values Male and Female.
The Favorite Color preference is a string datatype, allows multiple values, and is not bounded.
The XSL used in the campaign is the same as in previous scenarios.
XML
<?xml version=
"1.0"
encoding=
"UTF-8"
?>
<kanaRoot>
<EventRequest Id=
""
CompanyName=
"default"
>
<CustomerAttribute Name=
"Gender"
>Male</CustomerAttribute>
<CustomerPreference Name=
"Favorite Color"
>
<CustomerPreferenceValue>Red</CustomerPreferenceValue >
<CustomerPreferenceValue>Blue</CustomerPreferenceValue >
</CustomerPreference>
</Customer>
<Event CampaignName=
"ETCamp1"
>
<ExternalXML>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>
10.90
</price>
<year>
1985
</year>
</cd>
<cd>
<title>Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>
9.90
</price>
<year>
1982
</year>
</cd>
</catalog>
</ExternalXML>
</Event>
</EventRequest>
</kanaRoot>
Create a campaign
Result
The CUST_ATTRIBUTES and CUST_PREFERENCES tables are updated for customer John Smith as follows:
Gender=Male
Favorite Color=Red,Blue
An email is sent to [email protected]. The email content of the email is:
Your CD Collection
Note: If the attribute or preferences mentioned in the XML are not available in the database, Event Listener does not accept the event request.
In this case, Event Listener responds with the following error:
‘
554
KcXmlSaveException (KcXmlException (Customer attribute Attribute( name:
Att1, value: New Attribute) not found!)’.