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) ⇒ Integer

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

Examples:

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


12
13
14
15
16
# File 'lib/infusionsoft/client/contact.rb', line 12

def contact_add(data)
  contact_id = get('ContactService.add', data)
  if data.has_key?(:Email); email_optin(data[:Email], "requested information"); 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.



179
180
181
182
183
# File 'lib/infusionsoft/client/contact.rb', line 179

def contact_add_recurring_order(contact_id, allow_duplicate, cprogram_id, ,
                                credit_card_id, affiliate_id, days_till_charge)
  response = get('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).



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

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

#contact_add_to_group(contact_id, group_id) ⇒ Boolean

Adds a tag to a contact



142
143
144
# File 'lib/infusionsoft/client/contact.rb', line 142

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

#contact_add_with_dup_check(data, check_type) ⇒ Integer

Adds or updates a contact record based on matching data



32
33
34
35
36
# File 'lib/infusionsoft/client/contact.rb', line 32

def contact_add_with_dup_check(data, check_type)
  contact_id = get('ContactService.addWithDupCheck', data, check_type)
  if data.has_key?(:Email); email_optin(data[:Email], "requested information"); 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.



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

def contact_find_by_email(email, selected_fields)
  response = get('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.



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

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


158
159
160
# File 'lib/infusionsoft/client/contact.rb', line 158

def contact_link_contact(remoteApp, remoteId, localId)
  response = get('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" }


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

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


163
164
165
# File 'lib/infusionsoft/client/contact.rb', line 163

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


167
168
169
# File 'lib/infusionsoft/client/contact.rb', line 167

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

#contact_merge(contact_id, duplicate_contact_id) ⇒ Object

Merge two contacts together.



22
23
24
# File 'lib/infusionsoft/client/contact.rb', line 22

def contact_merge(contact_id, duplicate_contact_id)
  response = get('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



97
98
99
# File 'lib/infusionsoft/client/contact.rb', line 97

def contact_pause_campaign(contact_id, campaign_id)
  response = get('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



106
107
108
# File 'lib/infusionsoft/client/contact.rb', line 106

def contact_remove_from_campaign(contact_id, campaign_id)
  response = get('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).



133
134
135
# File 'lib/infusionsoft/client/contact.rb', line 133

def contact_remove_from_group(contact_id, group_id)
  response = get('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.



124
125
126
# File 'lib/infusionsoft/client/contact.rb', line 124

def contact_reschedule_campaign_step(list_of_contacts, step_id)
  response = get('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.



115
116
117
# File 'lib/infusionsoft/client/contact.rb', line 115

def contact_resume_campaign(contact_id, campaign_id)
  response = get('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 }]


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

def contact_run_action_set(contact_id, action_set_id)
  response = get('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



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

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

#contact_update(contact_id, data) ⇒ Integer

Updates a contact in the database.

Examples:

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


45
46
47
48
49
# File 'lib/infusionsoft/client/contact.rb', line 45

def contact_update(contact_id, data)
  contact_id = get('ContactService.update', contact_id, data)
  if data.has_key?(:Email); email_optin(data[:Email], "requested information"); end
  return contact_id
end