Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added ability to remove not engaged contacts #26

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/tasks/cleanup.rake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ namespace :cleanup do
end
end

desc "delete not engaged contacts in customer.io from leads marked as 'bad fit'"
task customer_io_contacts: :environment do
customerio = Customerio::Client.new(ENV['CUSTOMER_IO_SITE_ID'], ENV['CUSTOMER_IO_KEY'])

close_contacts = @close_api.search('bad_fit__not_engaged.json')
close_contacts.each do |contact|
found_contact = @close_api.find_contact(contact["id"])

customerio.delete(found_contact["emails"][0]["email"])
end
end

# we are using this to move opportunities from 'VIP' to 'Automated' pipelines
# NOTE: The VIP pipeline is gone, but I am leaving this here for a reference.
desc "Move oops between pipelines from 'VIP inbox' to the 'Automated inbox'"
Expand Down
70 changes: 70 additions & 0 deletions lib/tasks/search/bad_fit__not_engaged.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"limit": null,
"query": {
"negate": false,
"queries": [
{
"negate": false,
"object_type": "contact",
"type": "object_type"
},
{
"negate": false,
"queries": [
{
"negate": false,
"queries": [
{
"condition": {
"type": "term",
"values": [
"Yes"
]
},
"field": {
"custom_field_id": "cf_VImU7puejeNhbTrVKvyPx5QhS9wVawZ0uLFwDYZB35K",
"type": "custom_field"
},
"negate": false,
"type": "field_condition"
}
],
"type": "and"
},
{
"negate": false,
"related_object_type": "lead",
"related_query": {
"negate": false,
"queries": [
{
"condition": {
"object_ids": [
"stat_JemNT0UgRV1wWyw2mnAt7SdNb4zUCgv4ksbcv2Rr4l3"
],
"reference_type": "status.lead",
"type": "reference"
},
"field": {
"field_name": "status_id",
"object_type": "lead",
"type": "regular_field"
},
"negate": false,
"type": "field_condition"
}
],
"type": "and"
},
"this_object_type": "contact",
"type": "has_related"
}
],
"type": "and"
}
],
"type": "and"
},
"results_limit": null,
"sort": []
}
30 changes: 0 additions & 30 deletions lib/tasks/search/nurture.json

This file was deleted.