Skip to content

Contact#save doesn't update existing contacts #42

@piotrekbator

Description

@piotrekbator

This only started recently, it used to work. Probably the API has changed and this library is yet to be updated.

The problem is that I'm unable to update an existing contact. To reproduce the error try running this simple script (replacing the "*" with valid values):

require "get_response"

api_key = "*"
campaign_id = "*"
existing_email = "existing@example.com"

connection = GetResponse::Connection.new(api_key)
contact = connection.contacts.all(campaigns: [campaign_id], email: { EQUALS: existing_email }).first

contact.customs["test"] = "Test"
contact.save

And the last command that's supposed to update the contact raises the following exception: GetResponse::GetResponseError: {"message"=>"Contact already added to target campaign", "code"=>-1}.

I think that maybe the Contact#save method should use different API actions for updating an existing contact. The API documentation says here: https://github.com/GetResponse/DevZone/tree/master/API#add_contact (in the secend of the three warnings) that "To update existing contact use methods such as set_contact_name, set_contact_customs or set_contact_cycle. Old param action is deprecated and ignored."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions