Module: Infusionsoft::Client::Contact

Included in:
Infusionsoft::Client
Defined in:
lib/infusionsoft/client/contact.rb

Overview

Contact service is used to manage contacts. You can add, update and find contacts in addition to managing follow up sequences, tags and action sets.

Instance Method Summary collapse

Instance Method Details

#contact_add(data, optin_status = nil) ⇒ Integer

Creates a new contact record from the data passed in the associative array.

“Opted in” using the verviage supplied here.

Examples:

{ :Email => '[email protected]', :FirstName => 'first_name', :LastName => 'last_name' }, 'New Signup'


14
15
16
17
18
19
# File 'lib/infusionsoft/client/contact.rb', line 14

def contact_add(data, optin_status=nil)
  contact_id = xmlrpc('ContactService.add', data)
  email = data['Email'] || data[:Email]
  if optin_status && email; email_optin(email, optin_status); end
  return contact_id
end

#contact_add_recurring_order(contact_id, allow_duplicate, cprogram_id, merchant_account_id, credit_card_id, affiliate_id, days_till_charge) ⇒ Object

Creates a new recurring order for a contact.



190
191
192
193
194
# File 'lib/infusionsoft/client/contact.rb', line 190

def contact_add_recurring_order(contact_id, allow_duplicate, cprogram_id, ,
                                credit_card_id, affiliate_id, days_till_charge)
  response = xmlrpc('ContactService.addRecurringOrder', contact_id, allow_duplicate, cprogram_id,
                      , credit_card_id, affiliate_id, days_till_charge)
end

#contact_add_to_campaign(contact_id, campaign_id) ⇒ Boolean

Adds a contact to a follow-up sequence (campaigns were the original name of follow-up sequences).



89
90
91
# File 'lib/infusionsoft/client/contact.rb', line 89

def contact_add_to_campaign(contact_id, campaign_id)
  response = xmlrpc('ContactService.addToCampaign', contact_id, campaign_id)
end

#contact_add_to_group(contact_id, group_id) ⇒ Boolean

Adds a tag to a contact



153
154
155
# File 'lib/infusionsoft/client/contact.rb', line 153

def contact_add_to_group(contact_id, group_id)
  response = xmlrpc('ContactService.addToGroup', contact_id, group_id)
end

#contact_add_with_dup_check(data, check_type, optin_status = nil) ⇒ Integer

Adds or updates a contact record based on matching data

“Opted in” using the verviage supplied here.

Examples:

{ :Email => '[email protected]', :FirstName => 'first_name', :LastName => 'last_name' }, 'Email', 'New Signup'


39
40
41
42
43
44
# File 'lib/infusionsoft/client/contact.rb', line 39

def contact_add_with_dup_check(data, check_type, optin_status=nil)
  contact_id = xmlrpc('ContactService.addWithDupCheck', data, check_type)
  email = data['Email'] || data[:Email]
  if optin_status && email; email_optin(email, optin_status); end
  return contact_id
end

#contact_find_by_email(email, selected_fields) ⇒ Array<Hash>

Finds all contacts with the supplied email address in any of the three contact record email addresses.



79
80
81
# File 'lib/infusionsoft/client/contact.rb', line 79

def contact_find_by_email(email, selected_fields)
  response = xmlrpc('ContactService.findByEmail', email, selected_fields)
end

#contact_get_next_campaign_step(contact_id, campaign_id) ⇒ Integer

Returns the Id number of the next follow-up sequence step for the given contact.



99
100
101
# File 'lib/infusionsoft/client/contact.rb', line 99

def contact_get_next_campaign_step(contact_id, campaign_id)
  response = xmlrpc('ContactService.getNextCampaignStep', contact_id, campaign_id)
end


169
170
171
# File 'lib/infusionsoft/client/contact.rb', line 169

def contact_link_contact(remoteApp, remoteId, localId)
  response = xmlrpc('ContactService.linkContact', remoteApp, remoteId, localId)
end

#contact_load(id, selected_fields) ⇒ Array

Loads a contact from the database

Examples:

this is what you would get back

{ "FirstName" => "John", "LastName" => "Doe" }


69
70
71
# File 'lib/infusionsoft/client/contact.rb', line 69

def contact_load(id, selected_fields)
  response = xmlrpc('ContactService.load', id, selected_fields)
end


174
175
176
# File 'lib/infusionsoft/client/contact.rb', line 174

def contact_locate_contact_link(locate_map_id)
  response = xmlrpc('ContactService.locateContactLink', locate_map_id)
end


178
179
180
# File 'lib/infusionsoft/client/contact.rb', line 178

def contact_mark_link_updated(locate_map_id)
  response = xmlrpc('ContactService.markLinkUpdated', locate_map_id)
end

#contact_merge(contact_id, duplicate_contact_id) ⇒ Object

Merge two contacts together.



25
26
27
# File 'lib/infusionsoft/client/contact.rb', line 25

def contact_merge(contact_id, duplicate_contact_id)
  response = xmlrpc('ContactService.merge', contact_id, duplicate_contact_id)
end

#contact_pause_campaign(contact_id, campaign_id) ⇒ Boolean

Pauses a follow-up sequence for the given contact record



108
109
110
# File 'lib/infusionsoft/client/contact.rb', line 108

def contact_pause_campaign(contact_id, campaign_id)
  response = xmlrpc('ContactService.pauseCampaign', contact_id, campaign_id)
end

#contact_remove_from_campaign(contact_id, campaign_id) ⇒ Boolean

Removes a follow-up sequence from a contact record



117
118
119
# File 'lib/infusionsoft/client/contact.rb', line 117

def contact_remove_from_campaign(contact_id, campaign_id)
  response = xmlrpc('ContactService.removeFromCampaign', contact_id, campaign_id)
end

#contact_remove_from_group(contact_id, group_id) ⇒ Boolean

Removes a tag from a contact (groups were the original name of tags).



144
145
146
# File 'lib/infusionsoft/client/contact.rb', line 144

def contact_remove_from_group(contact_id, group_id)
  response = xmlrpc('ContactService.removeFromGroup', contact_id, group_id)
end

#contact_reschedule_campaign_step(list_of_contacts, step_id) ⇒ Boolean

Immediately performs the given follow-up sequence step_id for the given contacts.



135
136
137
# File 'lib/infusionsoft/client/contact.rb', line 135

def contact_reschedule_campaign_step(list_of_contacts, step_id)
  response = xmlrpc('ContactService.reschedulteCampaignStep', list_of_contacts, step_id)
end

#contact_resume_campaign(contact_id, campaign_id) ⇒ Boolean

Resumes a follow-up sequence that has been stopped/paused for a given contact.



126
127
128
# File 'lib/infusionsoft/client/contact.rb', line 126

def contact_resume_campaign(contact_id, campaign_id)
  response = xmlrpc('ConactService.resumeCampaignForContact', contact_id, campaign_id)
end

#contact_run_action_set(contact_id, action_set_id) ⇒ Array<Hash>

Runs an action set on a given contact record

Examples:

here is a list of what you get back

[{ 'Action' => 'Create Task', 'Message' => 'task1 (Task) sent successfully', 'isError' =>
nil }]


165
166
167
# File 'lib/infusionsoft/client/contact.rb', line 165

def contact_run_action_set(contact_id, action_set_id)
  response = xmlrpc('ContactService.runActionSequence', contact_id, action_set_id)
end

#contact_run_action_set_with_params(contact_id, action_set_id, data) ⇒ Object

Executes an action sequence for a given contact, passing in runtime params for running affiliate signup actions, etc



202
203
204
# File 'lib/infusionsoft/client/contact.rb', line 202

def contact_run_action_set_with_params(contact_id, action_set_id, data)
  response = xmlrpc('ContactService.runActionSequence', contact_id, action_set_id, data)
end

#contact_update(contact_id, data, optin_status = nil) ⇒ Integer

Updates a contact in the database.

“Opted in” using the verviage supplied here.

Examples:

{ :FirstName => 'first_name', :StreetAddress1 => '123 N Street' }, 'New Signup'


55
56
57
58
59
60
# File 'lib/infusionsoft/client/contact.rb', line 55

def contact_update(contact_id, data, optin_status=nil)
  contact_id = xmlrpc('ContactService.update', contact_id, data)
  email = data['Email'] || data[:Email]
  if optin_status && email; email_optin(email, optin_status); end
  return contact_id
end