Skip to content

Releases: ConvertKit/convertkit-wordpress-libraries

2.0.4

01 Oct 02:27
345b74c
Compare
Choose a tag to compare
  • Added: Use kit.com domain
  • Fix: Landing Pages: Remove prepended Cloudflare string from JS script type (#82)

2.0.3

26 Sep 02:22
5b107d1
Compare
Choose a tag to compare

Fix: Check response in get_error_message_string is an array
Fix: Landing Pages: Improved detection of <html> tag to avoid incorrect parsing, resulting in redirects failing

2.0.2

12 Sep 04:30
389a483
Compare
Choose a tag to compare
  • Fix: Remove rocket-loader.min.js from Landing Pages (#77)
  • Fix: Check WordPress environment when automatically refreshing token (#79)

2.0.1

16 Jul 04:37
7736b19
Compare
Choose a tag to compare
  • Fix: Conditionally append parameters to GET requests (#74)

2.0.0

28 Jun 08:38
2af8891
Compare
Choose a tag to compare

Version 2.0 of the SDK uses ConvertKit's v4 API, which replaces API Keys with OAuth, and introduces a number of new methods.

As such, this introduces a number of breaking changes.

Class Names

To permit compatibility with WordPress Plugins that may use the v3 API Libraries (1.4.2 or lower), class names are appended with _V4:

  • ConvertKit_API_V4
  • ConvertKit_Resource_V4

Authentication

Authentication is now via OAuth using PKCE.

Initializing the ConvertKit_API_V4 class now accepts a client_id, redirect_uri, access_token and refresh_token in place of the existing api_key and api_secret:

$api = new ConvertKit_API_V4( 'client_id', 'redirect_uri', 'access_token', 'refresh_token' );

The redirect URI must be one listed in the OAuth application.

To obtain an OAuth URL to begin the OAuth flow, the access_token and refresh_token constructor parameters are not required:

$api = new ConvertKit_API_V4( 'client_id', 'redirect_uri' );
$url = $api->get_oauth_url();

Once complete, the user is returned to the redirect_uri with a code, which can be used to obtain access and refresh tokens:

$result = $api->get_access_token( 'authorization_code' );

Remember to re-initialize the API class with your access and refresh tokens after receiving them.

Refreshing tokens will be attempted automatically by the libraries, if a request is made with an expired access token and a valid refresh token. Your plugin can hook to the convertkit_api_refresh_token WordPress action to listen for changes when this occurs, updating the stored access and refresh tokens in your Plugin accordingly.

Refreshing a token can be performed manually:

$result = $api->refresh_token();

Traits

This library inherits the PHP SDK v4 API Traits. Refer to the PHP SDK documentation.

Library-specific methods

To maintain backward compatibility with our WordPress Plugins and the v3 API (1.4.2 and earlier of the WordPress Libraries), a number of methods exist in the ConvertKit_API_V4 class, such as form_subscribe and tag_subscribe.

These may be deprecated in future updates in favour of direct calls to the methods in the traits file.

Pagination

For list based endpoints which fetch data from the API (such as broadcasts, custom fields, subscribers, tags, email templates, forms, purchases etc.), cursor based pagination is used. The following parameters can be specified in the API methods:

  • per_page: Defines the number of results to return, with a maximum value of 100
  • after_cursor: When specified, returns the next page of results based on the current result's pagination->end_cursor value
  • before_cursor: When specified, returns the previous page of results based on the current result's pagination->start_cursor value

Accounts

  • Added: get_account_colors()
  • Added: update_account_colors()
  • Added: get_creator_profile()
  • Added: get_email_stats()
  • Added: get_growth_stats()

Broadcasts

  • Updated: get_broadcasts() supports pagination
  • Updated: create_broadcast():
    • email_layout_template is now email_template_id. To fetch the ID of the account's email templates, refer to get_email_templates()
    • preview_text option added
    • subscriber_filter option added
  • Updated: update_broadcast()
    • email_layout_template is now email_template_id. To fetch the ID of the account's email templates, refer to get_email_templates()
    • preview_text option added
    • subscriber_filter option added
  • Changed: destroy_broadcast() is renamed to delete_broadcast()

Custom Fields

  • Added: create_custom_fields() to create multiple custom fields in a single request
  • Updated: get_custom_fields() supports pagination

Subscribers

  • Added: create_subscriber(). The concept of creating a subscriber via a form, tag or sequence is replaced with this new method. The subscriber can then be subscribed to resources (forms, tag, sequences) as necessary.
  • Added: create_subscribers() to create multiple subscribers in a single request
  • Added: get_subscribers()
  • Changed: unsubscribe() is now unsubscribe_by_email(). Use unsubscribe() for unsubscribing by a subscriber ID
  • Updated: get_subscriber_tags() supports pagination

Tags

  • Added: create_tags() to create multiple tags in a single request
  • Updated: get_tags() supports pagination
  • Updated: get_tag_subscriptions():
    • supports pagination
    • supports filtering by subscribers by dates, covering created_after, created_before, tagged_after and tagged_before
    • sort_order is no longer supported
  • Changed: tag_subscriber() is now tag_subscriber_by_email(). Use tag_subscriber() for tagging by subscriber ID

Email Templates

  • Added: get_email_templates()

Forms

  • Updated: get_forms():
    • supports pagination
    • only returns active forms by default. Use the status parameter to filter by active, archived, trashed or all
  • Updated: get_landing_pages():
    • supports pagination
    • only returns active landing pages by default. Use the status parameter to filter by active, archived, trashed or all
  • Updated: get_form_subscriptions():
    • supports pagination
    • supports filtering by subscribers by dates, covering created_after, created_before, added_after and added_before
    • sort_order is no longer supported
  • Changed: add_subscriber_to_form() is now add_subscriber_to_form_by_email(). Use add_subscriber_to_form() for adding subscriber to form by subscriber ID

Purchases

  • Updated: create_purchase() now supports named parameters for purchase data, instead of an $options array
  • Changed: list_purchases() is now get_purchases(), with pagination support

Segments

  • Added: get_segments()

Sequences

  • Changed: add_subscriber_to_sequence() is now add_subscriber_to_sequence_by_email(). Use add_subscriber_to_sequence() for adding a subscriber to a sequence by subscriber ID
  • Updated: get_sequences() supports pagination
  • Updated: get_sequence_subscriptions():
    • supports pagination
    • supports filtering by subscribers by dates, covering created_after, created_before, added_after and added_before
    • sort_order is no longer supported

Webhooks

  • Added: get_webhooks()
  • Changed: destroy_webhook() is now delete_webhook()

Other

  • Removed: form_subscribe() was previously deprecated. Use add_subscriber_to_form() or add_subscriber_to_form_by_email()
  • Removed: add_tag() was previously deprecated. Use tag_subscriber() or tag_subscriber_by_email()

1.4.2

08 Mar 14:30
3d343a5
Compare
Choose a tag to compare
  • Fix: Change log file location to log subfolder, with .htaccess and index.html files
  • Fix: Mask email addresses in log file
  • Fix: Mask first names and signed subscriber IDs in log file

1.4.1

12 Jan 15:10
e475025
Compare
Choose a tag to compare
  • Fix: Landing Pages: Remove jQuery dependency (#32)
  • Fix: Landing Pages: Include nonce in convertkit JS object to fix 403 AJAX errors (#33)

1.4.0

19 Oct 12:58
6ed59f3
Compare
Choose a tag to compare
  • Added: tag_unsubscribe method [#30]

1.3.9

03 Oct 17:13
c10dfad
Compare
Choose a tag to compare
  • Added: create_broadcast and delete_broadcast methods [#28]

1.3.8

29 Aug 15:31
c172b22
Compare
Choose a tag to compare
  • Added: get_post() method
  • Updated: WordPress Coding Standards meet v3 standards