The official Loops PHP package.
RateLimitExceededError
exception.
getLimit
and getRemaining
functions.
id
email
firstName
lastName
source
subscribed
userGroup
userId
Name | Type | Required | Notes |
---|---|---|---|
$email | string | Yes | If a contact already exists with this email address, an APIError will be thrown. |
$properties | array | No | An array containing default and any custom properties for your contact. Please add custom properties in your Loops account before using them with the SDK. Values can be of type string , number , null (to reset a value), boolean or date (see allowed date formats). |
$mailing_lists | array | No | An array of mailing list IDs and boolean subscription statuses. |
APIError
class, which provides getStatusCode()
and getJson()
methods for retrieving the API’s error response details. For implementation examples, see the Usage section.
userId
value. Then you can make a request with their userId
and an updated email address.
API Reference
Name | Type | Required | Notes |
---|---|---|---|
$email | string | Yes | The email address of the contact to update. If there is no contact with this email address, a new contact will be created using the email and properties in this request. |
$properties | array | No | An array containing default and any custom properties for your contact. Please add custom properties in your Loops account before using them with the SDK. Values can be of type string , number , null (to reset a value), boolean or date (see allowed date formats). |
$mailing_lists | array | No | An array of mailing list IDs and boolean subscription statuses. |
APIError
class, which provides getStatusCode()
and getJson()
methods for retrieving the API’s error response details. For implementation examples, see the Usage section.
Name | Type | Required | Notes |
---|---|---|---|
$email | string | No | |
$user_id | string | No |
Name | Type | Required | Notes |
---|---|---|---|
$email | string | No | |
$user_id | string | No |
APIError
class, which provides getStatusCode()
and getJson()
methods for retrieving the API’s error response details. For implementation examples, see the Usage section.
Name | Type | Required | Notes |
---|---|---|---|
$name | string | Yes | The name of the property. Should be in camelCase, like planName or favouriteColor . |
$type | string | Yes | The property’s value type. Can be one of string , number , boolean or date . |
APIError
class, which provides getStatusCode()
and getJson()
methods for retrieving the API’s error response details. For implementation examples, see the Usage section.
Name | Type | Required | Notes |
---|---|---|---|
$list | string | No | Use “custom” to retrieve only your account’s custom properties. |
key
, label
and type
attributes.
id
, name
, description
and isPublic
attributes.
If your account has no mailing lists, an empty list will be returned.
Name | Type | Required | Notes |
---|---|---|---|
$event_name | string | Yes | |
$email | string | No | The contact’s email address. Required if $user_id is not present. |
$user_id | string | No | The contact’s unique user ID. If you use $user_id without $email , this value must have already been added to your contact in Loops. Required if $email is not present. |
$contact_properties | array | No | An array containing contact properties, which will be updated or added to the contact when the event is received. Please add custom properties in your Loops account before using them with the SDK. Values can be of type string , number , null (to reset a value), boolean or date (see allowed date formats). |
$event_properties | array | No | An array containing event properties, which will be made available in emails that are triggered by this event. Values can be of type string , number , boolean or date (see allowed date formats). |
$mailing_lists | array | No | An array of mailing list IDs and boolean subscription statuses. |
$headers | array | No | Additional headers to send with the request. |
APIError
class, which provides getStatusCode()
and getJson()
methods for retrieving the API’s error response details. For implementation examples, see the Usage section.
Name | Type | Required | Notes |
---|---|---|---|
$transactional_id | string | Yes | The ID of the transactional email to send. |
$email | string | Yes | The email address of the recipient. |
$add_to_audience | boolean | No | If true , a contact will be created in your audience using the $email value (if a matching contact doesn’t already exist). |
$data_variables | array | No | An array containing data as defined by the data variables added to the transactional email template. Values can be of type string or number . |
$attachments | array[] | No | A list of attachments objects. Please note: Attachments need to be enabled on your account before using them with the API. Read more |
$attachments[]["filename"] | string | No | The name of the file, shown in email clients. |
$attachments[]["content_type"] | string | No | The MIME type of the file. |
$attachments[]["data"] | string | No | The base64-encoded content of the file. |
$headers | array | No | Additional headers to send with the request. |
APIError
class, which provides getStatusCode()
and getJson()
methods for retrieving the API’s error response details. For implementation examples, see the Usage section.
If there is a problem with the request, a descriptive error message will be returned:
Name | Type | Required | Notes |
---|---|---|---|
$per_page | integer | No | How many results to return per page. Must be between 10 and 50. Defaults to 20 if omitted. |
$cursor | string | No | A cursor, to return a specific page of results. Cursors can be found from the pagination.nextCursor value in each response. |
v1.0.1
(May 22, 2025) - Added a headers
argument in events-send()
and transactional->send()
, enabling support for the Idempotency-Key header.v1.0.0
(May 6, 2025)
v0.1.0
(Feb 27, 2025) - Initial release.