Class: HighLevel::Resources::Contacts

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/contacts.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#add_contact_to_campaign(contact_id:, campaign_id:, body:, **_opts) ⇒ Object

Add Contact to Campaign

Add contact to Campaign



265
266
267
268
269
270
271
272
# File 'lib/high_level/resources/contacts.rb', line 265

def add_contact_to_campaign(contact_id:, campaign_id:, body:, **_opts)
  request(
    method: :post,
    path: "/contacts/#{contact_id}/campaigns/#{campaign_id}",
    security: ["bearer"],
    body: body
  )
end

#add_contact_to_workflow(contact_id:, workflow_id:, body:, **_opts) ⇒ Object

Add Contact to Workflow



293
294
295
296
297
298
299
300
# File 'lib/high_level/resources/contacts.rb', line 293

def add_contact_to_workflow(contact_id:, workflow_id:, body:, **_opts)
  request(
    method: :post,
    path: "/contacts/#{contact_id}/workflow/#{workflow_id}",
    security: ["bearer"],
    body: body
  )
end

#add_followers_contact(contact_id:, body:, **_opts) ⇒ Object

Add Followers



243
244
245
246
247
248
249
250
# File 'lib/high_level/resources/contacts.rb', line 243

def add_followers_contact(contact_id:, body:, **_opts)
  request(
    method: :post,
    path: "/contacts/#{contact_id}/followers",
    security: ["bearer"],
    body: body
  )
end

#add_remove_contact_from_business(body:, **_opts) ⇒ Object

Add/Remove Contacts From Business

Add/Remove Contacts From Business . Passing a ‘null` businessId will remove the businessId from the contacts



181
182
183
184
185
186
187
188
# File 'lib/high_level/resources/contacts.rb', line 181

def add_remove_contact_from_business(body:, **_opts)
  request(
    method: :post,
    path: "/contacts/bulk/business",
    security: [],
    body: body
  )
end

#add_tags(contact_id:, body:, **_opts) ⇒ Object

Add Tags



100
101
102
103
104
105
106
107
# File 'lib/high_level/resources/contacts.rb', line 100

def add_tags(contact_id:, body:, **_opts)
  request(
    method: :post,
    path: "/contacts/#{contact_id}/tags",
    security: ["bearer"],
    body: body
  )
end

#create_association(body:, **_opts) ⇒ Object

Update Contacts Tags

Allows you to update tags to multiple contacts at once, you can add or remove tags from the contacts



169
170
171
172
173
174
175
176
# File 'lib/high_level/resources/contacts.rb', line 169

def create_association(body:, **_opts)
  request(
    method: :post,
    path: "/contacts/bulk/tags/update/#{type}",
    security: [],
    body: body
  )
end

#create_contact(body:, **_opts) ⇒ Object

Create Contact

Please find the list of acceptable values for the ‘country` field <a href=“highlevel.stoplight.io/docs/integrations/ZG9jOjI4MzUzNDIy-country-list” target=“_blank”>here</a>



329
330
331
332
333
334
335
336
# File 'lib/high_level/resources/contacts.rb', line 329

def create_contact(body:, **_opts)
  request(
    method: :post,
    path: "/contacts/",
    security: ["bearer"],
    body: body
  )
end

#create_note(contact_id:, body:, **_opts) ⇒ Object

Create Note



129
130
131
132
133
134
135
136
# File 'lib/high_level/resources/contacts.rb', line 129

def create_note(contact_id:, body:, **_opts)
  request(
    method: :post,
    path: "/contacts/#{contact_id}/notes",
    security: ["bearer"],
    body: body
  )
end

#create_task(contact_id:, body:, **_opts) ⇒ Object

Create Task



43
44
45
46
47
48
49
50
# File 'lib/high_level/resources/contacts.rb', line 43

def create_task(contact_id:, body:, **_opts)
  request(
    method: :post,
    path: "/contacts/#{contact_id}/tasks",
    security: ["bearer"],
    body: body
  )
end

#delete_contact(contact_id:, **_opts) ⇒ Object

Delete Contact



212
213
214
215
216
217
218
# File 'lib/high_level/resources/contacts.rb', line 212

def delete_contact(contact_id:, **_opts)
  request(
    method: :delete,
    path: "/contacts/#{contact_id}",
    security: ["bearer"]
  )
end

#delete_contact_from_workflow(contact_id:, workflow_id:, body:, **_opts) ⇒ Object

Delete Contact from Workflow



303
304
305
306
307
308
309
310
# File 'lib/high_level/resources/contacts.rb', line 303

def delete_contact_from_workflow(contact_id:, workflow_id:, body:, **_opts)
  request(
    method: :delete,
    path: "/contacts/#{contact_id}/workflow/#{workflow_id}",
    security: ["bearer"],
    body: body
  )
end

#delete_note(contact_id:, id:, **_opts) ⇒ Object

Delete Note



158
159
160
161
162
163
164
# File 'lib/high_level/resources/contacts.rb', line 158

def delete_note(contact_id:, id:, **_opts)
  request(
    method: :delete,
    path: "/contacts/#{contact_id}/notes/#{id}",
    security: ["bearer"]
  )
end

#delete_task(contact_id:, task_id:, **_opts) ⇒ Object

Delete Task



72
73
74
75
76
77
78
# File 'lib/high_level/resources/contacts.rb', line 72

def delete_task(contact_id:, task_id:, **_opts)
  request(
    method: :delete,
    path: "/contacts/#{contact_id}/tasks/#{task_id}",
    security: ["bearer"]
  )
end

#get_all_notes(contact_id:, **_opts) ⇒ Object

Get All Notes



120
121
122
123
124
125
126
# File 'lib/high_level/resources/contacts.rb', line 120

def get_all_notes(contact_id:, **_opts)
  request(
    method: :get,
    path: "/contacts/#{contact_id}/notes",
    security: ["bearer"]
  )
end

#get_all_tasks(contact_id:, **_opts) ⇒ Object

Get all Tasks



34
35
36
37
38
39
40
# File 'lib/high_level/resources/contacts.rb', line 34

def get_all_tasks(contact_id:, **_opts)
  request(
    method: :get,
    path: "/contacts/#{contact_id}/tasks",
    security: ["bearer"]
  )
end

#get_appointments_for_contact(contact_id:, **_opts) ⇒ Object

Get Appointments for Contact



91
92
93
94
95
96
97
# File 'lib/high_level/resources/contacts.rb', line 91

def get_appointments_for_contact(contact_id:, **_opts)
  request(
    method: :get,
    path: "/contacts/#{contact_id}/appointments",
    security: ["bearer"]
  )
end

#get_contact(contact_id:, **_opts) ⇒ Object

Get Contact



191
192
193
194
195
196
197
# File 'lib/high_level/resources/contacts.rb', line 191

def get_contact(contact_id:, **_opts)
  request(
    method: :get,
    path: "/contacts/#{contact_id}",
    security: ["bearer"]
  )
end

#get_contacts(location_id: nil, start_after_id: nil, start_after: nil, query: nil, limit: nil, **_opts) ⇒ Object

Get Contacts

Get Contacts

**Note:** This API endpoint is deprecated. Please use the [Search Contacts](https://marketplace.gohighlevel.com/docs/ghl/contacts/search-contacts-advanced) endpoint instead.


317
318
319
320
321
322
323
324
# File 'lib/high_level/resources/contacts.rb', line 317

def get_contacts(location_id: nil, start_after_id: nil, start_after: nil, query: nil, limit: nil, **_opts)
  request(
    method: :get,
    path: "/contacts/",
    security: ["bearer"],
    params: { "locationId" => location_id, "startAfterId" => start_after_id, "startAfter" => start_after, "query" => query, "limit" => limit }.compact
  )
end

#get_contacts_by_business_id(business_id:, limit: nil, location_id: nil, skip: nil, query: nil, **_opts) ⇒ Object

Get Contacts By BusinessId



233
234
235
236
237
238
239
240
# File 'lib/high_level/resources/contacts.rb', line 233

def get_contacts_by_business_id(business_id:, limit: nil, location_id: nil, skip: nil, query: nil, **_opts)
  request(
    method: :get,
    path: "/contacts/business/#{business_id}",
    security: ["bearer"],
    params: { "limit" => limit, "locationId" => location_id, "skip" => skip, "query" => query }.compact
  )
end

#get_duplicate_contact(location_id: nil, number: nil, email: nil, **_opts) ⇒ Object

Get Duplicate Contact

Get Duplicate Contact.<br/><br/>If ‘Allow Duplicate Contact` is disabled under Settings, the global unique identifier will be used for searching the contact. If the setting is enabled, first priority for search is `email` and the second priority will be `phone`.



24
25
26
27
28
29
30
31
# File 'lib/high_level/resources/contacts.rb', line 24

def get_duplicate_contact(location_id: nil, number: nil, email: nil, **_opts)
  request(
    method: :get,
    path: "/contacts/search/duplicate",
    security: ["bearer"],
    params: { "locationId" => location_id, "number" => number, "email" => email }.compact
  )
end

#get_note(contact_id:, id:, **_opts) ⇒ Object

Get Note



139
140
141
142
143
144
145
# File 'lib/high_level/resources/contacts.rb', line 139

def get_note(contact_id:, id:, **_opts)
  request(
    method: :get,
    path: "/contacts/#{contact_id}/notes/#{id}",
    security: ["bearer"]
  )
end

#get_task(contact_id:, task_id:, **_opts) ⇒ Object

Get Task



53
54
55
56
57
58
59
# File 'lib/high_level/resources/contacts.rb', line 53

def get_task(contact_id:, task_id:, **_opts)
  request(
    method: :get,
    path: "/contacts/#{contact_id}/tasks/#{task_id}",
    security: ["bearer"]
  )
end

#remove_contact_from_campaign(contact_id:, campaign_id:, **_opts) ⇒ Object

Remove Contact From Campaign



275
276
277
278
279
280
281
# File 'lib/high_level/resources/contacts.rb', line 275

def remove_contact_from_campaign(contact_id:, campaign_id:, **_opts)
  request(
    method: :delete,
    path: "/contacts/#{contact_id}/campaigns/#{campaign_id}",
    security: ["bearer"]
  )
end

#remove_contact_from_every_campaign(contact_id:, **_opts) ⇒ Object

Remove Contact From Every Campaign



284
285
286
287
288
289
290
# File 'lib/high_level/resources/contacts.rb', line 284

def remove_contact_from_every_campaign(contact_id:, **_opts)
  request(
    method: :delete,
    path: "/contacts/#{contact_id}/campaigns/removeAll",
    security: ["bearer"]
  )
end

#remove_followers_contact(contact_id:, body:, **_opts) ⇒ Object

Remove Followers



253
254
255
256
257
258
259
260
# File 'lib/high_level/resources/contacts.rb', line 253

def remove_followers_contact(contact_id:, body:, **_opts)
  request(
    method: :delete,
    path: "/contacts/#{contact_id}/followers",
    security: ["bearer"],
    body: body
  )
end

#remove_tags(contact_id:, body:, **_opts) ⇒ Object

Remove Tags



110
111
112
113
114
115
116
117
# File 'lib/high_level/resources/contacts.rb', line 110

def remove_tags(contact_id:, body:, **_opts)
  request(
    method: :delete,
    path: "/contacts/#{contact_id}/tags",
    security: ["bearer"],
    body: body
  )
end

#search_contacts_advanced(body:, **_opts) ⇒ Object

Search Contacts

Search contacts based on combinations of advanced filters. Documentation Link - doc.clickup.com/8631005/d/h/87cpx-158396/6e629989abe7fad



12
13
14
15
16
17
18
19
# File 'lib/high_level/resources/contacts.rb', line 12

def search_contacts_advanced(body:, **_opts)
  request(
    method: :post,
    path: "/contacts/search",
    security: ["bearer"],
    body: body
  )
end

#update_contact(contact_id:, body:, **_opts) ⇒ Object

Update Contact

Please find the list of acceptable values for the ‘country` field <a href=“highlevel.stoplight.io/docs/integrations/ZG9jOjI4MzUzNDIy-country-list” target=“_blank”>here</a>



202
203
204
205
206
207
208
209
# File 'lib/high_level/resources/contacts.rb', line 202

def update_contact(contact_id:, body:, **_opts)
  request(
    method: :put,
    path: "/contacts/#{contact_id}",
    security: ["bearer"],
    body: body
  )
end

#update_note(contact_id:, id:, body:, **_opts) ⇒ Object

Update Note



148
149
150
151
152
153
154
155
# File 'lib/high_level/resources/contacts.rb', line 148

def update_note(contact_id:, id:, body:, **_opts)
  request(
    method: :put,
    path: "/contacts/#{contact_id}/notes/#{id}",
    security: ["bearer"],
    body: body
  )
end

#update_task(contact_id:, task_id:, body:, **_opts) ⇒ Object

Update Task



62
63
64
65
66
67
68
69
# File 'lib/high_level/resources/contacts.rb', line 62

def update_task(contact_id:, task_id:, body:, **_opts)
  request(
    method: :put,
    path: "/contacts/#{contact_id}/tasks/#{task_id}",
    security: ["bearer"],
    body: body
  )
end

#update_task_completed(contact_id:, task_id:, body:, **_opts) ⇒ Object

Update Task Completed



81
82
83
84
85
86
87
88
# File 'lib/high_level/resources/contacts.rb', line 81

def update_task_completed(contact_id:, task_id:, body:, **_opts)
  request(
    method: :put,
    path: "/contacts/#{contact_id}/tasks/#{task_id}/completed",
    security: ["bearer"],
    body: body
  )
end

#upsert_contact(body:, **_opts) ⇒ Object

Upsert Contact

Please find the list of acceptable values for the ‘country` field <a href=“highlevel.stoplight.io/docs/integrations/ZG9jOjI4MzUzNDIy-country-list” target=“_blank”>here</a><br/><br/>The Upsert API will adhere to the configuration defined under the “Allow Duplicate Contact” setting at the Location level. If the setting is configured to check both Email and Phone, the API will attempt to identify an existing contact based on the priority sequence specified in the setting, and will create or update the contact accordingly.<br/><br/>If two separate contacts already exist—one with the same email and another with the same phone—and an upsert request includes both the email and phone, the API will update the contact that matches the first field in the configured sequence, and ignore the second field to prevent duplication.



223
224
225
226
227
228
229
230
# File 'lib/high_level/resources/contacts.rb', line 223

def upsert_contact(body:, **_opts)
  request(
    method: :post,
    path: "/contacts/upsert",
    security: ["bearer"],
    body: body
  )
end