unisender-ruby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +25 -0
- data/CONTRIBUTING.md +43 -0
- data/LICENSE.txt +21 -0
- data/README.md +140 -0
- data/docs/api.md +1063 -0
- data/examples/campaign.rb +13 -0
- data/examples/check_connection.rb +16 -0
- data/examples/events.rb +20 -0
- data/examples/export.rb +11 -0
- data/examples/import.rb +18 -0
- data/examples/offline.rb +26 -0
- data/examples/quickstart.rb +6 -0
- data/examples/subscribe.rb +12 -0
- data/lib/unisender/batches.rb +31 -0
- data/lib/unisender/client.rb +59 -0
- data/lib/unisender/errors.rb +129 -0
- data/lib/unisender/event_payload.rb +63 -0
- data/lib/unisender/events.rb +19 -0
- data/lib/unisender/form.rb +67 -0
- data/lib/unisender/helpers.rb +28 -0
- data/lib/unisender/operations/contacts_1.rb +51 -0
- data/lib/unisender/operations/contacts_2.rb +44 -0
- data/lib/unisender/operations/inputs_1.rb +48 -0
- data/lib/unisender/operations/messages_1.rb +58 -0
- data/lib/unisender/operations/messages_2.rb +54 -0
- data/lib/unisender/operations/messages_3.rb +12 -0
- data/lib/unisender/operations/notes_1.rb +38 -0
- data/lib/unisender/operations/statistics_1.rb +48 -0
- data/lib/unisender/operations/statistics_2.rb +18 -0
- data/lib/unisender/operations/templates_1.rb +45 -0
- data/lib/unisender/paginated_operations.rb +42 -0
- data/lib/unisender/pagination.rb +68 -0
- data/lib/unisender/protocol.rb +46 -0
- data/lib/unisender/response.rb +64 -0
- data/lib/unisender/retry_policy.rb +82 -0
- data/lib/unisender/task_waiter.rb +52 -0
- data/lib/unisender/transport.rb +53 -0
- data/lib/unisender/validation.rb +72 -0
- data/lib/unisender/version.rb +5 -0
- data/lib/unisender.rb +29 -0
- data/sig/operations.rbs +78 -0
- data/sig/unisender.rbs +218 -0
- metadata +87 -0
data/docs/api.md
ADDED
|
@@ -0,0 +1,1063 @@
|
|
|
1
|
+
# API reference
|
|
2
|
+
|
|
3
|
+
Contract audit: 2026-10-25. The [official UniSender documentation](https://www.unisender.com/ru/support/category/api/) is the source of truth. Tests use deterministic, artificial responses and do not establish live account compatibility.
|
|
4
|
+
|
|
5
|
+
All methods return `Unisender::Response`; named operations declare their result type as `Response[Result]`. Required arguments are Ruby keywords. Optional keywords default to omission, preserving the service's defaults. RBS signatures ship with the gem. Identifiers accept integers or strings; flags accept booleans or 0/1. Dates remain strings in the format and time zone documented for each method.
|
|
6
|
+
|
|
7
|
+
Arrays supplied to comma-separated fields are joined only by named methods. For other array or hash arguments, the form encoder emits explicit bracket indices. `request(method, params: {})` accepts the exact wire method and parameters; it does not perform method-specific conversions or validation.
|
|
8
|
+
|
|
9
|
+
## Implemented operations
|
|
10
|
+
|
|
11
|
+
The offline contract cases are in `test/fixtures/operations.json` and run through `test/operations_test.rb` in the source checkout. Every entry verifies the path, authentication body, required arguments, a successful result, and API failure propagation.
|
|
12
|
+
|
|
13
|
+
| Ruby method | Wire method and documentation | Required keywords | Optional keywords |
|
|
14
|
+
| --- | --- | --- | --- |
|
|
15
|
+
| [`create_list`](#create_list) | [`createList`](https://www.unisender.com/ru/support/api/contacts/createlist/) | `title` | `before_subscribe_url`, `after_subscribe_url`, `sub_user_rights` |
|
|
16
|
+
| [`delete_list`](#delete_list) | [`deleteList`](https://www.unisender.com/ru/support/api/contacts/deletelist/) | `list_id` | None |
|
|
17
|
+
| [`exclude`](#exclude) | [`exclude`](https://www.unisender.com/ru/support/api/contacts/exclude/) | `contact_type`, `contact` | `list_ids` |
|
|
18
|
+
| [`export_contacts`](#export_contacts) | [`async/exportContacts`](https://www.unisender.com/ru/support/api/contacts/exportcontacts/) | None | `notify_url`, `list_id`, `field_names`, `email`, `phone`, `tag`, `email_status`, `phone_status`, `contact_status` |
|
|
19
|
+
| [`get_contact_count`](#get_contact_count) | [`getContactCount`](https://www.unisender.com/ru/support/api/contacts/getcontactcount/) | `list_id`, `params` | None |
|
|
20
|
+
| [`get_lists`](#get_lists) | [`getLists`](https://www.unisender.com/ru/support/api/contacts/getlists/) | None | None |
|
|
21
|
+
| [`get_total_contacts_count`](#get_total_contacts_count) | [`getTotalContactsCount`](https://www.unisender.com/ru/support/api/contacts/gettotalcontactscount/) | `login` | None |
|
|
22
|
+
| [`import_contacts`](#import_contacts) | [`importContacts`](https://www.unisender.com/ru/support/api/contacts/importcontacts/) | `field_names`, `data` | `overwrite_tags`, `overwrite_lists`, `telegram_bot_channel_id` |
|
|
23
|
+
| [`subscribe`](#subscribe) | [`subscribe`](https://www.unisender.com/ru/support/api/contacts/subscribe/) | `list_ids`, `fields` | `tags`, `double_optin`, `overwrite` |
|
|
24
|
+
| [`update_list`](#update_list) | [`updateList`](https://www.unisender.com/ru/support/api/contacts/updatelist/) | `list_id`, `title` | `before_subscribe_url`, `after_subscribe_url`, `sub_user_rights` |
|
|
25
|
+
| [`is_contact_in_lists`](#is_contact_in_lists) | [`isContactInLists`](https://www.unisender.com/ru/support/api/contacts/iscontactinlists/) | `email`, `list_ids`, `condition` | None |
|
|
26
|
+
| [`get_contact`](#get_contact) | [`getContact`](https://www.unisender.com/ru/support/api/contacts/getcontact/) | `email` | `include_lists`, `include_fields`, `include_details` |
|
|
27
|
+
| [`unsubscribe`](#unsubscribe) | [`unsubscribe`](https://www.unisender.com/ru/support/api/contacts/unsubscribe/) | `contact_type`, `contact` | `list_ids` |
|
|
28
|
+
| [`cancel_campaign`](#cancel_campaign) | [`cancelCampaign`](https://www.unisender.com/ru/support/api/messages/cancel-campaign/) | `campaign_id` | None |
|
|
29
|
+
| [`check_email`](#check_email) | [`checkEmail`](https://www.unisender.com/ru/support/api/messages/check-email/) | `email_id` | None |
|
|
30
|
+
| [`check_sms`](#check_sms) | [`checkSms`](https://www.unisender.com/ru/support/api/messages/check-sms/) | `sms_id` | None |
|
|
31
|
+
| [`create_campaign`](#create_campaign) | [`createCampaign`](https://www.unisender.com/ru/support/api/messages/createcampaign/) | `message_id` | `start_time`, `timezone`, `track_read`, `track_links`, `contacts`, `contacts_url`, `track_ga`, `payment_limit`, `payment_currency`, `ga_medium`, `ga_source`, `ga_campaign`, `ga_content`, `ga_term` |
|
|
32
|
+
| [`create_email_message`](#create_email_message) | [`createEmailMessage`](https://www.unisender.com/ru/support/api/messages/createemailmessage/) | `sender_name`, `sender_email`, `list_id` | `subject`, `body`, `text_body`, `generate_text`, `tag`, `attachments`, `lang`, `template_id`, `system_template_id`, `wrap_type`, `categories` |
|
|
33
|
+
| [`create_sms_message`](#create_sms_message) | [`createSmsMessage`](https://www.unisender.com/ru/support/api/messages/createsmsmessage/) | `sender`, `body`, `list_id` | `tag` |
|
|
34
|
+
| [`delete_message`](#delete_message) | [`deleteMessage`](https://www.unisender.com/ru/support/api/messages/deletemessage/) | `message_id` | None |
|
|
35
|
+
| [`get_actual_message_version`](#get_actual_message_version) | [`getActualMessageVersion`](https://www.unisender.com/ru/support/api/messages/get-actual-message-version/) | `message_id` | None |
|
|
36
|
+
| [`get_web_version`](#get_web_version) | [`getWebVersion`](https://www.unisender.com/ru/support/api/messages/getwebversion/) | `campaign_id` | None |
|
|
37
|
+
| [`send_email`](#send_email) | [`sendEmail`](https://www.unisender.com/ru/support/api/messages/sendemail/) | `email`, `sender_name`, `sender_email`, `subject`, `body`, `list_id` | `attachments`, `lang`, `track_read`, `track_links`, `cc`, `headers`, `images_as`, `ref_key`, `error_checking`, `metadata` |
|
|
38
|
+
| [`send_sms`](#send_sms) | [`sendSms`](https://www.unisender.com/ru/support/api/messages/sendsms/) | `phone`, `sender`, `text` | None |
|
|
39
|
+
| [`send_test_email`](#send_test_email) | [`sendTestEmail`](https://www.unisender.com/ru/support/api/messages/sendtestemail/) | `email`, `id` | None |
|
|
40
|
+
| [`update_email_message`](#update_email_message) | [`updateEmailMessage`](https://www.unisender.com/ru/support/api/messages/updateemailmessage/) | `id` | `sender_name`, `sender_email`, `subject`, `body`, `list_id`, `text_body`, `lang`, `categories` |
|
|
41
|
+
| [`update_opt_in_email`](#update_opt_in_email) | [`updateOptInEmail`](https://www.unisender.com/ru/support/api/messages/updateoptinemail/) | `sender_name`, `sender_email`, `subject`, `body`, `list_id` | None |
|
|
42
|
+
| [`get_sender_domain_list`](#get_sender_domain_list) | [`getSenderDomainList`](https://www.unisender.com/ru/support/api/messages/getsenderdomainlist/) | `username` | `domain`, `limit`, `offset` |
|
|
43
|
+
| [`get_campaign_common_stats`](#get_campaign_common_stats) | [`getCampaignCommonStats`](https://www.unisender.com/ru/support/api/statistics/get-campaign-common-stats/) | `campaign_id` | None |
|
|
44
|
+
| [`get_campaign_delivery_stats`](#get_campaign_delivery_stats) | [`async/getCampaignDeliveryStats`](https://www.unisender.com/ru/support/api/statistics/getcampaigndeliverystats/) | `campaign_id` | `notify_url`, `changed_since`, `field_ids` |
|
|
45
|
+
| [`get_campaign_status`](#get_campaign_status) | [`getCampaignStatus`](https://www.unisender.com/ru/support/api/statistics/getcampaignstatus/) | `campaign_id` | None |
|
|
46
|
+
| [`get_messages`](#get_messages) | [`getMessages`](https://www.unisender.com/ru/support/api/statistics/getmessages/) | `date_from`, `date_to` | `limit`, `offset` |
|
|
47
|
+
| [`get_visited_links`](#get_visited_links) | [`getVisitedLinks`](https://www.unisender.com/ru/support/api/statistics/getvisitedlinks/) | `campaign_id` | `group` |
|
|
48
|
+
| [`list_messages`](#list_messages) | [`listMessages`](https://www.unisender.com/ru/support/api/statistics/listmessages/) | `date_from`, `date_to` | `limit`, `offset` |
|
|
49
|
+
| [`get_campaigns`](#get_campaigns) | [`getCampaigns`](https://www.unisender.com/ru/support/api/statistics/getcampaigns/) | `from` | `to`, `limit`, `offset` |
|
|
50
|
+
| [`get_message`](#get_message) | [`getMessage`](https://www.unisender.com/ru/support/api/statistics/getmessage/) | `id` | None |
|
|
51
|
+
| [`get_task_result`](#get_task_result) | [`async/getTaskResult`](https://www.unisender.com/ru/support/api/statistics/../contacts/exportcontacts/) | `task_uuid` | None |
|
|
52
|
+
| [`create_email_template`](#create_email_template) | [`createEmailTemplate`](https://www.unisender.com/ru/support/api/templates/createemailtemplate/) | `title`, `subject`, `body` | `description`, `text_body`, `lang` |
|
|
53
|
+
| [`delete_template`](#delete_template) | [`deleteTemplate`](https://www.unisender.com/ru/support/api/templates/deletetemplate/) | `template_id` | None |
|
|
54
|
+
| [`get_template`](#get_template) | [`getTemplate`](https://www.unisender.com/ru/support/api/templates/gettemplate/) | None | `template_id`, `system_template_id` |
|
|
55
|
+
| [`get_templates`](#get_templates) | [`getTemplates`](https://www.unisender.com/ru/support/api/templates/gettemplates/) | None | `type`, `date_from`, `date_to`, `limit`, `offset` |
|
|
56
|
+
| [`list_templates`](#list_templates) | [`listTemplates`](https://www.unisender.com/ru/support/api/templates/listtemplates/) | None | `type`, `date_from`, `date_to`, `limit`, `offset` |
|
|
57
|
+
| [`update_email_template`](#update_email_template) | [`updateEmailTemplate`](https://www.unisender.com/ru/support/api/templates/updateemailtemplate/) | `template_id` | `title`, `description`, `subject`, `body`, `text_body`, `lang` |
|
|
58
|
+
| [`create_field`](#create_field) | [`createField`](https://www.unisender.com/ru/support/api/inputs/createfield/) | `name`, `type` | `public_name` |
|
|
59
|
+
| [`delete_field`](#delete_field) | [`deleteField`](https://www.unisender.com/ru/support/api/inputs/deletefield/) | `id` | None |
|
|
60
|
+
| [`delete_tag`](#delete_tag) | [`deleteTag`](https://www.unisender.com/ru/support/api/inputs/deletetag/) | `id` | None |
|
|
61
|
+
| [`get_fields`](#get_fields) | [`getFields`](https://www.unisender.com/ru/support/api/inputs/getfields/) | None | None |
|
|
62
|
+
| [`get_tags`](#get_tags) | [`getTags`](https://www.unisender.com/ru/support/api/inputs/gettags/) | None | None |
|
|
63
|
+
| [`update_field`](#update_field) | [`updateField`](https://www.unisender.com/ru/support/api/inputs/updatefield/) | `id`, `name` | `public_name` |
|
|
64
|
+
| [`get_contact_field_values`](#get_contact_field_values) | [`getContactFieldValues`](https://www.unisender.com/ru/support/api/inputs/getcontactfieldvalues/) | `email`, `field_ids` | None |
|
|
65
|
+
| [`create_subscriber_note`](#create_subscriber_note) | [`createSubscriberNote`](https://www.unisender.com/ru/support/api/notes/createsubscibernote/) | `subscriber_id`, `content` | None |
|
|
66
|
+
| [`update_subscriber_note`](#update_subscriber_note) | [`updateSubscriberNote`](https://www.unisender.com/ru/support/api/notes/updatesubcribernote/) | `id`, `content` | None |
|
|
67
|
+
| [`delete_subscriber_note`](#delete_subscriber_note) | [`deleteSubscriberNote`](https://www.unisender.com/ru/support/api/notes/deletesubscribernote/) | `id` | None |
|
|
68
|
+
| [`get_subscriber_note`](#get_subscriber_note) | [`getSubscriberNote`](https://www.unisender.com/ru/support/api/notes/getsubscribernote/) | `id` | None |
|
|
69
|
+
| [`get_subscriber_notes`](#get_subscriber_notes) | [`getSubscriberNotes`](https://www.unisender.com/ru/support/api/notes/getsubscribernotes/) | `subscriber_id` | `limit`, `offset`, `order_type`, `order_by`, `is_pinned` |
|
|
70
|
+
| `track_events` | [Event Tracking](https://www.unisender.com/ru/support/api/event-tracking-api/) | `events` | None |
|
|
71
|
+
|
|
72
|
+
## Reading the contracts
|
|
73
|
+
|
|
74
|
+
Expand an operation below for its accepted Ruby types and result shape. `id` means String or Integer; `flag` means `true`, `false`, `0`, or `1`; `params` means a Hash with String/Symbol keys and form-compatible values. `json` is a JSON value; `object` is a string-keyed Hash and `objects` is an Array of those Hashes. Optional keywords default to `nil` and are omitted on the wire, not sent as null.
|
|
75
|
+
|
|
76
|
+
Named methods accept Arrays for the documented comma-separated fields and join them before encoding. Other nested arrays and hashes retain bracket indices. An empty String/Array/Hash is rejected for a required value. Method-specific constraints beyond the structural checks are validated by the service; refer to the linked official page for account permissions, current limits, and additional response fields.
|
|
77
|
+
|
|
78
|
+
All result descriptions refer to `response.result`, not the enclosing response. Unknown fields remain in `response.data`, even when a result type lists only its guaranteed fields. API errors raise `APIError`, HTTP errors raise `HTTPError`, malformed successful responses raise `InvalidResponseError`, and connection failures raise `TransportError`; none should be interpreted as an empty success. Import and send operations can also return per-record failures inside a successful result.
|
|
79
|
+
|
|
80
|
+
## Operation contracts
|
|
81
|
+
|
|
82
|
+
<a id="create_list"></a>
|
|
83
|
+
<details>
|
|
84
|
+
<summary><code>create_list</code></summary>
|
|
85
|
+
|
|
86
|
+
[Official `createList` contract](https://www.unisender.com/ru/support/api/contacts/createlist/).
|
|
87
|
+
|
|
88
|
+
| Keyword | Ruby type | Presence |
|
|
89
|
+
| --- | --- | --- |
|
|
90
|
+
| `title` | `String` | Required |
|
|
91
|
+
| `before_subscribe_url` | `String` | Optional, omitted |
|
|
92
|
+
| `after_subscribe_url` | `String` | Optional, omitted |
|
|
93
|
+
| `sub_user_rights` | `params` | Optional, omitted |
|
|
94
|
+
|
|
95
|
+
**Result:** Object with `id`, the new list identifier.
|
|
96
|
+
|
|
97
|
+
The title must be unique within the account. `sub_user_rights` maps user IDs to rights: `access` uses `view_stats`, `view`, `manage`, or `none`; `send_email` and `send_sms` use flags. A maximum of ten additional users can be configured per call.
|
|
98
|
+
|
|
99
|
+
</details>
|
|
100
|
+
|
|
101
|
+
<a id="delete_list"></a>
|
|
102
|
+
<details>
|
|
103
|
+
<summary><code>delete_list</code></summary>
|
|
104
|
+
|
|
105
|
+
[Official `deleteList` contract](https://www.unisender.com/ru/support/api/contacts/deletelist/).
|
|
106
|
+
|
|
107
|
+
| Keyword | Ruby type | Presence |
|
|
108
|
+
| --- | --- | --- |
|
|
109
|
+
| `list_id` | `id` | Required |
|
|
110
|
+
|
|
111
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization. Deletes the list; review the upstream consequences before use.
|
|
112
|
+
|
|
113
|
+
</details>
|
|
114
|
+
|
|
115
|
+
<a id="exclude"></a>
|
|
116
|
+
<details>
|
|
117
|
+
<summary><code>exclude</code></summary>
|
|
118
|
+
|
|
119
|
+
[Official `exclude` contract](https://www.unisender.com/ru/support/api/contacts/exclude/).
|
|
120
|
+
|
|
121
|
+
| Keyword | Ruby type | Presence |
|
|
122
|
+
| --- | --- | --- |
|
|
123
|
+
| `contact_type` | `String` | Required |
|
|
124
|
+
| `contact` | `String` | Required |
|
|
125
|
+
| `list_ids` | `String \| Array[id]` | Optional, omitted |
|
|
126
|
+
|
|
127
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization. Removes membership in the selected lists.
|
|
128
|
+
|
|
129
|
+
`contact_type` is `"email"` or `"phone"`. Omitted `list_ids` applies the upstream account-wide behavior; provide explicit IDs when intending to affect selected lists only.
|
|
130
|
+
|
|
131
|
+
</details>
|
|
132
|
+
|
|
133
|
+
<a id="export_contacts"></a>
|
|
134
|
+
<details>
|
|
135
|
+
<summary><code>export_contacts</code></summary>
|
|
136
|
+
|
|
137
|
+
[Official `async/exportContacts` contract](https://www.unisender.com/ru/support/api/contacts/exportcontacts/).
|
|
138
|
+
|
|
139
|
+
| Keyword | Ruby type | Presence |
|
|
140
|
+
| --- | --- | --- |
|
|
141
|
+
| `notify_url` | `String` | Optional, omitted |
|
|
142
|
+
| `list_id` | `id` | Optional, omitted |
|
|
143
|
+
| `field_names` | `Array[String]` | Optional, omitted |
|
|
144
|
+
| `email` | `String` | Optional, omitted |
|
|
145
|
+
| `phone` | `String` | Optional, omitted |
|
|
146
|
+
| `tag` | `String` | Optional, omitted |
|
|
147
|
+
| `email_status` | `String` | Optional, omitted |
|
|
148
|
+
| `phone_status` | `String` | Optional, omitted |
|
|
149
|
+
| `contact_status` | `String` | Optional, omitted |
|
|
150
|
+
|
|
151
|
+
**Result:** Object with `task_uuid` and initial `status`. Poll `get_task_result`, or use `wait_for_task`; a completed job provides `file_to_download`.
|
|
152
|
+
|
|
153
|
+
</details>
|
|
154
|
+
|
|
155
|
+
<a id="get_contact_count"></a>
|
|
156
|
+
<details>
|
|
157
|
+
<summary><code>get_contact_count</code></summary>
|
|
158
|
+
|
|
159
|
+
[Official `getContactCount` contract](https://www.unisender.com/ru/support/api/contacts/getcontactcount/).
|
|
160
|
+
|
|
161
|
+
| Keyword | Ruby type | Presence |
|
|
162
|
+
| --- | --- | --- |
|
|
163
|
+
| `list_id` | `id` | Required |
|
|
164
|
+
| `params` | `params` | Required |
|
|
165
|
+
|
|
166
|
+
**Result:** Object with `listId`, `searchParams`, and `count`. The documented `count` is a String, not an Integer.
|
|
167
|
+
|
|
168
|
+
`params` must contain at least one filter. Use `tagId`, `type` (`"address"` or `"phone"`), and optionally `search`; `search` requires `type`.
|
|
169
|
+
|
|
170
|
+
</details>
|
|
171
|
+
|
|
172
|
+
<a id="get_lists"></a>
|
|
173
|
+
<details>
|
|
174
|
+
<summary><code>get_lists</code></summary>
|
|
175
|
+
|
|
176
|
+
[Official `getLists` contract](https://www.unisender.com/ru/support/api/contacts/getlists/).
|
|
177
|
+
|
|
178
|
+
No operation arguments.
|
|
179
|
+
|
|
180
|
+
**Result:** Array of objects containing `id` and `title`. An account with no lists returns an empty array.
|
|
181
|
+
|
|
182
|
+
</details>
|
|
183
|
+
|
|
184
|
+
<a id="get_total_contacts_count"></a>
|
|
185
|
+
<details>
|
|
186
|
+
<summary><code>get_total_contacts_count</code></summary>
|
|
187
|
+
|
|
188
|
+
[Official `getTotalContactsCount` contract](https://www.unisender.com/ru/support/api/contacts/gettotalcontactscount/).
|
|
189
|
+
|
|
190
|
+
| Keyword | Ruby type | Presence |
|
|
191
|
+
| --- | --- | --- |
|
|
192
|
+
| `login` | `String` | Required |
|
|
193
|
+
|
|
194
|
+
**Result:** Object with Integer `total`.
|
|
195
|
+
|
|
196
|
+
</details>
|
|
197
|
+
|
|
198
|
+
<a id="import_contacts"></a>
|
|
199
|
+
<details>
|
|
200
|
+
<summary><code>import_contacts</code></summary>
|
|
201
|
+
|
|
202
|
+
[Official `importContacts` contract](https://www.unisender.com/ru/support/api/contacts/importcontacts/).
|
|
203
|
+
|
|
204
|
+
| Keyword | Ruby type | Presence |
|
|
205
|
+
| --- | --- | --- |
|
|
206
|
+
| `field_names` | `Array[String]` | Required |
|
|
207
|
+
| `data` | `Array[Array[parameter]]` | Required |
|
|
208
|
+
| `overwrite_tags` | `flag` | Optional, omitted |
|
|
209
|
+
| `overwrite_lists` | `flag` | Optional, omitted |
|
|
210
|
+
| `telegram_bot_channel_id` | `String` | Optional, omitted |
|
|
211
|
+
|
|
212
|
+
**Result:** Object with Integer counters `total`, `inserted`, `updated`, `deleted`, `new_emails`, and `invalid`; `log` contains per-row `index`, `code`, and `message`. A successful response can include rejected rows. Inspect `invalid` and `log`.
|
|
213
|
+
|
|
214
|
+
`field_names` must be unique and include `"email"`. Supply 1 to 500 rows with exactly one cell per column. `overwrite_tags` and `overwrite_lists` default to 0; setting them to 1 replaces existing associations. `email_list_ids` is a comma-separated cell, not an Array. `telegram_bot_channel_id` is required upstream when a row contains `telegram_user_id`.
|
|
215
|
+
|
|
216
|
+
</details>
|
|
217
|
+
|
|
218
|
+
<a id="subscribe"></a>
|
|
219
|
+
<details>
|
|
220
|
+
<summary><code>subscribe</code></summary>
|
|
221
|
+
|
|
222
|
+
[Official `subscribe` contract](https://www.unisender.com/ru/support/api/contacts/subscribe/).
|
|
223
|
+
|
|
224
|
+
| Keyword | Ruby type | Presence |
|
|
225
|
+
| --- | --- | --- |
|
|
226
|
+
| `list_ids` | `String \| Array[id]` | Required |
|
|
227
|
+
| `fields` | `params` | Required |
|
|
228
|
+
| `tags` | `String \| Array[id]` | Optional, omitted |
|
|
229
|
+
| `double_optin` | `Integer` | Optional, omitted |
|
|
230
|
+
| `overwrite` | `Integer` | Optional, omitted |
|
|
231
|
+
|
|
232
|
+
**Result:** Object with `person_id`, the contact identifier. Success does not mean the contact has confirmed subscription.
|
|
233
|
+
|
|
234
|
+
`fields` must include `email`; custom names are case-sensitive. `double_optin` accepts 0 (confirmation email), 3 (prior consent, no confirmation email), or 4 (reuse an already-confirmed contact, otherwise send confirmation). `overwrite` accepts 0 (preserve existing), 1 (replace fields, tags, and list membership), or 2 (update supplied fields). Up to ten tags are allowed.
|
|
235
|
+
|
|
236
|
+
</details>
|
|
237
|
+
|
|
238
|
+
<a id="update_list"></a>
|
|
239
|
+
<details>
|
|
240
|
+
<summary><code>update_list</code></summary>
|
|
241
|
+
|
|
242
|
+
[Official `updateList` contract](https://www.unisender.com/ru/support/api/contacts/updatelist/).
|
|
243
|
+
|
|
244
|
+
| Keyword | Ruby type | Presence |
|
|
245
|
+
| --- | --- | --- |
|
|
246
|
+
| `list_id` | `id` | Required |
|
|
247
|
+
| `title` | `String` | Required |
|
|
248
|
+
| `before_subscribe_url` | `String` | Optional, omitted |
|
|
249
|
+
| `after_subscribe_url` | `String` | Optional, omitted |
|
|
250
|
+
| `sub_user_rights` | `params` | Optional, omitted |
|
|
251
|
+
|
|
252
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization.
|
|
253
|
+
|
|
254
|
+
</details>
|
|
255
|
+
|
|
256
|
+
<a id="is_contact_in_lists"></a>
|
|
257
|
+
<details>
|
|
258
|
+
<summary><code>is_contact_in_lists</code></summary>
|
|
259
|
+
|
|
260
|
+
[Official `isContactInLists` contract](https://www.unisender.com/ru/support/api/contacts/iscontactinlists/).
|
|
261
|
+
|
|
262
|
+
| Keyword | Ruby type | Presence |
|
|
263
|
+
| --- | --- | --- |
|
|
264
|
+
| `email` | `String` | Required |
|
|
265
|
+
| `list_ids` | `String \| Array[id]` | Required |
|
|
266
|
+
| `condition` | `String` | Required |
|
|
267
|
+
|
|
268
|
+
**Result:** Boolean `true` or `false`, according to the requested membership condition.
|
|
269
|
+
|
|
270
|
+
`condition` is `"or"` for any selected list or `"and"` for every selected list.
|
|
271
|
+
|
|
272
|
+
</details>
|
|
273
|
+
|
|
274
|
+
<a id="get_contact"></a>
|
|
275
|
+
<details>
|
|
276
|
+
<summary><code>get_contact</code></summary>
|
|
277
|
+
|
|
278
|
+
[Official `getContact` contract](https://www.unisender.com/ru/support/api/contacts/getcontact/).
|
|
279
|
+
|
|
280
|
+
| Keyword | Ruby type | Presence |
|
|
281
|
+
| --- | --- | --- |
|
|
282
|
+
| `email` | `String` | Required |
|
|
283
|
+
| `include_lists` | `flag` | Optional, omitted |
|
|
284
|
+
| `include_fields` | `flag` | Optional, omitted |
|
|
285
|
+
| `include_details` | `flag` | Optional, omitted |
|
|
286
|
+
|
|
287
|
+
**Result:** Object with nested `email` contact details. `phone`, `lists`, and custom `fields` depend on the contact and include options. Access the address as `result.fetch("email").fetch("email")`, not `result.fetch("email")` alone.
|
|
288
|
+
|
|
289
|
+
</details>
|
|
290
|
+
|
|
291
|
+
<a id="unsubscribe"></a>
|
|
292
|
+
<details>
|
|
293
|
+
<summary><code>unsubscribe</code></summary>
|
|
294
|
+
|
|
295
|
+
[Official `unsubscribe` contract](https://www.unisender.com/ru/support/api/contacts/unsubscribe/).
|
|
296
|
+
|
|
297
|
+
| Keyword | Ruby type | Presence |
|
|
298
|
+
| --- | --- | --- |
|
|
299
|
+
| `contact_type` | `String` | Required |
|
|
300
|
+
| `contact` | `String` | Required |
|
|
301
|
+
| `list_ids` | `String \| Array[id]` | Optional, omitted |
|
|
302
|
+
|
|
303
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization. Unsubscribes the specified contact from the selected lists.
|
|
304
|
+
|
|
305
|
+
`contact_type` is `"email"` or `"phone"`. Omitted `list_ids` applies the upstream account-wide behavior; provide explicit IDs when intending to affect selected lists only.
|
|
306
|
+
|
|
307
|
+
</details>
|
|
308
|
+
|
|
309
|
+
<a id="cancel_campaign"></a>
|
|
310
|
+
<details>
|
|
311
|
+
<summary><code>cancel_campaign</code></summary>
|
|
312
|
+
|
|
313
|
+
[Official `cancelCampaign` contract](https://www.unisender.com/ru/support/api/messages/cancel-campaign/).
|
|
314
|
+
|
|
315
|
+
| Keyword | Ruby type | Presence |
|
|
316
|
+
| --- | --- | --- |
|
|
317
|
+
| `campaign_id` | `id` | Required |
|
|
318
|
+
|
|
319
|
+
**Result:** Empty array on success. Cancels a campaign that has not finished sending.
|
|
320
|
+
|
|
321
|
+
</details>
|
|
322
|
+
|
|
323
|
+
<a id="check_email"></a>
|
|
324
|
+
<details>
|
|
325
|
+
<summary><code>check_email</code></summary>
|
|
326
|
+
|
|
327
|
+
[Official `checkEmail` contract](https://www.unisender.com/ru/support/api/messages/check-email/).
|
|
328
|
+
|
|
329
|
+
| Keyword | Ruby type | Presence |
|
|
330
|
+
| --- | --- | --- |
|
|
331
|
+
| `email_id` | `String \| Array[id]` | Required |
|
|
332
|
+
|
|
333
|
+
**Result:** Array of recipient delivery objects. Each entry can contain `id`, `email`, `status`, and `status_time`. Inspect all recipients.
|
|
334
|
+
|
|
335
|
+
</details>
|
|
336
|
+
|
|
337
|
+
<a id="check_sms"></a>
|
|
338
|
+
<details>
|
|
339
|
+
<summary><code>check_sms</code></summary>
|
|
340
|
+
|
|
341
|
+
[Official `checkSms` contract](https://www.unisender.com/ru/support/api/messages/check-sms/).
|
|
342
|
+
|
|
343
|
+
| Keyword | Ruby type | Presence |
|
|
344
|
+
| --- | --- | --- |
|
|
345
|
+
| `sms_id` | `id` | Required |
|
|
346
|
+
|
|
347
|
+
**Result:** Object with String `status`. `not_sent` is pending, `ok_sent` means delivery is not confirmed, and `ok_delivered` is delivered; `err_` statuses indicate failures.
|
|
348
|
+
|
|
349
|
+
</details>
|
|
350
|
+
|
|
351
|
+
<a id="create_campaign"></a>
|
|
352
|
+
<details>
|
|
353
|
+
<summary><code>create_campaign</code></summary>
|
|
354
|
+
|
|
355
|
+
[Official `createCampaign` contract](https://www.unisender.com/ru/support/api/messages/createcampaign/).
|
|
356
|
+
|
|
357
|
+
| Keyword | Ruby type | Presence |
|
|
358
|
+
| --- | --- | --- |
|
|
359
|
+
| `message_id` | `id` | Required |
|
|
360
|
+
| `start_time` | `String` | Optional, omitted |
|
|
361
|
+
| `timezone` | `String` | Optional, omitted |
|
|
362
|
+
| `track_read` | `flag` | Optional, omitted |
|
|
363
|
+
| `track_links` | `flag` | Optional, omitted |
|
|
364
|
+
| `contacts` | `String \| Array[id]` | Optional, omitted |
|
|
365
|
+
| `contacts_url` | `String` | Optional, omitted |
|
|
366
|
+
| `track_ga` | `flag` | Optional, omitted |
|
|
367
|
+
| `payment_limit` | `Integer \| Float` | Optional, omitted |
|
|
368
|
+
| `payment_currency` | `String` | Optional, omitted |
|
|
369
|
+
| `ga_medium` | `String` | Optional, omitted |
|
|
370
|
+
| `ga_source` | `String` | Optional, omitted |
|
|
371
|
+
| `ga_campaign` | `String` | Optional, omitted |
|
|
372
|
+
| `ga_content` | `String` | Optional, omitted |
|
|
373
|
+
| `ga_term` | `String` | Optional, omitted |
|
|
374
|
+
|
|
375
|
+
**Result:** Object with `campaign_id` and String `status`, such as `scheduled` or `waits_censor`. `count` is deprecated and documented as zero. Accepted does not mean delivered.
|
|
376
|
+
|
|
377
|
+
`contacts` and `contacts_url` are mutually exclusive. Omitting a schedule starts sending as soon as the service permits. A timeout leaves the send outcome uncertain; this method is never automatically retried.
|
|
378
|
+
|
|
379
|
+
</details>
|
|
380
|
+
|
|
381
|
+
<a id="create_email_message"></a>
|
|
382
|
+
<details>
|
|
383
|
+
<summary><code>create_email_message</code></summary>
|
|
384
|
+
|
|
385
|
+
[Official `createEmailMessage` contract](https://www.unisender.com/ru/support/api/messages/createemailmessage/).
|
|
386
|
+
|
|
387
|
+
| Keyword | Ruby type | Presence |
|
|
388
|
+
| --- | --- | --- |
|
|
389
|
+
| `sender_name` | `String` | Required |
|
|
390
|
+
| `sender_email` | `String` | Required |
|
|
391
|
+
| `list_id` | `id` | Required |
|
|
392
|
+
| `subject` | `String` | Optional, omitted |
|
|
393
|
+
| `body` | `String` | Optional, omitted |
|
|
394
|
+
| `text_body` | `String` | Optional, omitted |
|
|
395
|
+
| `generate_text` | `flag` | Optional, omitted |
|
|
396
|
+
| `tag` | `String` | Optional, omitted |
|
|
397
|
+
| `attachments` | `Hash[String, String]` | Optional, omitted |
|
|
398
|
+
| `lang` | `String` | Optional, omitted |
|
|
399
|
+
| `template_id` | `id` | Optional, omitted |
|
|
400
|
+
| `system_template_id` | `id` | Optional, omitted |
|
|
401
|
+
| `wrap_type` | `String` | Optional, omitted |
|
|
402
|
+
| `categories` | `String \| Array[id]` | Optional, omitted |
|
|
403
|
+
|
|
404
|
+
**Result:** Object with `message_id`. Creates a message without sending it. Pass the identifier to `create_campaign` to send.
|
|
405
|
+
|
|
406
|
+
Supply nonempty `subject` and `body`, or select `template_id` / `system_template_id` so the template supplies them. Use a verified sender. `attachments` maps filenames to raw file bytes, not file paths or pre-encoded Base64. `lang` controls the unsubscribe text, separately from the client API language.
|
|
407
|
+
|
|
408
|
+
</details>
|
|
409
|
+
|
|
410
|
+
<a id="create_sms_message"></a>
|
|
411
|
+
<details>
|
|
412
|
+
<summary><code>create_sms_message</code></summary>
|
|
413
|
+
|
|
414
|
+
[Official `createSmsMessage` contract](https://www.unisender.com/ru/support/api/messages/createsmsmessage/).
|
|
415
|
+
|
|
416
|
+
| Keyword | Ruby type | Presence |
|
|
417
|
+
| --- | --- | --- |
|
|
418
|
+
| `sender` | `String` | Required |
|
|
419
|
+
| `body` | `String` | Required |
|
|
420
|
+
| `list_id` | `id` | Required |
|
|
421
|
+
| `tag` | `String` | Optional, omitted |
|
|
422
|
+
|
|
423
|
+
**Result:** Object with `message_id`. Creates a message without sending it.
|
|
424
|
+
|
|
425
|
+
</details>
|
|
426
|
+
|
|
427
|
+
<a id="delete_message"></a>
|
|
428
|
+
<details>
|
|
429
|
+
<summary><code>delete_message</code></summary>
|
|
430
|
+
|
|
431
|
+
[Official `deleteMessage` contract](https://www.unisender.com/ru/support/api/messages/deletemessage/).
|
|
432
|
+
|
|
433
|
+
| Keyword | Ruby type | Presence |
|
|
434
|
+
| --- | --- | --- |
|
|
435
|
+
| `message_id` | `id` | Required |
|
|
436
|
+
|
|
437
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization.
|
|
438
|
+
|
|
439
|
+
</details>
|
|
440
|
+
|
|
441
|
+
<a id="get_actual_message_version"></a>
|
|
442
|
+
<details>
|
|
443
|
+
<summary><code>get_actual_message_version</code></summary>
|
|
444
|
+
|
|
445
|
+
[Official `getActualMessageVersion` contract](https://www.unisender.com/ru/support/api/messages/get-actual-message-version/).
|
|
446
|
+
|
|
447
|
+
| Keyword | Ruby type | Presence |
|
|
448
|
+
| --- | --- | --- |
|
|
449
|
+
| `message_id` | `id` | Required |
|
|
450
|
+
|
|
451
|
+
**Result:** Object with `message_id` and `actual_version_id`. Use the latter when a message has a newer active version.
|
|
452
|
+
|
|
453
|
+
</details>
|
|
454
|
+
|
|
455
|
+
<a id="get_web_version"></a>
|
|
456
|
+
<details>
|
|
457
|
+
<summary><code>get_web_version</code></summary>
|
|
458
|
+
|
|
459
|
+
[Official `getWebVersion` contract](https://www.unisender.com/ru/support/api/messages/getwebversion/).
|
|
460
|
+
|
|
461
|
+
| Keyword | Ruby type | Presence |
|
|
462
|
+
| --- | --- | --- |
|
|
463
|
+
| `campaign_id` | `id` | Required |
|
|
464
|
+
|
|
465
|
+
**Result:** Object with `letter_id` and `web_letter_link`.
|
|
466
|
+
|
|
467
|
+
</details>
|
|
468
|
+
|
|
469
|
+
<a id="send_email"></a>
|
|
470
|
+
<details>
|
|
471
|
+
<summary><code>send_email</code></summary>
|
|
472
|
+
|
|
473
|
+
[Official `sendEmail` contract](https://www.unisender.com/ru/support/api/messages/sendemail/).
|
|
474
|
+
|
|
475
|
+
| Keyword | Ruby type | Presence |
|
|
476
|
+
| --- | --- | --- |
|
|
477
|
+
| `email` | `String` | Required |
|
|
478
|
+
| `sender_name` | `String` | Required |
|
|
479
|
+
| `sender_email` | `String` | Required |
|
|
480
|
+
| `subject` | `String` | Required |
|
|
481
|
+
| `body` | `String` | Required |
|
|
482
|
+
| `list_id` | `id` | Required |
|
|
483
|
+
| `attachments` | `Hash[String, String]` | Optional, omitted |
|
|
484
|
+
| `lang` | `String` | Optional, omitted |
|
|
485
|
+
| `track_read` | `flag` | Optional, omitted |
|
|
486
|
+
| `track_links` | `flag` | Optional, omitted |
|
|
487
|
+
| `cc` | `String` | Optional, omitted |
|
|
488
|
+
| `headers` | `String \| params` | Optional, omitted |
|
|
489
|
+
| `images_as` | `String` | Optional, omitted |
|
|
490
|
+
| `ref_key` | `String` | Optional, omitted |
|
|
491
|
+
| `error_checking` | `flag` | Optional, omitted |
|
|
492
|
+
| `metadata` | `params` | Optional, omitted |
|
|
493
|
+
|
|
494
|
+
**Result:** With `error_checking: 1` or `cc`, an Array of per-recipient results containing `index`, `email`, and accepted message `id`. Without either, the legacy result is an Object with `email_id`. With `error_checking: 1`, also inspect recipient `errors`; the top-level success envelope alone is insufficient.
|
|
495
|
+
|
|
496
|
+
Use a verified sender and consenting recipients. `attachments` maps filenames to raw bytes. Set `error_checking: 1` to receive per-recipient errors. Sending is never automatically retried.
|
|
497
|
+
|
|
498
|
+
</details>
|
|
499
|
+
|
|
500
|
+
<a id="send_sms"></a>
|
|
501
|
+
<details>
|
|
502
|
+
<summary><code>send_sms</code></summary>
|
|
503
|
+
|
|
504
|
+
[Official `sendSms` contract](https://www.unisender.com/ru/support/api/messages/sendsms/).
|
|
505
|
+
|
|
506
|
+
| Keyword | Ruby type | Presence |
|
|
507
|
+
| --- | --- | --- |
|
|
508
|
+
| `phone` | `String` | Required |
|
|
509
|
+
| `sender` | `String` | Required |
|
|
510
|
+
| `text` | `String` | Required |
|
|
511
|
+
|
|
512
|
+
**Result:** Object containing `sms_id`, `price`, and `currency`. Retain `sms_id` for `check_sms`.
|
|
513
|
+
|
|
514
|
+
Use the international phone format and an approved sender. Sending is never automatically retried.
|
|
515
|
+
|
|
516
|
+
</details>
|
|
517
|
+
|
|
518
|
+
<a id="send_test_email"></a>
|
|
519
|
+
<details>
|
|
520
|
+
<summary><code>send_test_email</code></summary>
|
|
521
|
+
|
|
522
|
+
[Official `sendTestEmail` contract](https://www.unisender.com/ru/support/api/messages/sendtestemail/).
|
|
523
|
+
|
|
524
|
+
| Keyword | Ruby type | Presence |
|
|
525
|
+
| --- | --- | --- |
|
|
526
|
+
| `email` | `String \| Array[id]` | Required |
|
|
527
|
+
| `id` | `id` | Required |
|
|
528
|
+
|
|
529
|
+
**Result:** The documented top-level Object contains `message`. Sends the test immediately. Legacy `result` envelopes are also accepted.
|
|
530
|
+
|
|
531
|
+
</details>
|
|
532
|
+
|
|
533
|
+
<a id="update_email_message"></a>
|
|
534
|
+
<details>
|
|
535
|
+
<summary><code>update_email_message</code></summary>
|
|
536
|
+
|
|
537
|
+
[Official `updateEmailMessage` contract](https://www.unisender.com/ru/support/api/messages/updateemailmessage/).
|
|
538
|
+
|
|
539
|
+
| Keyword | Ruby type | Presence |
|
|
540
|
+
| --- | --- | --- |
|
|
541
|
+
| `id` | `id` | Required |
|
|
542
|
+
| `sender_name` | `String` | Optional, omitted |
|
|
543
|
+
| `sender_email` | `String` | Optional, omitted |
|
|
544
|
+
| `subject` | `String` | Optional, omitted |
|
|
545
|
+
| `body` | `String` | Optional, omitted |
|
|
546
|
+
| `list_id` | `id` | Optional, omitted |
|
|
547
|
+
| `text_body` | `String` | Optional, omitted |
|
|
548
|
+
| `lang` | `String` | Optional, omitted |
|
|
549
|
+
| `categories` | `String \| Array[id]` | Optional, omitted |
|
|
550
|
+
|
|
551
|
+
**Result:** Object with `message_id`. Retain the returned identifier because editing an already-sent message can create a new version.
|
|
552
|
+
|
|
553
|
+
</details>
|
|
554
|
+
|
|
555
|
+
<a id="update_opt_in_email"></a>
|
|
556
|
+
<details>
|
|
557
|
+
<summary><code>update_opt_in_email</code></summary>
|
|
558
|
+
|
|
559
|
+
[Official `updateOptInEmail` contract](https://www.unisender.com/ru/support/api/messages/updateoptinemail/).
|
|
560
|
+
|
|
561
|
+
| Keyword | Ruby type | Presence |
|
|
562
|
+
| --- | --- | --- |
|
|
563
|
+
| `sender_name` | `String` | Required |
|
|
564
|
+
| `sender_email` | `String` | Required |
|
|
565
|
+
| `subject` | `String` | Required |
|
|
566
|
+
| `body` | `String` | Required |
|
|
567
|
+
| `list_id` | `id` | Required |
|
|
568
|
+
|
|
569
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization. Updates the list confirmation message.
|
|
570
|
+
|
|
571
|
+
</details>
|
|
572
|
+
|
|
573
|
+
<a id="get_sender_domain_list"></a>
|
|
574
|
+
<details>
|
|
575
|
+
<summary><code>get_sender_domain_list</code></summary>
|
|
576
|
+
|
|
577
|
+
[Official `getSenderDomainList` contract](https://www.unisender.com/ru/support/api/messages/getsenderdomainlist/).
|
|
578
|
+
|
|
579
|
+
| Keyword | Ruby type | Presence |
|
|
580
|
+
| --- | --- | --- |
|
|
581
|
+
| `username` | `String` | Required |
|
|
582
|
+
| `domain` | `String` | Optional, omitted |
|
|
583
|
+
| `limit` | `Integer` | Optional, omitted |
|
|
584
|
+
| `offset` | `Integer` | Optional, omitted |
|
|
585
|
+
|
|
586
|
+
**Result:** Array of groups containing `status` and `domains`; each domain has fields such as `Domain` and `Status`. Preserve the upstream capitalization. Pagination counts domains, not groups.
|
|
587
|
+
|
|
588
|
+
</details>
|
|
589
|
+
|
|
590
|
+
<a id="get_campaign_common_stats"></a>
|
|
591
|
+
<details>
|
|
592
|
+
<summary><code>get_campaign_common_stats</code></summary>
|
|
593
|
+
|
|
594
|
+
[Official `getCampaignCommonStats` contract](https://www.unisender.com/ru/support/api/statistics/get-campaign-common-stats/).
|
|
595
|
+
|
|
596
|
+
| Keyword | Ruby type | Presence |
|
|
597
|
+
| --- | --- | --- |
|
|
598
|
+
| `campaign_id` | `id` | Required |
|
|
599
|
+
|
|
600
|
+
**Result:** Object of campaign counters such as `total` and `sent`. Additional fields depend on campaign type.
|
|
601
|
+
|
|
602
|
+
</details>
|
|
603
|
+
|
|
604
|
+
<a id="get_campaign_delivery_stats"></a>
|
|
605
|
+
<details>
|
|
606
|
+
<summary><code>get_campaign_delivery_stats</code></summary>
|
|
607
|
+
|
|
608
|
+
[Official `async/getCampaignDeliveryStats` contract](https://www.unisender.com/ru/support/api/statistics/getcampaigndeliverystats/).
|
|
609
|
+
|
|
610
|
+
| Keyword | Ruby type | Presence |
|
|
611
|
+
| --- | --- | --- |
|
|
612
|
+
| `campaign_id` | `id` | Required |
|
|
613
|
+
| `notify_url` | `String` | Optional, omitted |
|
|
614
|
+
| `changed_since` | `String` | Optional, omitted |
|
|
615
|
+
| `field_ids` | `Array[id]` | Optional, omitted |
|
|
616
|
+
|
|
617
|
+
**Result:** Object with `task_uuid` and initial `status`, followed by a download URL when the asynchronous report completes.
|
|
618
|
+
|
|
619
|
+
</details>
|
|
620
|
+
|
|
621
|
+
<a id="get_campaign_status"></a>
|
|
622
|
+
<details>
|
|
623
|
+
<summary><code>get_campaign_status</code></summary>
|
|
624
|
+
|
|
625
|
+
[Official `getCampaignStatus` contract](https://www.unisender.com/ru/support/api/statistics/getcampaignstatus/).
|
|
626
|
+
|
|
627
|
+
| Keyword | Ruby type | Presence |
|
|
628
|
+
| --- | --- | --- |
|
|
629
|
+
| `campaign_id` | `id` | Required |
|
|
630
|
+
|
|
631
|
+
**Result:** Object with String `status`. The full set of campaign states is documented upstream.
|
|
632
|
+
|
|
633
|
+
</details>
|
|
634
|
+
|
|
635
|
+
<a id="get_messages"></a>
|
|
636
|
+
<details>
|
|
637
|
+
<summary><code>get_messages</code></summary>
|
|
638
|
+
|
|
639
|
+
[Official `getMessages` contract](https://www.unisender.com/ru/support/api/statistics/getmessages/).
|
|
640
|
+
|
|
641
|
+
| Keyword | Ruby type | Presence |
|
|
642
|
+
| --- | --- | --- |
|
|
643
|
+
| `date_from` | `String` | Required |
|
|
644
|
+
| `date_to` | `String` | Required |
|
|
645
|
+
| `limit` | `Integer` | Optional, omitted |
|
|
646
|
+
| `offset` | `Integer` | Optional, omitted |
|
|
647
|
+
|
|
648
|
+
**Result:** Array of message objects, including identifiers, content, sender information, and version metadata. Field availability depends on email versus SMS.
|
|
649
|
+
|
|
650
|
+
Date filters use UTC `YYYY-MM-DD HH:MM:SS`. `limit` is 1 to 100 (default 50), and `offset` starts at zero.
|
|
651
|
+
|
|
652
|
+
</details>
|
|
653
|
+
|
|
654
|
+
<a id="get_visited_links"></a>
|
|
655
|
+
<details>
|
|
656
|
+
<summary><code>get_visited_links</code></summary>
|
|
657
|
+
|
|
658
|
+
[Official `getVisitedLinks` contract](https://www.unisender.com/ru/support/api/statistics/getvisitedlinks/).
|
|
659
|
+
|
|
660
|
+
| Keyword | Ruby type | Presence |
|
|
661
|
+
| --- | --- | --- |
|
|
662
|
+
| `campaign_id` | `id` | Required |
|
|
663
|
+
| `group` | `flag` | Optional, omitted |
|
|
664
|
+
|
|
665
|
+
**Result:** Object with `fields` (column names) and `data` (rows). Interpret each row using the matching column index.
|
|
666
|
+
|
|
667
|
+
</details>
|
|
668
|
+
|
|
669
|
+
<a id="list_messages"></a>
|
|
670
|
+
<details>
|
|
671
|
+
<summary><code>list_messages</code></summary>
|
|
672
|
+
|
|
673
|
+
[Official `listMessages` contract](https://www.unisender.com/ru/support/api/statistics/listmessages/).
|
|
674
|
+
|
|
675
|
+
| Keyword | Ruby type | Presence |
|
|
676
|
+
| --- | --- | --- |
|
|
677
|
+
| `date_from` | `String` | Required |
|
|
678
|
+
| `date_to` | `String` | Required |
|
|
679
|
+
| `limit` | `Integer` | Optional, omitted |
|
|
680
|
+
| `offset` | `Integer` | Optional, omitted |
|
|
681
|
+
|
|
682
|
+
**Result:** Array of message summary objects. Use `get_message` when message content is needed.
|
|
683
|
+
|
|
684
|
+
`limit` is 1 to 100; `offset` starts at zero. See the upstream page for the date range format.
|
|
685
|
+
|
|
686
|
+
</details>
|
|
687
|
+
|
|
688
|
+
<a id="get_campaigns"></a>
|
|
689
|
+
<details>
|
|
690
|
+
<summary><code>get_campaigns</code></summary>
|
|
691
|
+
|
|
692
|
+
[Official `getCampaigns` contract](https://www.unisender.com/ru/support/api/statistics/getcampaigns/).
|
|
693
|
+
|
|
694
|
+
| Keyword | Ruby type | Presence |
|
|
695
|
+
| --- | --- | --- |
|
|
696
|
+
| `from` | `String` | Required |
|
|
697
|
+
| `to` | `String` | Optional, omitted |
|
|
698
|
+
| `limit` | `Integer` | Optional, omitted |
|
|
699
|
+
| `offset` | `Integer` | Optional, omitted |
|
|
700
|
+
|
|
701
|
+
**Result:** Array of campaign objects with identifiers and campaign metadata. Supports offset pagination.
|
|
702
|
+
|
|
703
|
+
`from` is required even when paginating. Supply `from` and `to` in UTC as `YYYY-MM-DD HH:MM:SS`, including seconds, for example `"2026-10-01 00:00:00"`. Omitting seconds can produce an `unspecified` API error. `limit` is at most 10,000; `offset` starts at zero.
|
|
704
|
+
|
|
705
|
+
</details>
|
|
706
|
+
|
|
707
|
+
<a id="get_message"></a>
|
|
708
|
+
<details>
|
|
709
|
+
<summary><code>get_message</code></summary>
|
|
710
|
+
|
|
711
|
+
[Official `getMessage` contract](https://www.unisender.com/ru/support/api/statistics/getmessage/).
|
|
712
|
+
|
|
713
|
+
| Keyword | Ruby type | Presence |
|
|
714
|
+
| --- | --- | --- |
|
|
715
|
+
| `id` | `id` | Required |
|
|
716
|
+
|
|
717
|
+
**Result:** Array of message objects, including content and metadata. The upstream example wraps even a single requested message in an Array.
|
|
718
|
+
|
|
719
|
+
</details>
|
|
720
|
+
|
|
721
|
+
<a id="get_task_result"></a>
|
|
722
|
+
<details>
|
|
723
|
+
<summary><code>get_task_result</code></summary>
|
|
724
|
+
|
|
725
|
+
[Official `async/getTaskResult` contract](https://www.unisender.com/ru/support/api/statistics/../contacts/exportcontacts/).
|
|
726
|
+
|
|
727
|
+
| Keyword | Ruby type | Presence |
|
|
728
|
+
| --- | --- | --- |
|
|
729
|
+
| `task_uuid` | `String` | Required |
|
|
730
|
+
|
|
731
|
+
**Result:** Object whose `status` is `new`, `processing`, or `completed`. A completed export/report contains `file_to_download`. Other task states cause `wait_for_task` to raise `TaskError` with its response.
|
|
732
|
+
|
|
733
|
+
</details>
|
|
734
|
+
|
|
735
|
+
<a id="create_email_template"></a>
|
|
736
|
+
<details>
|
|
737
|
+
<summary><code>create_email_template</code></summary>
|
|
738
|
+
|
|
739
|
+
[Official `createEmailTemplate` contract](https://www.unisender.com/ru/support/api/templates/createemailtemplate/).
|
|
740
|
+
|
|
741
|
+
| Keyword | Ruby type | Presence |
|
|
742
|
+
| --- | --- | --- |
|
|
743
|
+
| `title` | `String` | Required |
|
|
744
|
+
| `subject` | `String` | Required |
|
|
745
|
+
| `body` | `String` | Required |
|
|
746
|
+
| `description` | `String` | Optional, omitted |
|
|
747
|
+
| `text_body` | `String` | Optional, omitted |
|
|
748
|
+
| `lang` | `String` | Optional, omitted |
|
|
749
|
+
|
|
750
|
+
**Result:** Object with the new template `id`.
|
|
751
|
+
|
|
752
|
+
</details>
|
|
753
|
+
|
|
754
|
+
<a id="delete_template"></a>
|
|
755
|
+
<details>
|
|
756
|
+
<summary><code>delete_template</code></summary>
|
|
757
|
+
|
|
758
|
+
[Official `deleteTemplate` contract](https://www.unisender.com/ru/support/api/templates/deletetemplate/).
|
|
759
|
+
|
|
760
|
+
| Keyword | Ruby type | Presence |
|
|
761
|
+
| --- | --- | --- |
|
|
762
|
+
| `template_id` | `id` | Required |
|
|
763
|
+
|
|
764
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization.
|
|
765
|
+
|
|
766
|
+
</details>
|
|
767
|
+
|
|
768
|
+
<a id="get_template"></a>
|
|
769
|
+
<details>
|
|
770
|
+
<summary><code>get_template</code></summary>
|
|
771
|
+
|
|
772
|
+
[Official `getTemplate` contract](https://www.unisender.com/ru/support/api/templates/gettemplate/).
|
|
773
|
+
|
|
774
|
+
| Keyword | Ruby type | Presence |
|
|
775
|
+
| --- | --- | --- |
|
|
776
|
+
| `template_id` | `id` | Optional, omitted |
|
|
777
|
+
| `system_template_id` | `id` | Optional, omitted |
|
|
778
|
+
|
|
779
|
+
**Result:** Object describing the selected template. User and system templates can have different fields; content fields include `subject`, `body`, and `lang_code` where applicable.
|
|
780
|
+
|
|
781
|
+
Provide `template_id` or `system_template_id`; neither is required individually, but at least one is required.
|
|
782
|
+
|
|
783
|
+
</details>
|
|
784
|
+
|
|
785
|
+
<a id="get_templates"></a>
|
|
786
|
+
<details>
|
|
787
|
+
<summary><code>get_templates</code></summary>
|
|
788
|
+
|
|
789
|
+
[Official `getTemplates` contract](https://www.unisender.com/ru/support/api/templates/gettemplates/).
|
|
790
|
+
|
|
791
|
+
| Keyword | Ruby type | Presence |
|
|
792
|
+
| --- | --- | --- |
|
|
793
|
+
| `type` | `String` | Optional, omitted |
|
|
794
|
+
| `date_from` | `String` | Optional, omitted |
|
|
795
|
+
| `date_to` | `String` | Optional, omitted |
|
|
796
|
+
| `limit` | `Integer` | Optional, omitted |
|
|
797
|
+
| `offset` | `Integer` | Optional, omitted |
|
|
798
|
+
|
|
799
|
+
**Result:** Array of template objects with identifiers, titles, content, and metadata. User-only fields include `body`; system templates can provide preview URLs instead.
|
|
800
|
+
|
|
801
|
+
`type` is `"user"` (default) or `"system"`. Date filters use UTC `YYYY-MM-DD HH:MM`; system templates ignore them. `limit` is 1 to 100 (default 50), and `offset` starts at zero.
|
|
802
|
+
|
|
803
|
+
</details>
|
|
804
|
+
|
|
805
|
+
<a id="list_templates"></a>
|
|
806
|
+
<details>
|
|
807
|
+
<summary><code>list_templates</code></summary>
|
|
808
|
+
|
|
809
|
+
[Official `listTemplates` contract](https://www.unisender.com/ru/support/api/templates/listtemplates/).
|
|
810
|
+
|
|
811
|
+
| Keyword | Ruby type | Presence |
|
|
812
|
+
| --- | --- | --- |
|
|
813
|
+
| `type` | `String` | Optional, omitted |
|
|
814
|
+
| `date_from` | `String` | Optional, omitted |
|
|
815
|
+
| `date_to` | `String` | Optional, omitted |
|
|
816
|
+
| `limit` | `Integer` | Optional, omitted |
|
|
817
|
+
| `offset` | `Integer` | Optional, omitted |
|
|
818
|
+
|
|
819
|
+
**Result:** Array of template summary objects. Use `get_template` for a selected template.
|
|
820
|
+
|
|
821
|
+
`type` is `"user"` or `"system"`. Date filters use UTC `YYYY-MM-DD HH:MM`; system templates ignore them. `limit` is 1 to 100 (default 50), and `offset` starts at zero.
|
|
822
|
+
|
|
823
|
+
</details>
|
|
824
|
+
|
|
825
|
+
<a id="update_email_template"></a>
|
|
826
|
+
<details>
|
|
827
|
+
<summary><code>update_email_template</code></summary>
|
|
828
|
+
|
|
829
|
+
[Official `updateEmailTemplate` contract](https://www.unisender.com/ru/support/api/templates/updateemailtemplate/).
|
|
830
|
+
|
|
831
|
+
| Keyword | Ruby type | Presence |
|
|
832
|
+
| --- | --- | --- |
|
|
833
|
+
| `template_id` | `id` | Required |
|
|
834
|
+
| `title` | `String` | Optional, omitted |
|
|
835
|
+
| `description` | `String` | Optional, omitted |
|
|
836
|
+
| `subject` | `String` | Optional, omitted |
|
|
837
|
+
| `body` | `String` | Optional, omitted |
|
|
838
|
+
| `text_body` | `String` | Optional, omitted |
|
|
839
|
+
| `lang` | `String` | Optional, omitted |
|
|
840
|
+
|
|
841
|
+
**Result:** Object with the updated template `id`.
|
|
842
|
+
|
|
843
|
+
</details>
|
|
844
|
+
|
|
845
|
+
<a id="create_field"></a>
|
|
846
|
+
<details>
|
|
847
|
+
<summary><code>create_field</code></summary>
|
|
848
|
+
|
|
849
|
+
[Official `createField` contract](https://www.unisender.com/ru/support/api/inputs/createfield/).
|
|
850
|
+
|
|
851
|
+
| Keyword | Ruby type | Presence |
|
|
852
|
+
| --- | --- | --- |
|
|
853
|
+
| `name` | `String` | Required |
|
|
854
|
+
| `type` | `String` | Required |
|
|
855
|
+
| `public_name` | `String` | Optional, omitted |
|
|
856
|
+
|
|
857
|
+
**Result:** Object with the new field `id`.
|
|
858
|
+
|
|
859
|
+
</details>
|
|
860
|
+
|
|
861
|
+
<a id="delete_field"></a>
|
|
862
|
+
<details>
|
|
863
|
+
<summary><code>delete_field</code></summary>
|
|
864
|
+
|
|
865
|
+
[Official `deleteField` contract](https://www.unisender.com/ru/support/api/inputs/deletefield/).
|
|
866
|
+
|
|
867
|
+
| Keyword | Ruby type | Presence |
|
|
868
|
+
| --- | --- | --- |
|
|
869
|
+
| `id` | `id` | Required |
|
|
870
|
+
|
|
871
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization.
|
|
872
|
+
|
|
873
|
+
</details>
|
|
874
|
+
|
|
875
|
+
<a id="delete_tag"></a>
|
|
876
|
+
<details>
|
|
877
|
+
<summary><code>delete_tag</code></summary>
|
|
878
|
+
|
|
879
|
+
[Official `deleteTag` contract](https://www.unisender.com/ru/support/api/inputs/deletetag/).
|
|
880
|
+
|
|
881
|
+
| Keyword | Ruby type | Presence |
|
|
882
|
+
| --- | --- | --- |
|
|
883
|
+
| `id` | `id` | Required |
|
|
884
|
+
|
|
885
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization.
|
|
886
|
+
|
|
887
|
+
</details>
|
|
888
|
+
|
|
889
|
+
<a id="get_fields"></a>
|
|
890
|
+
<details>
|
|
891
|
+
<summary><code>get_fields</code></summary>
|
|
892
|
+
|
|
893
|
+
[Official `getFields` contract](https://www.unisender.com/ru/support/api/inputs/getfields/).
|
|
894
|
+
|
|
895
|
+
No operation arguments.
|
|
896
|
+
|
|
897
|
+
**Result:** Array of custom-field objects with fields such as `id`, `name`, and `type`.
|
|
898
|
+
|
|
899
|
+
</details>
|
|
900
|
+
|
|
901
|
+
<a id="get_tags"></a>
|
|
902
|
+
<details>
|
|
903
|
+
<summary><code>get_tags</code></summary>
|
|
904
|
+
|
|
905
|
+
[Official `getTags` contract](https://www.unisender.com/ru/support/api/inputs/gettags/).
|
|
906
|
+
|
|
907
|
+
No operation arguments.
|
|
908
|
+
|
|
909
|
+
**Result:** Array of tag objects with `id` and `name`.
|
|
910
|
+
|
|
911
|
+
</details>
|
|
912
|
+
|
|
913
|
+
<a id="update_field"></a>
|
|
914
|
+
<details>
|
|
915
|
+
<summary><code>update_field</code></summary>
|
|
916
|
+
|
|
917
|
+
[Official `updateField` contract](https://www.unisender.com/ru/support/api/inputs/updatefield/).
|
|
918
|
+
|
|
919
|
+
| Keyword | Ruby type | Presence |
|
|
920
|
+
| --- | --- | --- |
|
|
921
|
+
| `id` | `id` | Required |
|
|
922
|
+
| `name` | `String` | Required |
|
|
923
|
+
| `public_name` | `String` | Optional, omitted |
|
|
924
|
+
|
|
925
|
+
**Result:** The documented top-level Object contains the updated field `id`. Legacy `result` envelopes are also accepted.
|
|
926
|
+
|
|
927
|
+
</details>
|
|
928
|
+
|
|
929
|
+
<a id="get_contact_field_values"></a>
|
|
930
|
+
<details>
|
|
931
|
+
<summary><code>get_contact_field_values</code></summary>
|
|
932
|
+
|
|
933
|
+
[Official `getContactFieldValues` contract](https://www.unisender.com/ru/support/api/inputs/getcontactfieldvalues/).
|
|
934
|
+
|
|
935
|
+
| Keyword | Ruby type | Presence |
|
|
936
|
+
| --- | --- | --- |
|
|
937
|
+
| `email` | `String` | Required |
|
|
938
|
+
| `field_ids` | `String \| Array[id]` | Required |
|
|
939
|
+
|
|
940
|
+
**Result:** Object with `fieldValues`, a mapping from string field IDs to their values.
|
|
941
|
+
|
|
942
|
+
</details>
|
|
943
|
+
|
|
944
|
+
<a id="create_subscriber_note"></a>
|
|
945
|
+
<details>
|
|
946
|
+
<summary><code>create_subscriber_note</code></summary>
|
|
947
|
+
|
|
948
|
+
[Official `createSubscriberNote` contract](https://www.unisender.com/ru/support/api/notes/createsubscibernote/).
|
|
949
|
+
|
|
950
|
+
| Keyword | Ruby type | Presence |
|
|
951
|
+
| --- | --- | --- |
|
|
952
|
+
| `subscriber_id` | `id` | Required |
|
|
953
|
+
| `content` | `String` | Required |
|
|
954
|
+
|
|
955
|
+
**Result:** Object with the new note `id`.
|
|
956
|
+
|
|
957
|
+
</details>
|
|
958
|
+
|
|
959
|
+
<a id="update_subscriber_note"></a>
|
|
960
|
+
<details>
|
|
961
|
+
<summary><code>update_subscriber_note</code></summary>
|
|
962
|
+
|
|
963
|
+
[Official `updateSubscriberNote` contract](https://www.unisender.com/ru/support/api/notes/updatesubcribernote/).
|
|
964
|
+
|
|
965
|
+
| Keyword | Ruby type | Presence |
|
|
966
|
+
| --- | --- | --- |
|
|
967
|
+
| `id` | `id` | Required |
|
|
968
|
+
| `content` | `String` | Required |
|
|
969
|
+
|
|
970
|
+
**Result:** Object with the edited note `id`.
|
|
971
|
+
|
|
972
|
+
</details>
|
|
973
|
+
|
|
974
|
+
<a id="delete_subscriber_note"></a>
|
|
975
|
+
<details>
|
|
976
|
+
<summary><code>delete_subscriber_note</code></summary>
|
|
977
|
+
|
|
978
|
+
[Official `deleteSubscriberNote` contract](https://www.unisender.com/ru/support/api/notes/deletesubscribernote/).
|
|
979
|
+
|
|
980
|
+
| Keyword | Ruby type | Presence |
|
|
981
|
+
| --- | --- | --- |
|
|
982
|
+
| `id` | `id` | Required |
|
|
983
|
+
|
|
984
|
+
**Result:** Empty JSON result on success. The documented object shape and legacy array responses are preserved without normalization.
|
|
985
|
+
|
|
986
|
+
</details>
|
|
987
|
+
|
|
988
|
+
<a id="get_subscriber_note"></a>
|
|
989
|
+
<details>
|
|
990
|
+
<summary><code>get_subscriber_note</code></summary>
|
|
991
|
+
|
|
992
|
+
[Official `getSubscriberNote` contract](https://www.unisender.com/ru/support/api/notes/getsubscribernote/).
|
|
993
|
+
|
|
994
|
+
| Keyword | Ruby type | Presence |
|
|
995
|
+
| --- | --- | --- |
|
|
996
|
+
| `id` | `id` | Required |
|
|
997
|
+
|
|
998
|
+
**Result:** Object with `id`, `content`, subscriber/account IDs, origin, pinning information, and timestamps.
|
|
999
|
+
|
|
1000
|
+
</details>
|
|
1001
|
+
|
|
1002
|
+
<a id="get_subscriber_notes"></a>
|
|
1003
|
+
<details>
|
|
1004
|
+
<summary><code>get_subscriber_notes</code></summary>
|
|
1005
|
+
|
|
1006
|
+
[Official `getSubscriberNotes` contract](https://www.unisender.com/ru/support/api/notes/getsubscribernotes/).
|
|
1007
|
+
|
|
1008
|
+
| Keyword | Ruby type | Presence |
|
|
1009
|
+
| --- | --- | --- |
|
|
1010
|
+
| `subscriber_id` | `id` | Required |
|
|
1011
|
+
| `limit` | `Integer` | Optional, omitted |
|
|
1012
|
+
| `offset` | `Integer` | Optional, omitted |
|
|
1013
|
+
| `order_type` | `String` | Optional, omitted |
|
|
1014
|
+
| `order_by` | `String` | Optional, omitted |
|
|
1015
|
+
| `is_pinned` | `flag` | Optional, omitted |
|
|
1016
|
+
|
|
1017
|
+
**Result:** Array of note objects for the subscriber. Supports offset pagination.
|
|
1018
|
+
|
|
1019
|
+
</details>
|
|
1020
|
+
|
|
1021
|
+
<a id="track_events"></a>
|
|
1022
|
+
<details>
|
|
1023
|
+
<summary><code>track_events</code></summary>
|
|
1024
|
+
|
|
1025
|
+
[Official Event Tracking contract](https://www.unisender.com/ru/support/api/event-tracking-api/).
|
|
1026
|
+
|
|
1027
|
+
| Keyword | Ruby type | Presence |
|
|
1028
|
+
| --- | --- | --- |
|
|
1029
|
+
| `events` | `Array[Hash]` | Required |
|
|
1030
|
+
|
|
1031
|
+
Supply 1 to 25 events. Each event requires a `name` of 1 to 40 characters and an ASCII `email` address, and can contain at most 25 fields including those two. Additional fields must be JSON-compatible values. The encoded request must fit within 130 KiB. Use `track_events_in_batches` for larger collections, or reduce the batch size for large individual events.
|
|
1032
|
+
|
|
1033
|
+
**Result:** `{"success" => true}`. Event Tracking uses its own JSON endpoint and bearer authentication. HTTP 400 can mean that valid events were accepted while others failed; inspect `EventError#details` and `possibly_partially_accepted?`. Neither direct calls nor the batch helper automatically retries events. Recording an event can trigger account automation.
|
|
1034
|
+
|
|
1035
|
+
</details>
|
|
1036
|
+
|
|
1037
|
+
## Documentation decisions
|
|
1038
|
+
|
|
1039
|
+
Successful `sendTestEmail` and `updateField` examples omit the `result` envelope. These two operations also accept their documented top-level success fields. Other operations still require `result`, and `error` always takes precedence.
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
1. **D1:** The supplied [OpenAPI repository](https://gitflic.ru/project/unisender/unigo-openapi) targets UniSender Go, which has a different host and protocol. This gem does not use that specification.
|
|
1043
|
+
2. **D2:** Contact exports and delivery reports use `async/exportContacts` and `async/getCampaignDeliveryStats`. Both share `async/getTaskResult`. The gem returns the download URL without requesting it or forwarding credentials to it.
|
|
1044
|
+
3. **D3:** Note page titles misspell create and update operations. Their request examples use `createSubscriberNote` and `updateSubscriberNote`; the gem follows those request URLs.
|
|
1045
|
+
4. **D4:** Event Tracking's endpoint definition specifies `https://event.unisender.com/v1/events/`, but its examples omit `/v1`. The gem follows the endpoint definition. The page also shows both a string `error` and structured `details`; `EventError#details` accepts either representation. HTTP 400 can mean partial acceptance.
|
|
1046
|
+
5. **D5:** The create-email page allows templates to supply subject and body. Both template selectors satisfy this alternative; the gem does not invent precedence if both are supplied. Its syntax lists `categories`, although its argument table omits it; the gem accepts that documented keyword.
|
|
1047
|
+
|
|
1048
|
+
`format` is always JSON and cannot be overridden. All request bodies use UTF-8 text except raw attachment bytes. The service can change documented limits and validation rules; account permissions, consent, deliverability, and account-specific limits remain server decisions.
|
|
1049
|
+
|
|
1050
|
+
## Convenience operations
|
|
1051
|
+
|
|
1052
|
+
| Helper | Behavior |
|
|
1053
|
+
| --- | --- |
|
|
1054
|
+
| `each_page(method, page_size: 100, max_pages: 1000, **params)` | Lazy Enumerator of responses for `get_campaigns`, `get_messages`, `list_messages`, `get_templates`, `list_templates`, `get_sender_domain_list`, and `get_subscriber_notes`. An optional `offset` starts iteration. Stops at a short or empty page; raises at the page bound. Offset pagination is not a server snapshot. |
|
|
1055
|
+
| `import_contacts_in_batches(field_names:, data:, batch_size: 500, ...)` | Lazy sequential import of an Enumerable of rows. Accepts `overwrite_tags`, `overwrite_lists`, and `telegram_bot_channel_id`. Stops on request failures or a nonzero `invalid` count. |
|
|
1056
|
+
| `track_events_in_batches(events:, batch_size: 25)` | Lazy sequential event batches. Each request must also meet the 130 KiB payload limit. Use a smaller batch size for large events. |
|
|
1057
|
+
| `wait_for_task(task_uuid:, interval: 1, timeout: 60)` | Polls existing tasks until completion, with a monotonic deadline. Raises on an unknown task state. Deadlines are checked between requests; an in-flight request remains bounded by transport timeouts. |
|
|
1058
|
+
|
|
1059
|
+
`each_page` accepts the same operation keywords as the corresponding named method, except that `page_size` replaces `limit`. Unknown keywords, non-symbol keys, and missing or empty required values raise `ArgumentError` when enumeration starts, before any request. Direct named calls reject invalid arguments immediately. The low-level `request` method retains its existing parameter handling.
|
|
1060
|
+
|
|
1061
|
+
Pagination additionally requires a positive integer page size within the method's documented limit, a positive integer `max_pages`, and a nonnegative integer `offset`. These are helper controls; direct named calls retain the service's validation of their `limit` and `offset` values. Each yielded response preserves its warnings and metadata.
|
|
1062
|
+
|
|
1063
|
+
Batch helper failures raise `BatchError`. Its `completed_responses` contains earlier successful batches, `failed_range` is the zero-based, end-exclusive input range with an uncertain or failed outcome, and `error` contains the original failure. A failed batch can still contain accepted records. Helpers do not replay batches or roll back earlier changes.
|