Skip to content

List Management API Calls

12and1studio edited this page Nov 5, 2014 · 2 revisions
# define a responsys member
responsys_member = Responsys::Member.new("email_address")

# specify the email list in which the member resides
email_list = Responsys::Api::Object::InteractObject.new("folder_name", "list_name")

Check if an email is subscribed

def subscribed?
 response = responsys_member.subscribed?(email_list)
 return false if response.is_a?(Hash) && response[:status] && response[:status] == "failure"
 response
end

Unsubscribe an email

responsys_member.unsubscribe(email_list)

Subscribe an email

responsys_member.subscribe(email_list)

Add a member to the email list & set EMAIL_PERMISSION_STATUS to opt-in

subscribe = true
responsys_member.add_to_list(email_list, subscribe)

Update a specific attribute for a member of the list ie) an email address

*requires the member's riid

data = [{RIID_:  12345, EMAIL_ADDRESS_: "email_address"}]
record = Responsys::Api::Object::RecordData.new(data)

# build a merge rule that will match a record according to the riid
rule = Responsys::Api::Object::ListMergeRule.new(matchColumnName1: "RIID_")

Responsys::Api::Client.instance.merge_list_members(email_list, record, rule)