mailersend-ruby 3.1.0 → 3.4.1

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.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.envrc +2 -0
  3. data/.github/workflows/main.yml +1 -1
  4. data/.github/workflows/publish_gem.yml +17 -14
  5. data/.gitignore +2 -1
  6. data/.vesnik.yaml +36 -0
  7. data/README.md +423 -0
  8. data/fixtures/email/email_send_template_language.yml +56 -0
  9. data/fixtures/emails/emails_list_emails.yml +35 -0
  10. data/fixtures/emails/emails_list_emails_empty_page.yml +35 -0
  11. data/fixtures/emails/emails_single_email.yml +35 -0
  12. data/fixtures/whatsapp/whatsapp_send.yml +47 -0
  13. data/fixtures/whatsapp/whatsapp_send_multiple_recipients.yml +47 -0
  14. data/fixtures/whatsapp/whatsapp_send_personalization.yml +47 -0
  15. data/fixtures/whatsapp_activities/whatsapp_activities_list.yml +43 -0
  16. data/fixtures/whatsapp_inbound_messages/whatsapp_inbound_messages_get.yml +43 -0
  17. data/fixtures/whatsapp_inbound_messages/whatsapp_inbound_messages_list.yml +43 -0
  18. data/fixtures/whatsapp_items/whatsapp_items_get.yml +43 -0
  19. data/fixtures/whatsapp_items/whatsapp_items_list.yml +43 -0
  20. data/fixtures/whatsapp_messages/whatsapp_messages_get.yml +43 -0
  21. data/fixtures/whatsapp_messages/whatsapp_messages_list.yml +43 -0
  22. data/fixtures/whatsapp_recipient/whatsapp_recipient_get.yml +43 -0
  23. data/fixtures/whatsapp_recipient/whatsapp_recipient_list.yml +43 -0
  24. data/fixtures/whatsapp_templates/whatsapp_templates_get.yml +43 -0
  25. data/fixtures/whatsapp_templates/whatsapp_templates_list.yml +43 -0
  26. data/flake.lock +49 -0
  27. data/flake.nix +31 -0
  28. data/justfile +56 -0
  29. data/lefthook.yml +14 -0
  30. data/lib/mailersend/email/email.rb +10 -0
  31. data/lib/mailersend/emails/emails.rb +44 -0
  32. data/lib/mailersend/version.rb +1 -1
  33. data/lib/mailersend/whatsapp/whatsapp.rb +47 -0
  34. data/lib/mailersend/whatsapp_activities/whatsapp_activities.rb +45 -0
  35. data/lib/mailersend/whatsapp_inbound_messages/whatsapp_inbound_messages.rb +47 -0
  36. data/lib/mailersend/whatsapp_items/whatsapp_items.rb +57 -0
  37. data/lib/mailersend/whatsapp_messages/whatsapp_messages.rb +47 -0
  38. data/lib/mailersend/whatsapp_recipient/whatsapp_recipient.rb +38 -0
  39. data/lib/mailersend/whatsapp_templates/whatsapp_templates.rb +44 -0
  40. data/lib/mailersend.rb +8 -0
  41. data/mailersend-ruby.gemspec +1 -1
  42. data/spec/email_rspec.rb +15 -0
  43. data/spec/emails_rspec.rb +175 -0
  44. data/spec/whatsapp_activities_rspec.rb +38 -0
  45. data/spec/whatsapp_inbound_messages_rspec.rb +49 -0
  46. data/spec/whatsapp_items_rspec.rb +52 -0
  47. data/spec/whatsapp_messages_rspec.rb +50 -0
  48. data/spec/whatsapp_recipient_rspec.rb +40 -0
  49. data/spec/whatsapp_rspec.rb +65 -0
  50. data/spec/whatsapp_templates_rspec.rb +48 -0
  51. metadata +47 -5
  52. data/CHANGELOG.md +0 -148
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b3bfbc4f6cab77294426741f5420ade91c52721573bd3885d384ccbcceb9045
4
- data.tar.gz: e9c86c9b59c128fb303c7a28c39282d17b4c14f27c1503ed8495098e16387b45
3
+ metadata.gz: d80a4f04c6fdc2a39fa4e9b6ba6f42b31229daac33f4ac1bbf362c198dbdb495
4
+ data.tar.gz: fea73fe8d50140bd1095e6416064b7e8b31cd4205a46ac1d8abe657016036ee7
5
5
  SHA512:
6
- metadata.gz: 24128c89d8b0206843c001f438c6258acb29a9319ffa63819c7d4390040efb9b344402442af1379dad411e16724abe3f021eb4b1029e2607a26026cfb87cd24e
7
- data.tar.gz: 05652e0beb32b924ad15e2c3f251ac3b5659853172d1bdafa35c8ad4d01d0e558b4c06744285bd5a7830ff51fdc388706a5dd3013dbfd846d6471606ad90886d
6
+ metadata.gz: 2716b87b3467a04f3e120cba0295df5271ab895956c576c81271657de33d16b275aca8c279857c3a553f2a1b6275cddff8c941dc196e8ee04e8912df7c562d7e
7
+ data.tar.gz: e36d6819740ff2123c7096f1f650f2300a3a8bb99240c36cd9161d809a23fdb0dcd595b3e5b9aa793a56a0d24b937431e4441c8c2c4f1dc57a8993415e9b63aa
data/.envrc ADDED
@@ -0,0 +1,2 @@
1
+ use flake
2
+ lefthook install >/dev/null
@@ -6,7 +6,7 @@ jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
8
  steps:
9
- - uses: actions/checkout@v6
9
+ - uses: actions/checkout@v7
10
10
 
11
11
  - name: Set up Ruby
12
12
  uses: ruby/setup-ruby@v1
@@ -3,30 +3,33 @@ name: Publish Gem
3
3
  on:
4
4
  push:
5
5
  tags:
6
- - v*
6
+ - "v*"
7
7
  jobs:
8
8
  build:
9
9
  runs-on: ubuntu-latest
10
10
 
11
11
  steps:
12
- - uses: actions/checkout@v6
12
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
13
13
 
14
14
  - name: Set up Ruby
15
15
  uses: ruby/setup-ruby@v1
16
16
  with:
17
17
  ruby-version: 3.1
18
18
 
19
- - name: Install Bundler
20
- run: gem install bundler -v 2.5.23
19
+ # The tag is the only source of the version; version.rb holds a placeholder.
20
+ - name: Set the version from the tag
21
+ run: |
22
+ if ! [[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.]+)?$ ]]; then
23
+ echo "::error::$GITHUB_REF_NAME is not a version tag such as v1.2.3"
24
+ exit 1
25
+ fi
26
+ VERSION="${GITHUB_REF_NAME#v}"
27
+ sed -i "s/VERSION = '.*'/VERSION = '${VERSION}'/" lib/mailersend/version.rb
28
+ ruby -Ilib -e 'require "mailersend/version"; abort "version.rb was not updated" unless Mailersend::VERSION == ARGV[0]' "$VERSION"
21
29
 
22
- - name: Install dependencies
23
- run: bundle _2.5.23_ install
24
-
25
- - name: Release Gem
26
- if: contains(github.ref, 'refs/tags/v')
27
- uses: cadwallion/publish-rubygems-action@master
30
+ - name: Publish to RubyGems
31
+ run: |
32
+ gem build mailersend-ruby.gemspec
33
+ gem push mailersend-ruby-*.gem
28
34
  env:
29
- GITHUB_TOKEN: ${{secrets.GITHUBTOKEN}}
30
- RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
31
- RELEASE_COMMAND: rake release
32
-
35
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
data/.gitignore CHANGED
@@ -9,4 +9,5 @@
9
9
  .env
10
10
  .idea
11
11
  Gemfile.lock
12
- .DS_Store
12
+ .DS_Store
13
+ .direnv
data/.vesnik.yaml ADDED
@@ -0,0 +1,36 @@
1
+ # vesnik tags releases and writes the GitHub Release notes for `just release` and
2
+ # `just hotfix-release`: https://github.com/nklmilojevic/vesnik
3
+ #
4
+ # The tag is the only source of the version. vesnik never commits: the publish
5
+ # workflow writes the version from the tag into version.rb before it pushes the gem.
6
+
7
+ provider: claude
8
+ model: claude-haiku-5-5
9
+
10
+ # The SDK is public. GitHub's generated notes copy PR titles, which carry internal
11
+ # ticket keys, so a release without the model stops instead of using them.
12
+ ai:
13
+ on_error: fail
14
+
15
+ style:
16
+ preset: ste100
17
+ product: "MailerSend Ruby SDK (gem mailersend-ruby) for the MailerSend API; release notes are read by developers who use the SDK."
18
+ rules:
19
+ - "Never write ticket keys such as MSD-15283 or SRE-76231, branch names, or names of internal tools and processes."
20
+ - "Describe each change by what it adds, changes or fixes for developers who use the SDK, such as the endpoint, method or option."
21
+ - "Leave out merge commits, Renovate dependency updates (\"chore(deps): ...\"), and version bump commits unless they change behavior."
22
+ - "Leave out reverted changes, and \"Fix\", \"Nits\" or \"update docs\" commits unless they change behavior."
23
+
24
+ github:
25
+ append_generated_notes: false
26
+
27
+ changelog:
28
+ enabled: false
29
+
30
+ branch: main
31
+
32
+ breaking_bumps_minor: true
33
+
34
+ packages:
35
+ - path: .
36
+ ecosystem: none
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