Vision 6

resubscribeContact

Resets the unsubscribe flag on a Contact.

resubscribeContact

Resets the unsubscribe flag on a Contact.

Top ↑

Syntax

int resubscribeContact(
    string api_key,
    int list_id,
    int contact_id,
  [ string consent_type,
    string consent_text,
    object list_preferences,
    string ip_address ] 
);

Parameters

api_key (string)

The key required to access the API. See Getting Started for more information.

list_id (int)

The ID of the List containing the Contact.

contact_id (int)

The ID of the Contact to resubscribe.

consent_type (string - optional)

A flag that provides the level of consent the contact has agreed to. Valid values are:

  • gdpr - The contact has accepted the required consent text and agrees that their personal details will be added to the list.
  • direct - The contact has been supplied with the intent of supplying their personal details.
  • not_recorded - The contact was not supplied with the implication of a Direct or GDPR agreement (default).

If the list is marked as GDPR compliant, consent_type is required to be gdpr, with a supplied consent_text.

consent_text (string - optional)

A summary of the text the contact accepted to when requesting to be added to the list. ie, "Our mail provider is Vision6 and by submitting this form I consent to receiving marketing content.". This information is recommended and required when the consent_type is gdpr. This text has a 255 character limit.

list_preferences (object - optional)

An object of preference name keys with boolean values to signify that the contact wishes to agree to or decline from certain preferences. Preferences not in this object are ignored.

ip_address (string - optional)

The contact's last known IP address.

Return Value

Returns the Contact ID on success.

Examples

In the following example, Contact ID 234 is resubscribed to List 1234567.

PHP

$list_id    = 1234567; // can be obtained using searchLists()
$contact_id = 234;     // can be obtained using searchContacts()

$consent_type = 'gdpr';
$consent_text = 'By submitting this form I consent to receiving marketing content.';

$list_preferences    = array(
    'Newsletters' => true,
    'Promotions'  => false,
);

$api = new Api($url, 'YOURAPIKEY');
$contact_id = $api->invokeMethod(
    'resubscribeContact',
    $list_id,
    $contact_id,
    $consent_type,
    $consent_text,
    $list_preferences,
    '0.0.0.0'
);

JSON Request

{
    "id": 1,
    "method": "resubscribeContact",
    "params": [
        "YOURAPIKEY",
        1234567,
        234,
        "direct",
        "By submitting this form I consent to receiving marketing content.",
        {
            "Newsletters": true,
            "Promotions": false
        },
        "0.0.0.0"
    ]
}

JSON Response

{
    "id": 1,
    "result": 234,
    "error": null
}

Remarks

This method resets the unsubscribe flag on a Contact. It does not remove the Contact from the Unsubscriber List.

Error Codes

This method may return the following error codes in addition to the standard error codes:

Code Error Description
303 Unable to Load List list_id is not a valid List
304 Unable to Load Contact contact_id is not a valid Contact in the List
302 Undefined Error: Contact Resubscribe Failed An internal error occurred.
334 Invalid Contact consent type The consent_type was supplied with a value other than gdpr, direct or not_recorded
335 The GDPR Contact consent type and consent text are required for this list To resubscribe this contact the consent_type must be gdpr and a consent_text must be supplied

See Also