From 36b78f5034bb635bdea2971426f529775f6b3d3c Mon Sep 17 00:00:00 2001 From: Roberto Pezzali Date: Sat, 8 Aug 2020 18:07:08 +0200 Subject: [PATCH] Add update_contact_list endpoint to add user to a list Missing endpoint that i need for my project --- lib/active_campaign/api/contacts.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lib/active_campaign/api/contacts.rb b/lib/active_campaign/api/contacts.rb index 19466b4..336f198 100644 --- a/lib/active_campaign/api/contacts.rb +++ b/lib/active_campaign/api/contacts.rb @@ -122,6 +122,25 @@ def delete_contact(id) def update_contact(id, params) put("contacts/#{id}", contact: params) end + + # + # Update list status for a contact + # + # @param [Hash] params to manage list status for a user + # @option params [Integer] :list - ID of the list to subscribe the contact to + # @option params [Integer] :contact - ID of the contact to subscribe to the list + # @option params [Integer] :status Set to "1" to subscribe the contact to the list. Set to "2" to unsubscribe the contact from the list. + # + # @return [Hash] a hash with information about the newly created contact + # + + "list": 2, + "contact": 1, + "status": 1 + + def update_contact_list(params) + post("contactList", contact: params) + end end end end