mailersend-ruby 3.1.0 → 3.4.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 +4 -4
- data/.envrc +2 -0
- data/.github/workflows/main.yml +1 -1
- data/.github/workflows/publish_gem.yml +1 -1
- data/.gitignore +2 -1
- data/CHANGELOG.md +9 -0
- data/README.md +423 -0
- data/fixtures/email/email_send_template_language.yml +56 -0
- data/fixtures/emails/emails_list_emails.yml +35 -0
- data/fixtures/emails/emails_list_emails_empty_page.yml +35 -0
- data/fixtures/emails/emails_single_email.yml +35 -0
- data/fixtures/whatsapp/whatsapp_send.yml +47 -0
- data/fixtures/whatsapp/whatsapp_send_multiple_recipients.yml +47 -0
- data/fixtures/whatsapp/whatsapp_send_personalization.yml +47 -0
- data/fixtures/whatsapp_activities/whatsapp_activities_list.yml +43 -0
- data/fixtures/whatsapp_inbound_messages/whatsapp_inbound_messages_get.yml +43 -0
- data/fixtures/whatsapp_inbound_messages/whatsapp_inbound_messages_list.yml +43 -0
- data/fixtures/whatsapp_items/whatsapp_items_get.yml +43 -0
- data/fixtures/whatsapp_items/whatsapp_items_list.yml +43 -0
- data/fixtures/whatsapp_messages/whatsapp_messages_get.yml +43 -0
- data/fixtures/whatsapp_messages/whatsapp_messages_list.yml +43 -0
- data/fixtures/whatsapp_recipient/whatsapp_recipient_get.yml +43 -0
- data/fixtures/whatsapp_recipient/whatsapp_recipient_list.yml +43 -0
- data/fixtures/whatsapp_templates/whatsapp_templates_get.yml +43 -0
- data/fixtures/whatsapp_templates/whatsapp_templates_list.yml +43 -0
- data/flake.lock +27 -0
- data/flake.nix +25 -0
- data/lefthook.yml +14 -0
- data/lib/mailersend/email/email.rb +10 -0
- data/lib/mailersend/emails/emails.rb +44 -0
- data/lib/mailersend/version.rb +1 -1
- data/lib/mailersend/whatsapp/whatsapp.rb +47 -0
- data/lib/mailersend/whatsapp_activities/whatsapp_activities.rb +45 -0
- data/lib/mailersend/whatsapp_inbound_messages/whatsapp_inbound_messages.rb +47 -0
- data/lib/mailersend/whatsapp_items/whatsapp_items.rb +57 -0
- data/lib/mailersend/whatsapp_messages/whatsapp_messages.rb +47 -0
- data/lib/mailersend/whatsapp_recipient/whatsapp_recipient.rb +38 -0
- data/lib/mailersend/whatsapp_templates/whatsapp_templates.rb +44 -0
- data/lib/mailersend.rb +8 -0
- data/spec/email_rspec.rb +15 -0
- data/spec/emails_rspec.rb +175 -0
- data/spec/whatsapp_activities_rspec.rb +38 -0
- data/spec/whatsapp_inbound_messages_rspec.rb +49 -0
- data/spec/whatsapp_items_rspec.rb +52 -0
- data/spec/whatsapp_messages_rspec.rb +50 -0
- data/spec/whatsapp_recipient_rspec.rb +40 -0
- data/spec/whatsapp_rspec.rb +65 -0
- data/spec/whatsapp_templates_rspec.rb +48 -0
- metadata +39 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 84cfcecb512ca3be82b1060018748424960c07fb2c1f4f37b2fd0e5b495f8623
|
|
4
|
+
data.tar.gz: e2737c666d5fe36e12338faf2816dc755fbbdf8a2003eb552acc45bd19a0abe4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 79b0ae2b3cb61881a245ee793d13cb588838846e51488a35142755fa9cdcd7376932efe6e7b5c73c8706b3409cc1a4bca7ca4c8ceec669af72e66b00d39a7b07
|
|
7
|
+
data.tar.gz: 457825d4c739fd5be6fe2e7864bead0d3838fdbfaf26cb7675fe15be9448e6a655388791faed2c317085ccaa6b9e2e476a9de7a1a1df809cb26ff290eee82e78
|
data/.envrc
ADDED
data/.github/workflows/main.yml
CHANGED
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
## [Released]
|
|
2
2
|
|
|
3
|
+
## [3.4.0] - 2026-10-26
|
|
4
|
+
- WhatsApp read endpoints: messages, items, activities, inbound messages, recipients and templates (list with filters, and get by ID)
|
|
5
|
+
|
|
6
|
+
## [3.3.0] - 2026-09-01
|
|
7
|
+
- WhatsApp support (send template-based WhatsApp messages)
|
|
8
|
+
|
|
9
|
+
## [3.2.0] - 2026-07-09
|
|
10
|
+
- Add optional language field to email send
|
|
11
|
+
|
|
3
12
|
## [3.1.0] - 2026-04-24
|
|
4
13
|
- DMARC Monitoring support (list, create, update, delete monitors; aggregated reports, IP-specific reports, report sources, mark/remove IP favorites)
|
|
5
14
|
|
data/README.md
CHANGED
|
@@ -20,6 +20,10 @@ MailerSend Ruby SDK
|
|
|
20
20
|
- [Update a token](#update-a-token)
|
|
21
21
|
- [Delete a token](#delete-a-token)
|
|
22
22
|
- [Send email with attachment](#send-email-with-attachment)
|
|
23
|
+
- [Emails](#emails)
|
|
24
|
+
- [Get a list of emails](#get-a-list-of-emails)
|
|
25
|
+
- [Pagination](#pagination)
|
|
26
|
+
- [Get a single email](#get-a-single-email)
|
|
23
27
|
- [Activity](#activity)
|
|
24
28
|
- [Get a list of activities](#get-a-list-of-activities)
|
|
25
29
|
- [Analytics](#analytics)
|
|
@@ -93,6 +97,26 @@ MailerSend Ruby SDK
|
|
|
93
97
|
- [Create an email verification list](#create-an-email-verification-list)
|
|
94
98
|
- [Verify an email list](#verify-an-email-list)
|
|
95
99
|
- [Get email verification list results](#get-email-verification-list-results)
|
|
100
|
+
- [WhatsApp](#whatsapp)
|
|
101
|
+
- [Send a WhatsApp message](#send-a-whatsapp-message)
|
|
102
|
+
- [Send a WhatsApp message with personalization](#send-a-whatsapp-message-with-personalization)
|
|
103
|
+
- [WhatsApp Messages](#whatsapp-messages)
|
|
104
|
+
- [Get a list of WhatsApp messages](#get-a-list-of-whatsapp-messages)
|
|
105
|
+
- [Get a WhatsApp message](#get-a-whatsapp-message)
|
|
106
|
+
- [WhatsApp Items](#whatsapp-items)
|
|
107
|
+
- [Get a list of WhatsApp items](#get-a-list-of-whatsapp-items)
|
|
108
|
+
- [Get a WhatsApp item](#get-a-whatsapp-item)
|
|
109
|
+
- [WhatsApp Activities](#whatsapp-activities)
|
|
110
|
+
- [Get a list of WhatsApp activities](#get-a-list-of-whatsapp-activities)
|
|
111
|
+
- [WhatsApp Inbound Messages](#whatsapp-inbound-messages)
|
|
112
|
+
- [Get a list of WhatsApp inbound messages](#get-a-list-of-whatsapp-inbound-messages)
|
|
113
|
+
- [Get a WhatsApp inbound message](#get-a-whatsapp-inbound-message)
|
|
114
|
+
- [WhatsApp Recipients](#whatsapp-recipients)
|
|
115
|
+
- [Get a list of WhatsApp recipients](#get-a-list-of-whatsapp-recipients)
|
|
116
|
+
- [Get a WhatsApp recipient](#get-a-whatsapp-recipient)
|
|
117
|
+
- [WhatsApp Templates](#whatsapp-templates)
|
|
118
|
+
- [Get a list of WhatsApp templates](#get-a-list-of-whatsapp-templates)
|
|
119
|
+
- [Get a WhatsApp template](#get-a-whatsapp-template)
|
|
96
120
|
- [SMS](#sms)
|
|
97
121
|
- [SMS Messages](#sms-messages)
|
|
98
122
|
- [Get a list of SMS messages](#get-a-list-of-sms-messages)
|
|
@@ -200,6 +224,11 @@ ms_email.add_from("email" => "april@parksandrec.com", "name" => "April")
|
|
|
200
224
|
ms_email.add_subject("Time")
|
|
201
225
|
ms_email.add_template_id(12415125)
|
|
202
226
|
|
|
227
|
+
# Optional: send the template in a specific language (language code).
|
|
228
|
+
# Only applies to template-based emails; ignored for raw html/text sends.
|
|
229
|
+
# Supported: de, en, es, fr, it, lt, nl, pl, pt-BR
|
|
230
|
+
ms_email.add_language("de")
|
|
231
|
+
|
|
203
232
|
# Send the email
|
|
204
233
|
ms_email.send
|
|
205
234
|
```
|
|
@@ -332,6 +361,145 @@ ms.add_attachment(content: "/Users/Jerry/Desktop/pic.png", filename: "pic.png",
|
|
|
332
361
|
ms_email.send
|
|
333
362
|
```
|
|
334
363
|
|
|
364
|
+
## Emails
|
|
365
|
+
|
|
366
|
+
An email is the record of a message delivered to one recipient. Use these endpoints to build a searchable sending log,
|
|
367
|
+
and to retrieve a single email together with its activity events.
|
|
368
|
+
|
|
369
|
+
### Get a list of emails
|
|
370
|
+
|
|
371
|
+
```ruby
|
|
372
|
+
require "mailersend-ruby"
|
|
373
|
+
|
|
374
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
375
|
+
|
|
376
|
+
ms_emails = Mailersend::Emails.new(ms_client)
|
|
377
|
+
ms_emails.list(domain_id: "xxx2241ll", date_from: 1620643567, date_to: 1623321967, page: 1, limit: 50, status: %w[sent delivered], interaction: %w[opened])
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
`domain_id`, `date_from` and `date_to` are required. Emails are returned newest first.
|
|
381
|
+
|
|
382
|
+
| Keyword argument | Type | Required | Details |
|
|
383
|
+
|--------------------|-----------------|----------|------------------------------------------------------------------------------------------------------------------|
|
|
384
|
+
| `domain_id` | `String` | yes | A domain that belongs to your account. An unknown domain returns `404`. |
|
|
385
|
+
| `date_from` | `Integer\|String` | yes | Unix timestamp (`1620643567`) or datetime (`"2015-10-01 00:00:00"`), assumed `UTC`. Must be lower than `date_to`. |
|
|
386
|
+
| `date_to` | `Integer\|String` | yes | Unix timestamp or datetime. Must be higher than `date_from` and must not be in the future. |
|
|
387
|
+
| `limit` | `Integer` | no | Min: `10`, Max: `1000`, Default: `25`. |
|
|
388
|
+
| `page` | `Integer` | no | Min: `1`, Max: `100`. See [Pagination](#pagination). |
|
|
389
|
+
| `status` | `Array<String>` | no | Any of `queued`, `sent`, `rejected`, `delivered`. Sent as `status[]`. |
|
|
390
|
+
| `interaction` | `Array<String>` | no | Any of `opened`, `clicked`, `unsubscribed`, `complained`, `no_interaction`. Sent as `interaction[]`. |
|
|
391
|
+
| `recipient_email` | `String` | no | Exact, case-insensitive match. An unknown address returns `200` with an empty `data` array. |
|
|
392
|
+
| `message_id` | `String` | no | Exact match. |
|
|
393
|
+
| `template_id` | `String` | no | Exact match. |
|
|
394
|
+
| `subject` | `String` | no | Min: `3` characters. Partial, case-insensitive match. |
|
|
395
|
+
| `tag` | `String` | no | Exact match against a value in the email's `tags` array. |
|
|
396
|
+
|
|
397
|
+
Values inside `status` are combined with `OR`, values inside `interaction` are combined with `OR`, and the two filters
|
|
398
|
+
are combined with `AND`. Pass them as arrays (`%w[sent delivered]`) — the API rejects a scalar value with `422`.
|
|
399
|
+
|
|
400
|
+
> **Note:** This endpoint requires a token with one of the `activity_read` or `activity_full` scopes, and is limited to
|
|
401
|
+
> 10 requests/minute shared with [`GET` /v1/activity](#get-a-list-of-activities). Requests to either endpoint count
|
|
402
|
+
> against the same budget.
|
|
403
|
+
|
|
404
|
+
Each row in `data` describes one email. `text` and `html` are always `null` in list rows — retrieve the content with
|
|
405
|
+
[`single`](#get-a-single-email):
|
|
406
|
+
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"data": [
|
|
410
|
+
{
|
|
411
|
+
"id": "5ee0b166b251345e407c9201",
|
|
412
|
+
"from": "no-reply@your-domain.com",
|
|
413
|
+
"to": "recipient@example.com",
|
|
414
|
+
"subject": "Your order has shipped",
|
|
415
|
+
"text": null,
|
|
416
|
+
"html": null,
|
|
417
|
+
"template_id": null,
|
|
418
|
+
"domain_id": "xxx2241ll",
|
|
419
|
+
"message_id": "5ee0b174ac2b8a35e407c9210",
|
|
420
|
+
"status": "delivered",
|
|
421
|
+
"tags": ["orders"],
|
|
422
|
+
"interaction": ["opened"],
|
|
423
|
+
"suppression_reason": null,
|
|
424
|
+
"created_at": "2021-05-10T10:06:14.482000Z",
|
|
425
|
+
"updated_at": "2021-05-10T10:06:18.114000Z",
|
|
426
|
+
"headers": [{ "name": "X-Custom", "value": "foo" }]
|
|
427
|
+
}
|
|
428
|
+
],
|
|
429
|
+
"links": {
|
|
430
|
+
"first": "https://api.mailersend.com/v1/emails?page=1",
|
|
431
|
+
"last": null,
|
|
432
|
+
"prev": null,
|
|
433
|
+
"next": "https://api.mailersend.com/v1/emails?page=2"
|
|
434
|
+
},
|
|
435
|
+
"meta": {
|
|
436
|
+
"current_page": 1,
|
|
437
|
+
"current_page_url": "https://api.mailersend.com/v1/emails?page=1",
|
|
438
|
+
"from": 1,
|
|
439
|
+
"path": "https://api.mailersend.com/v1/emails",
|
|
440
|
+
"per_page": 10,
|
|
441
|
+
"to": 3
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Pagination
|
|
447
|
+
|
|
448
|
+
`Mailersend::Emails#list` paginates by page number, the same way as
|
|
449
|
+
[`Mailersend::Activity#get`](#get-a-list-of-activities). Pass `page:` to request a page, and read `meta.current_page`
|
|
450
|
+
to see which page you received.
|
|
451
|
+
|
|
452
|
+
The response carries no `total` and no `last_page`, and `links.last` is always `null`, so the number of pages is not
|
|
453
|
+
known up front. Walk the result set by requesting the next page until `links.next` is `null`:
|
|
454
|
+
|
|
455
|
+
```ruby
|
|
456
|
+
require "mailersend-ruby"
|
|
457
|
+
require "json"
|
|
458
|
+
|
|
459
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
460
|
+
ms_emails = Mailersend::Emails.new(ms_client)
|
|
461
|
+
|
|
462
|
+
page = 1
|
|
463
|
+
|
|
464
|
+
loop do
|
|
465
|
+
response = ms_emails.list(domain_id: "xxx2241ll", date_from: 1620643567, date_to: 1623321967, limit: 100, page: page)
|
|
466
|
+
parsed_response = JSON.parse(response.body)
|
|
467
|
+
|
|
468
|
+
parsed_response['data'].each do |email|
|
|
469
|
+
puts email['id']
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
break if parsed_response['links']['next'].nil?
|
|
473
|
+
|
|
474
|
+
page += 1
|
|
475
|
+
end
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Pass the same required parameters and filters on every page — changing them mid-walk restarts the result set. `page`
|
|
479
|
+
accepts values from `1` to `100` and `limit` from `10` to `1000`; a value outside those ranges returns `422`. To
|
|
480
|
+
retrieve a longer history, split it into several `date_from`/`date_to` windows instead of paging deeper.
|
|
481
|
+
|
|
482
|
+
### Get a single email
|
|
483
|
+
|
|
484
|
+
```ruby
|
|
485
|
+
require "mailersend-ruby"
|
|
486
|
+
|
|
487
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
488
|
+
|
|
489
|
+
ms_emails = Mailersend::Emails.new(ms_client)
|
|
490
|
+
ms_emails.single(email_id: "5ee0b166b251345e407c9201")
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
Pass an `id` returned by [`list`](#get-a-list-of-emails). The response contains everything a list row carries — plus
|
|
494
|
+
the `text` and `html` content, the `recipient` object, and an `activity` array of the events recorded for the email.
|
|
495
|
+
`template_id` is `null` when the email was not sent from a template.
|
|
496
|
+
|
|
497
|
+
> **Note:** `activity` events are returned newest first and capped at 200 per email — use
|
|
498
|
+
> [`Mailersend::Activity#get`](#get-a-list-of-activities) if you need the complete event history for a domain.
|
|
499
|
+
> `deferred` and `suppressed` events are only included if your plan has those features enabled, and `suppressed` events
|
|
500
|
+
> also carry a `suppression_reason`. The `junk` event type is reported as `soft_bounced`. The array is returned even when
|
|
501
|
+
> content tracking is disabled for the domain, in which case `html` and `text` are `null`.
|
|
502
|
+
|
|
335
503
|
## Activity
|
|
336
504
|
|
|
337
505
|
### Get a list of activities
|
|
@@ -1412,6 +1580,261 @@ ms_sms_webhooks = Mailersend::SMSWebhooks.new(ms_client)
|
|
|
1412
1580
|
ms_sms_webhooks.delete_sms_webhook_route(sms_webhook_id: 'your-sms-webhook-id')
|
|
1413
1581
|
```
|
|
1414
1582
|
|
|
1583
|
+
## WhatsApp
|
|
1584
|
+
|
|
1585
|
+
### Send a WhatsApp message
|
|
1586
|
+
|
|
1587
|
+
```ruby
|
|
1588
|
+
require "mailersend-ruby"
|
|
1589
|
+
|
|
1590
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1591
|
+
|
|
1592
|
+
# Initialize the WhatsApp class
|
|
1593
|
+
ms_whatsapp = Mailersend::WhatsApp.new(ms_client)
|
|
1594
|
+
|
|
1595
|
+
ms_whatsapp.add_from('your-number')
|
|
1596
|
+
ms_whatsapp.add_to('recipient-number')
|
|
1597
|
+
ms_whatsapp.add_template_id('your-template-id')
|
|
1598
|
+
|
|
1599
|
+
ms_whatsapp.send
|
|
1600
|
+
```
|
|
1601
|
+
|
|
1602
|
+
### Send a WhatsApp message with personalization
|
|
1603
|
+
|
|
1604
|
+
```ruby
|
|
1605
|
+
require "mailersend-ruby"
|
|
1606
|
+
|
|
1607
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1608
|
+
|
|
1609
|
+
# Initialize the WhatsApp class
|
|
1610
|
+
ms_whatsapp = Mailersend::WhatsApp.new(ms_client)
|
|
1611
|
+
|
|
1612
|
+
ms_whatsapp.add_from('your-number')
|
|
1613
|
+
ms_whatsapp.add_to('recipient-number')
|
|
1614
|
+
ms_whatsapp.add_template_id('your-template-id')
|
|
1615
|
+
|
|
1616
|
+
personalization = {
|
|
1617
|
+
to: 'recipient-number',
|
|
1618
|
+
data: {
|
|
1619
|
+
header: ['John'],
|
|
1620
|
+
body: ['order #1234', 'tomorrow'],
|
|
1621
|
+
buttons: ['orders/1234']
|
|
1622
|
+
}
|
|
1623
|
+
}
|
|
1624
|
+
ms_whatsapp.add_personalization(personalization)
|
|
1625
|
+
|
|
1626
|
+
ms_whatsapp.send
|
|
1627
|
+
```
|
|
1628
|
+
|
|
1629
|
+
## WhatsApp Messages
|
|
1630
|
+
|
|
1631
|
+
### Get a list of WhatsApp messages
|
|
1632
|
+
|
|
1633
|
+
```ruby
|
|
1634
|
+
require "mailersend-ruby"
|
|
1635
|
+
|
|
1636
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1637
|
+
|
|
1638
|
+
# Intialize the WhatsApp Messages class
|
|
1639
|
+
ms_whatsapp_messages = Mailersend::WhatsAppMessages.new(ms_client)
|
|
1640
|
+
|
|
1641
|
+
# Add parameters
|
|
1642
|
+
ms_whatsapp_messages.list(
|
|
1643
|
+
whatsapp_account_id: 'your-whatsapp-account-id',
|
|
1644
|
+
from: '15550001234',
|
|
1645
|
+
template_id: 'your-template-id',
|
|
1646
|
+
date_from: 1791936000,
|
|
1647
|
+
date_to: 1792022400,
|
|
1648
|
+
page: 1,
|
|
1649
|
+
limit: 25
|
|
1650
|
+
)
|
|
1651
|
+
```
|
|
1652
|
+
|
|
1653
|
+
### Get a WhatsApp message
|
|
1654
|
+
|
|
1655
|
+
```ruby
|
|
1656
|
+
require "mailersend-ruby"
|
|
1657
|
+
|
|
1658
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1659
|
+
|
|
1660
|
+
# Intialize the WhatsApp Messages class
|
|
1661
|
+
ms_whatsapp_messages = Mailersend::WhatsAppMessages.new(ms_client)
|
|
1662
|
+
|
|
1663
|
+
# Add parameters
|
|
1664
|
+
ms_whatsapp_messages.get(whatsapp_message_id: 'your-whatsapp-message-id')
|
|
1665
|
+
```
|
|
1666
|
+
|
|
1667
|
+
## WhatsApp Items
|
|
1668
|
+
|
|
1669
|
+
### Get a list of WhatsApp items
|
|
1670
|
+
|
|
1671
|
+
```ruby
|
|
1672
|
+
require "mailersend-ruby"
|
|
1673
|
+
|
|
1674
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1675
|
+
|
|
1676
|
+
# Intialize the WhatsApp Items class
|
|
1677
|
+
ms_whatsapp_items = Mailersend::WhatsAppItems.new(ms_client)
|
|
1678
|
+
|
|
1679
|
+
# Add parameters
|
|
1680
|
+
ms_whatsapp_items.list(
|
|
1681
|
+
recipient: '48600000002',
|
|
1682
|
+
whatsapp_message_id: 'your-whatsapp-message-id',
|
|
1683
|
+
status: %w[delivered read],
|
|
1684
|
+
whatsapp_account_id: 'your-whatsapp-account-id',
|
|
1685
|
+
from: '15550001234',
|
|
1686
|
+
template_id: 'your-template-id',
|
|
1687
|
+
date_from: 1791936000,
|
|
1688
|
+
date_to: 1792022400,
|
|
1689
|
+
page: 1,
|
|
1690
|
+
limit: 25
|
|
1691
|
+
)
|
|
1692
|
+
```
|
|
1693
|
+
|
|
1694
|
+
### Get a WhatsApp item
|
|
1695
|
+
|
|
1696
|
+
```ruby
|
|
1697
|
+
require "mailersend-ruby"
|
|
1698
|
+
|
|
1699
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1700
|
+
|
|
1701
|
+
# Intialize the WhatsApp Items class
|
|
1702
|
+
ms_whatsapp_items = Mailersend::WhatsAppItems.new(ms_client)
|
|
1703
|
+
|
|
1704
|
+
# Add parameters
|
|
1705
|
+
ms_whatsapp_items.get(whatsapp_item_id: 'your-whatsapp-item-id')
|
|
1706
|
+
```
|
|
1707
|
+
|
|
1708
|
+
## WhatsApp Activities
|
|
1709
|
+
|
|
1710
|
+
### Get a list of WhatsApp activities
|
|
1711
|
+
|
|
1712
|
+
```ruby
|
|
1713
|
+
require "mailersend-ruby"
|
|
1714
|
+
|
|
1715
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1716
|
+
|
|
1717
|
+
# Intialize the WhatsApp Activities class
|
|
1718
|
+
ms_whatsapp_activities = Mailersend::WhatsAppActivities.new(ms_client)
|
|
1719
|
+
|
|
1720
|
+
# Add parameters
|
|
1721
|
+
ms_whatsapp_activities.list(
|
|
1722
|
+
whatsapp_item_id: 'your-whatsapp-item-id',
|
|
1723
|
+
whatsapp_message_id: 'your-whatsapp-message-id',
|
|
1724
|
+
recipient: '48600000001',
|
|
1725
|
+
type: %w[delivered read],
|
|
1726
|
+
date_from: 1791936000,
|
|
1727
|
+
date_to: 1792022400,
|
|
1728
|
+
page: 1,
|
|
1729
|
+
limit: 25
|
|
1730
|
+
)
|
|
1731
|
+
```
|
|
1732
|
+
|
|
1733
|
+
## WhatsApp Inbound Messages
|
|
1734
|
+
|
|
1735
|
+
### Get a list of WhatsApp inbound messages
|
|
1736
|
+
|
|
1737
|
+
```ruby
|
|
1738
|
+
require "mailersend-ruby"
|
|
1739
|
+
|
|
1740
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1741
|
+
|
|
1742
|
+
# Intialize the WhatsApp Inbound Messages class
|
|
1743
|
+
ms_whatsapp_inbound_messages = Mailersend::WhatsAppInboundMessages.new(ms_client)
|
|
1744
|
+
|
|
1745
|
+
# Add parameters
|
|
1746
|
+
ms_whatsapp_inbound_messages.list(
|
|
1747
|
+
whatsapp_account_id: 'your-whatsapp-account-id',
|
|
1748
|
+
from: '48600000001',
|
|
1749
|
+
type: %w[text image],
|
|
1750
|
+
date_from: 1791936000,
|
|
1751
|
+
date_to: 1792022400,
|
|
1752
|
+
page: 1,
|
|
1753
|
+
limit: 25
|
|
1754
|
+
)
|
|
1755
|
+
```
|
|
1756
|
+
|
|
1757
|
+
### Get a WhatsApp inbound message
|
|
1758
|
+
|
|
1759
|
+
```ruby
|
|
1760
|
+
require "mailersend-ruby"
|
|
1761
|
+
|
|
1762
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1763
|
+
|
|
1764
|
+
# Intialize the WhatsApp Inbound Messages class
|
|
1765
|
+
ms_whatsapp_inbound_messages = Mailersend::WhatsAppInboundMessages.new(ms_client)
|
|
1766
|
+
|
|
1767
|
+
# Add parameters
|
|
1768
|
+
ms_whatsapp_inbound_messages.get(whatsapp_inbound_message_id: 'your-whatsapp-inbound-message-id')
|
|
1769
|
+
```
|
|
1770
|
+
|
|
1771
|
+
## WhatsApp Recipients
|
|
1772
|
+
|
|
1773
|
+
### Get a list of WhatsApp recipients
|
|
1774
|
+
|
|
1775
|
+
```ruby
|
|
1776
|
+
require "mailersend-ruby"
|
|
1777
|
+
|
|
1778
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1779
|
+
|
|
1780
|
+
# Intialize the WhatsApp Recipient class
|
|
1781
|
+
ms_whatsapp_recipient = Mailersend::WhatsAppRecipient.new(ms_client)
|
|
1782
|
+
|
|
1783
|
+
# Add parameters
|
|
1784
|
+
ms_whatsapp_recipient.list(status: 'active', phone_number: '48600000001', page: 1, limit: 25)
|
|
1785
|
+
```
|
|
1786
|
+
|
|
1787
|
+
### Get a WhatsApp recipient
|
|
1788
|
+
|
|
1789
|
+
```ruby
|
|
1790
|
+
require "mailersend-ruby"
|
|
1791
|
+
|
|
1792
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1793
|
+
|
|
1794
|
+
# Intialize the WhatsApp Recipient class
|
|
1795
|
+
ms_whatsapp_recipient = Mailersend::WhatsAppRecipient.new(ms_client)
|
|
1796
|
+
|
|
1797
|
+
# Add parameters
|
|
1798
|
+
ms_whatsapp_recipient.get(whatsapp_recipient_id: 'your-whatsapp-recipient-id')
|
|
1799
|
+
```
|
|
1800
|
+
|
|
1801
|
+
## WhatsApp Templates
|
|
1802
|
+
|
|
1803
|
+
### Get a list of WhatsApp templates
|
|
1804
|
+
|
|
1805
|
+
```ruby
|
|
1806
|
+
require "mailersend-ruby"
|
|
1807
|
+
|
|
1808
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1809
|
+
|
|
1810
|
+
# Intialize the WhatsApp Templates class
|
|
1811
|
+
ms_whatsapp_templates = Mailersend::WhatsAppTemplates.new(ms_client)
|
|
1812
|
+
|
|
1813
|
+
# Add parameters
|
|
1814
|
+
ms_whatsapp_templates.list(
|
|
1815
|
+
whatsapp_account_id: 'your-whatsapp-account-id',
|
|
1816
|
+
status: 'approved',
|
|
1817
|
+
category: 'UTILITY',
|
|
1818
|
+
language: 'en_US',
|
|
1819
|
+
page: 1,
|
|
1820
|
+
limit: 25
|
|
1821
|
+
)
|
|
1822
|
+
```
|
|
1823
|
+
|
|
1824
|
+
### Get a WhatsApp template
|
|
1825
|
+
|
|
1826
|
+
```ruby
|
|
1827
|
+
require "mailersend-ruby"
|
|
1828
|
+
|
|
1829
|
+
ms_client = Mailersend::Client.new('your_mailersend_token')
|
|
1830
|
+
|
|
1831
|
+
# Intialize the WhatsApp Templates class
|
|
1832
|
+
ms_whatsapp_templates = Mailersend::WhatsAppTemplates.new(ms_client)
|
|
1833
|
+
|
|
1834
|
+
# Add parameters
|
|
1835
|
+
ms_whatsapp_templates.get(whatsapp_template_id: 'your-whatsapp-template-id')
|
|
1836
|
+
```
|
|
1837
|
+
|
|
1415
1838
|
## Other endpoints
|
|
1416
1839
|
|
|
1417
1840
|
### Get API quota
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: post
|
|
5
|
+
uri: https://api.mailersend.com/v1/email
|
|
6
|
+
body:
|
|
7
|
+
encoding: UTF-8
|
|
8
|
+
string: '{"from":{"email":"sender@test-sdk.com","name":"Sender"},"to":[{"email":"test@mailerlite.com","name":"Test"}],"subject":"Test
|
|
9
|
+
Email","template_id":"123abc","language":"de"}'
|
|
10
|
+
headers:
|
|
11
|
+
Authorization:
|
|
12
|
+
- "<AUTH>"
|
|
13
|
+
User-Agent:
|
|
14
|
+
- MailerSend-client-ruby/2.0.3
|
|
15
|
+
Accept:
|
|
16
|
+
- application/json
|
|
17
|
+
Connection:
|
|
18
|
+
- close
|
|
19
|
+
Content-Type:
|
|
20
|
+
- application/json; charset=utf-8
|
|
21
|
+
Host:
|
|
22
|
+
- api.mailersend.com
|
|
23
|
+
response:
|
|
24
|
+
status:
|
|
25
|
+
code: 202
|
|
26
|
+
message: Accepted
|
|
27
|
+
headers:
|
|
28
|
+
Date:
|
|
29
|
+
- Tue, 17 Dec 2024 14:04:19 GMT
|
|
30
|
+
Content-Type:
|
|
31
|
+
- text/html; charset=UTF-8
|
|
32
|
+
Transfer-Encoding:
|
|
33
|
+
- chunked
|
|
34
|
+
Connection:
|
|
35
|
+
- close
|
|
36
|
+
X-Message-Id:
|
|
37
|
+
- 676184e34aed90153c5efa6f
|
|
38
|
+
Cache-Control:
|
|
39
|
+
- no-cache, private
|
|
40
|
+
X-Apiquota-Remaining:
|
|
41
|
+
- "-1"
|
|
42
|
+
X-Apiquota-Reset:
|
|
43
|
+
- '2024-12-18T00:00:00Z'
|
|
44
|
+
Strict-Transport-Security:
|
|
45
|
+
- max-age=31536000; includeSubDomains
|
|
46
|
+
Cf-Cache-Status:
|
|
47
|
+
- DYNAMIC
|
|
48
|
+
Server:
|
|
49
|
+
- cloudflare
|
|
50
|
+
Cf-Ray:
|
|
51
|
+
- 8f37762bbd275b9a-VIE
|
|
52
|
+
body:
|
|
53
|
+
encoding: UTF-8
|
|
54
|
+
string: ''
|
|
55
|
+
recorded_at: Tue, 17 Dec 2024 14:04:19 GMT
|
|
56
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/emails?date_from=1756252800&date_to=1756339200&domain_id=jpzkmgq7e5vl059v&limit=10&page=1
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.2.0
|
|
14
|
+
Accept:
|
|
15
|
+
- application/json
|
|
16
|
+
Connection:
|
|
17
|
+
- close
|
|
18
|
+
Host:
|
|
19
|
+
- api.mailersend.com
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Content-Type:
|
|
26
|
+
- application/json
|
|
27
|
+
Cache-Control:
|
|
28
|
+
- no-cache, private
|
|
29
|
+
X-Apiquota-Remaining:
|
|
30
|
+
- "-1"
|
|
31
|
+
body:
|
|
32
|
+
encoding: UTF-8
|
|
33
|
+
string: '{"data":[{"id":"6a8fa9b1902fab56e0ce50dd","from":"sender@example.com","to":"rcpt@example.org","subject":"Welcome","text":null,"html":null,"template_id":"7nxe3yjmeq28vp0k","domain_id":"7nxe3yjmeq28vp0k","message_id":"6a8fa9b1902fab56e0ce50aa","status":"sent","tags":["newsletter"],"interaction":["opened"],"suppression_reason":null,"created_at":"2026-08-27T16:48:42.000000Z","updated_at":"2026-08-27T16:48:42.000000Z","headers":[{"name":"X-Custom","value":"foo"}]}],"links":{"first":"https://api.mailersend.com/v1/emails?page=1","last":null,"prev":null,"next":null},"meta":{"current_page":1,"current_page_url":"https://api.mailersend.com/v1/emails?page=1","from":1,"path":"https://api.mailersend.com/v1/emails","per_page":10,"to":3}}'
|
|
34
|
+
recorded_at: Thu, 27 Aug 2026 16:48:42 GMT
|
|
35
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/emails?date_from=1756252800&date_to=1756339200&domain_id=jpzkmgq7e5vl059v&limit=10&page=2
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.2.0
|
|
14
|
+
Accept:
|
|
15
|
+
- application/json
|
|
16
|
+
Connection:
|
|
17
|
+
- close
|
|
18
|
+
Host:
|
|
19
|
+
- api.mailersend.com
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Content-Type:
|
|
26
|
+
- application/json
|
|
27
|
+
Cache-Control:
|
|
28
|
+
- no-cache, private
|
|
29
|
+
X-Apiquota-Remaining:
|
|
30
|
+
- "-1"
|
|
31
|
+
body:
|
|
32
|
+
encoding: UTF-8
|
|
33
|
+
string: '{"data":[],"links":{"first":"https://api.mailersend.com/v1/emails?page=1","last":null,"prev":"https://api.mailersend.com/v1/emails?page=1","next":null},"meta":{"current_page":2,"current_page_url":"https://api.mailersend.com/v1/emails?page=2","from":null,"path":"https://api.mailersend.com/v1/emails","per_page":10,"to":null}}'
|
|
34
|
+
recorded_at: Thu, 27 Aug 2026 16:48:42 GMT
|
|
35
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/email/6a8fa9b1902fab56e0ce50dd
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.2.0
|
|
14
|
+
Accept:
|
|
15
|
+
- application/json
|
|
16
|
+
Connection:
|
|
17
|
+
- close
|
|
18
|
+
Host:
|
|
19
|
+
- api.mailersend.com
|
|
20
|
+
response:
|
|
21
|
+
status:
|
|
22
|
+
code: 200
|
|
23
|
+
message: OK
|
|
24
|
+
headers:
|
|
25
|
+
Content-Type:
|
|
26
|
+
- application/json
|
|
27
|
+
Cache-Control:
|
|
28
|
+
- no-cache, private
|
|
29
|
+
X-Apiquota-Remaining:
|
|
30
|
+
- "-1"
|
|
31
|
+
body:
|
|
32
|
+
encoding: UTF-8
|
|
33
|
+
string: '{"data":{"id":"6a8fa9b1902fab56e0ce50dd","from":"sender@example.com","to":"rcpt@example.org","subject":"Welcome","text":"Welcome aboard.","html":"<p>Welcome aboard.</p>","template_id":"7nxe3yjmeq28vp0k","domain_id":"7nxe3yjmeq28vp0k","message_id":"6a8fa9b1902fab56e0ce50aa","status":"sent","tags":["newsletter"],"interaction":["opened"],"suppression_reason":null,"created_at":"2026-08-27T16:48:42.000000Z","updated_at":"2026-08-27T16:48:42.000000Z","headers":[{"name":"X-Custom","value":"foo"}],"recipient":{"id":"6a8fa9b1902fab56e0ce50ee","email":"rcpt@example.org","created_at":"2026-08-27T16:48:42.000000Z","updated_at":"2026-08-27T16:48:42.000000Z","deleted_at":null},"activity":[{"id":"6a8fa9b1902fab56e0ce50f3","type":"opened","created_at":"2026-08-27T16:48:57.000000Z"},{"id":"6a8fa9b1902fab56e0ce50f2","type":"delivered","created_at":"2026-08-27T16:48:47.000000Z"},{"id":"6a8fa9b1902fab56e0ce50f1","type":"sent","created_at":"2026-08-27T16:48:42.000000Z"}]}}'
|
|
34
|
+
recorded_at: Thu, 27 Aug 2026 16:48:42 GMT
|
|
35
|
+
recorded_with: VCR 6.3.1
|