You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method will return a success or error message:
110
-
111
122
```json
112
123
{
113
124
"success": true,
114
125
"teamName": "My team"
115
126
}
116
127
```
117
128
129
+
Error handling is done through the `APIError` class, which provides `statusCode` and `json` properties containing the API's error response details. For implementation examples, see the [Usage section](#usage).
This method will return a success or error message:
163
-
164
176
```json
165
177
{
166
178
"success": true,
167
179
"id": "id_of_contact"
168
180
}
169
181
```
170
182
183
+
Error handling is done through the `APIError` class, which provides `statusCode` and `json` properties containing the API's error response details. For implementation examples, see the [Usage section](#usage).
This method will return a success or error message:
214
-
215
228
```json
216
229
{
217
230
"success": true,
218
231
"id": "id_of_contact"
219
232
}
220
233
```
221
234
235
+
Error handling is done through the `APIError` class, which provides `statusCode` and `json` properties containing the API's error response details. For implementation examples, see the [Usage section](#usage).
This method will return a success or error message:
307
-
308
322
```json
309
323
{
310
324
"success": true,
311
325
"message": "Contact deleted."
312
326
}
313
327
```
314
328
329
+
Error handling is done through the `APIError` class, which provides `statusCode` and `json` properties containing the API's error response details. For implementation examples, see the [Usage section](#usage).
330
+
315
331
```json
332
+
HTTP 400 Bad Request
333
+
{
334
+
"success": false,
335
+
"message": "An error message here."
336
+
}
337
+
```
338
+
339
+
```json
340
+
HTTP 404 Not Found
316
341
{
317
342
"success": false,
318
343
"message": "An error message here."
@@ -321,6 +346,133 @@ This method will return a success or error message:
Error handling is done through the `APIError` class, which provides `statusCode` and `json` properties containing the API's error response details. For implementation examples, see the [Usage section](#usage).
|`email`| string | No | The contact's email address. Required if `userId` is not present. |
376
-
|`userId`| string | No | The contact's unique user ID. If you use `userID` without `email`, this value must have already been added to your contact in Loops. Required if `email` is not present. |
528
+
|`userId`| string | No | The contact's unique user ID. If you use `userId` without `email`, this value must have already been added to your contact in Loops. Required if `email` is not present. |
377
529
|`eventName`| string | Yes ||
378
530
|`contactProperties`| object | No | An object containing contact properties, which will be updated or added to the contact when the event is received.<br />Please [add custom properties](https://loops.so/docs/contacts/properties#custom-contact-properties) in your Loops account before using them with the SDK.<br />Values can be of type `string`, `number`, `null` (to reset a value), `boolean` or `date` ([see allowed date formats](https://loops.so/docs/contacts/properties#dates)). |
379
-
|`eventProperties`| object | No | An object containing event properties, which will be made availabe in emails that are triggered by this event.<br />Values can be of type `string`, `number`, `boolean` or `date` ([see allowed date formats](https://loops.so/docs/events/properties#important-information-about-event-properties)).|
531
+
|`eventProperties`| object | No | An object containing event properties, which will be made available in emails that are triggered by this event.<br />Values can be of type `string`, `number`, `boolean` or `date` ([see allowed date formats](https://loops.so/docs/events/properties#important-information-about-event-properties)). |
380
532
|`mailingLists`| object | No | An object of mailing list IDs and boolean subscription statuses. |
Error handling is done through the `APIError` class, which provides `statusCode` and `json` properties containing the API's error response details. For implementation examples, see the [Usage section](#usage).
This method will return a success or error message.
488
-
489
640
```json
490
641
{
491
642
"success": true
492
643
}
493
644
```
494
645
495
-
If there is a problem with the request, a descriptive error message will be returned:
646
+
Error handling is done through the `APIError` class, which provides `statusCode` and `json` properties containing the API's error response details. For implementation examples, see the [Usage section](#usage).
496
647
497
648
```json
649
+
HTTP 400 Bad Request
498
650
{
499
651
"success": false,
500
652
"path": "dataVariables",
@@ -503,6 +655,7 @@ If there is a problem with the request, a descriptive error message will be retu
503
655
```
504
656
505
657
```json
658
+
HTTP 400 Bad Request
506
659
{
507
660
"success": false,
508
661
"error": {
@@ -515,47 +668,12 @@ If there is a problem with the request, a descriptive error message will be retu
515
668
516
669
---
517
670
518
-
### getCustomFields()
519
-
520
-
Get a list of your account's custom fields. These are custom properties that can be added to contacts to store extra data. [Read more about contact properties](https://loops.so/docs/contacts/properties)
This method will return a list of custom field objects containing `key`, `label` and `type` attributes.
537
-
538
-
If your account has no custom fields, an empty list will be returned.
539
-
540
-
```json
541
-
[
542
-
{
543
-
"key": "favoriteColor",
544
-
"label": "Favorite Color",
545
-
"type": "string"
546
-
},
547
-
{
548
-
"key": "plan",
549
-
"label": "Plan",
550
-
"type": "string"
551
-
}
552
-
]
553
-
```
554
-
555
-
---
556
-
557
671
## Version history
558
672
673
+
-`v4.0.0` (Jan 16, 2024)
674
+
- Added `APIError` to more easily understand API errors. [See usage example](#usage).
675
+
- Added support for two new contact property endpoints: [List contact properties](#listcontactproperties) and [Create contact property](#createcontactproperty).
676
+
- Deprecated and removed the `getCustomFields()` method (you can now use [`listContactProperties()`](#listcontactproperties) instead).
559
677
-`v3.4.1` (Dec 18, 2024) - Support for a new `description` attribute in [`getMailingLists()`](#getmailinglists).
0 commit comments