Managing newsletter agreements with API

Enabling with single/double opt-in

Ensure that a workflow for collecting newsletter agreements is running.

Send a create/update API call with the "newsletter_agreement_enabled": "enabled" attribute.
API reference is available here.

curl --location --request POST 'https://{SYNERISE_API_BASE_PATH}/v4/clients/batch' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Api-Version: 4.4' \
--header 'Authorization: Bearer eyJ...G2DI' \
--data-raw '[
   {
      "clientId": 12345,
      "attributes": {
          "newsletter_agreement_enabled": "enabled"
      }
   }
]'

This information is processed in the following way:

  1. The customer’s profile is updated with the 'newsletter_agreement_enabled': 'enabled' attribute.
  2. An event with details of the profile update is created and triggers the workflow that collects newsletter agreements.
  3. One of the following happens:
    • If single opt-in is used, the agreement is enabled. Depending on the workflow configuration, the customer may receive an email with a notification.
    • If double opt-in is used, the customer receives an email and must click the link in that email to confirm the subscription.

Enabling immediately

You can also immediately enable an agreement over the API, without asking for confirmation or notifying the customer.

If you use email address as a unique identifier, send a create/update API call with the agreements.email param set to true.

curl --location --request POST 'https://{SYNERISE_API_BASE_PATH}/v4/clients/batch' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Api-Version: 4.4' \
--header 'Authorization: Bearer eyJ...G2DI' \
--data-raw '[
   {
      "clientId": 12345,
      "agreements": {
         "email": true
         }
   }
]'

If you configured non-unique emails, send a create/update API call which changes the attribute you set as the agreement indicator to enabled

curl --location --request POST 'https://{SYNERISE_API_BASE_PATH}/v4/clients/batch' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Api-Version: 4.4' \
--header 'Authorization: Bearer eyJ...G2DI' \
--data-raw '[
   {
      "clientId": 12345,
      "attributes": {
         "the-newsletter-agreement-attribute-you-set-up": "enabled"
         }
   }
]'

The agreement is enabled immediately.

API reference is available here.

Disabling a newsletter agreement

If you use email address as a unique identifier, send a create/update API call with the agreements.email param set to false. API reference is available here.

curl --location --request POST 'https://{SYNERISE_API_BASE_PATH}/v4/clients/batch' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Api-Version: 4.4' \
--header 'Authorization: Bearer eyJ...G2DI' \
--data-raw '[
   {
      "clientId": 12345,
      "agreements": {
         "email": false
         }
   }
]'

If you configured non-unique emails, send a create/update API call which changes the attribute you set as the agreement indicator to disabled

curl --location --request POST 'https://{SYNERISE_API_BASE_PATH}/v4/clients/batch' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Api-Version: 4.4' \
--header 'Authorization: Bearer eyJ...G2DI' \
--data-raw '[
   {
      "clientId": 12345,
      "attributes": {
         "the-newsletter-agreement-attribute-you-set-up": "disabled"
         }
   }
]'

The agreement is disabled immediately.

😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker