mailersend-ruby 3.0.1 → 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 +12 -0
- data/README.md +534 -0
- data/fixtures/dmarc_monitoring/add_favorite.yml +31 -0
- data/fixtures/dmarc_monitoring/create.yml +34 -0
- data/fixtures/dmarc_monitoring/delete.yml +31 -0
- data/fixtures/dmarc_monitoring/list.yml +32 -0
- data/fixtures/dmarc_monitoring/remove_favorite.yml +31 -0
- data/fixtures/dmarc_monitoring/report.yml +31 -0
- data/fixtures/dmarc_monitoring/report_by_ip.yml +31 -0
- data/fixtures/dmarc_monitoring/report_sources.yml +31 -0
- data/fixtures/dmarc_monitoring/update.yml +34 -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/dmarc_monitoring/dmarc_monitoring.rb +59 -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 +9 -0
- data/spec/dmarc_monitoring_rspec.rb +100 -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 +52 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/inbound-messages?date_from=1790000000&date_to=1790086400&from=48600000001&limit=25&page=1&type%5B%5D=image&type%5B%5D=text&whatsapp_account_id=3enl6x27wmrxrl2v
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":[{"id":"62f114f7165fe0d8db0288e2","whatsapp_account_id":"3enl6x27wmrxrl2v","from":"48600000001","to":"15550001234","type":"text","received_at":"2026-10-14T12:41:19.000000Z","meta":{"body":"Hello, I would like to check my order status."},"context":{"message_id":"wamid.HBgLMzcwNjMzMjI3OTcVAgARGBIwREE3N0EwN0EyNjhENjEwOEMA"}},{"id":"62f114c1165fe0d8db0288d9","whatsapp_account_id":"3enl6x27wmrxrl2v","from":"48600000001","to":"15550001234","type":"image","received_at":"2026-10-14T12:38:03.000000Z","meta":{"url":"https://app.mailersend.com/whatsapp/inbound-message-attachment/62f114c1165fe0d8db0288d9?account=3enl6x27wmrxrl2v&expires=1792022400&signature=...","status":"stored","mime_type":"image/jpeg","size":102400,"caption":"Here is the damaged item"}}],"links":{"first":"https://api.mailersend.com/v1/whatsapp/inbound-messages?page=1","last":null,"prev":null,"next":null},"meta":{"current_page":1,"current_page_url":"https://api.mailersend.com/v1/whatsapp/inbound-messages?page=1","from":1,"path":"https://api.mailersend.com/v1/whatsapp/inbound-messages","per_page":25,"to":2}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/items/67f91abe2202f3705540234a
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":{"id":"67f91abe2202f3705540234a","whatsapp_message_id":"67f91abd69f79df391e9d78d","whatsapp_account_id":"3enl6x27wmrxrl2v","from":"15550001234","to":"48600000001","status":"read","template_id":"23zxk54v6gjy6v7m","template_name":"Order confirmation","error_code":null,"error_message":null,"created_at":"2026-10-14T12:25:33.000000Z","recipient":{"id":"67f91abe2202f37055402301","phone_number":"48600000001","username":null,"status":"active","created_at":"2026-09-02T08:14:51.000000Z"},"activity":[{"type":"queued","created_at":"2026-10-14T12:25:33.000000Z"},{"type":"sent","created_at":"2026-10-14T12:25:34.000000Z"},{"type":"delivered","created_at":"2026-10-14T12:25:36.000000Z"},{"type":"read","created_at":"2026-10-14T12:31:02.000000Z"}]}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/items?date_from=1791936000&date_to=1792022400&from=15550001234&limit=25&page=1&recipient=48600000002&status%5B%5D=failed&status%5B%5D=read&template_id=23zxk54v6gjy6v7m&whatsapp_account_id=3enl6x27wmrxrl2v&whatsapp_message_id=67f91abd69f79df391e9d78d
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":[{"id":"67f91abe2202f3705540234b","whatsapp_message_id":"67f91abd69f79df391e9d78d","whatsapp_account_id":"3enl6x27wmrxrl2v","from":"15550001234","to":"48600000002","status":"failed","template_id":"23zxk54v6gjy6v7m","template_name":"Order confirmation","error_code":131026,"error_message":"Message undeliverable","created_at":"2026-10-14T12:25:33.000000Z"}],"links":{"first":"https://api.mailersend.com/v1/whatsapp/items?page=1","last":null,"prev":null,"next":null},"meta":{"current_page":1,"current_page_url":"https://api.mailersend.com/v1/whatsapp/items?page=1","from":1,"path":"https://api.mailersend.com/v1/whatsapp/items","per_page":25,"to":1}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/messages/67f91abd69f79df391e9d78d
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":{"id":"67f91abd69f79df391e9d78d","from":"15550001234","to":["48600000001","48600000002"],"whatsapp_account_id":"3enl6x27wmrxrl2v","template_id":"23zxk54v6gjy6v7m","created_at":"2026-10-14T12:25:33.000000Z","items":[{"id":"67f91abe2202f3705540234a","whatsapp_message_id":"67f91abd69f79df391e9d78d","whatsapp_account_id":"3enl6x27wmrxrl2v","from":"15550001234","to":"48600000001","status":"read","template_id":"23zxk54v6gjy6v7m","template_name":"Order confirmation","error_code":null,"error_message":null,"created_at":"2026-10-14T12:25:33.000000Z"},{"id":"67f91abe2202f3705540234b","whatsapp_message_id":"67f91abd69f79df391e9d78d","whatsapp_account_id":"3enl6x27wmrxrl2v","from":"15550001234","to":"48600000002","status":"failed","template_id":"23zxk54v6gjy6v7m","template_name":"Order confirmation","error_code":131026,"error_message":"Message undeliverable","created_at":"2026-10-14T12:25:33.000000Z"}]}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/messages?date_from=1791936000&date_to=1792022400&from=15550001234&limit=25&page=1&template_id=23zxk54v6gjy6v7m&whatsapp_account_id=3enl6x27wmrxrl2v
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":[{"id":"67f91abd69f79df391e9d78d","from":"15550001234","to":["48600000001","48600000002"],"whatsapp_account_id":"3enl6x27wmrxrl2v","template_id":"23zxk54v6gjy6v7m","created_at":"2026-10-14T12:25:33.000000Z"},{"id":"67f91a0c69f79df391e9d6a1","from":null,"to":["US.13491208655302741918"],"whatsapp_account_id":"p6nq4jyzkyv5x3zl","template_id":"6v7m23zxk54vgjy2","created_at":"2026-10-14T12:21:16.000000Z"}],"links":{"first":"https://api.mailersend.com/v1/whatsapp/messages?page=1","last":null,"prev":null,"next":null},"meta":{"current_page":1,"current_page_url":"https://api.mailersend.com/v1/whatsapp/messages?page=1","from":1,"path":"https://api.mailersend.com/v1/whatsapp/messages","per_page":25,"to":2}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/recipients/67f91abe2202f37055402301
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":{"id":"67f91abe2202f37055402301","phone_number":"48600000001","username":null,"status":"active","created_at":"2026-09-02T08:14:51.000000Z","items":[{"id":"67f91abe2202f3705540234a","whatsapp_message_id":"67f91abd69f79df391e9d78d","whatsapp_account_id":"3enl6x27wmrxrl2v","from":"15550001234","to":"48600000001","status":"read","template_id":"23zxk54v6gjy6v7m","template_name":"Order confirmation","error_code":null,"error_message":null,"created_at":"2026-10-14T12:25:33.000000Z"}]}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/recipients?limit=25&page=1&phone_number=48600000001&status=active
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":[{"id":"67f91abe2202f37055402301","phone_number":"48600000001","username":null,"status":"active","created_at":"2026-09-02T08:14:51.000000Z"}],"links":{"first":"https://api.mailersend.com/v1/whatsapp/recipients?page=1","last":null,"prev":null,"next":null},"meta":{"current_page":1,"current_page_url":"https://api.mailersend.com/v1/whatsapp/recipients?page=1","from":1,"path":"https://api.mailersend.com/v1/whatsapp/recipients","per_page":25,"to":1}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/templates/23zxk54v6gjy6v7m
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":{"id":"23zxk54v6gjy6v7m","whatsapp_account_id":"3enl6x27wmrxrl2v","name":"order_confirmation","readable_name":"Order confirmation","category":"UTILITY","language":"en_US","status":"approved","components":{"header":{"format":"TEXT","text":"{{1}}"},"body":{"text":"Hi {{1}}, your order is confirmed and will arrive on {{2}}."},"buttons":[{"type":"URL","text":"View order","url":"https://shop.example.com/{{1}}"}]},"created_at":"2026-10-14T12:25:33.000000Z","updated_at":"2026-10-14T12:41:07.000000Z"}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
http_interactions:
|
|
3
|
+
- request:
|
|
4
|
+
method: get
|
|
5
|
+
uri: https://api.mailersend.com/v1/whatsapp/templates?category=UTILITY&language=en_US&limit=25&page=1&status=approved&whatsapp_account_id=3enl6x27wmrxrl2v
|
|
6
|
+
body:
|
|
7
|
+
encoding: ASCII-8BIT
|
|
8
|
+
string: ''
|
|
9
|
+
headers:
|
|
10
|
+
Authorization:
|
|
11
|
+
- "<AUTH>"
|
|
12
|
+
User-Agent:
|
|
13
|
+
- MailerSend-client-ruby/3.4.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
|
+
Date:
|
|
26
|
+
- Tue, 20 Oct 2026 08:00:00 GMT
|
|
27
|
+
Content-Type:
|
|
28
|
+
- application/json
|
|
29
|
+
Transfer-Encoding:
|
|
30
|
+
- chunked
|
|
31
|
+
Connection:
|
|
32
|
+
- close
|
|
33
|
+
Cache-Control:
|
|
34
|
+
- no-cache, private
|
|
35
|
+
Strict-Transport-Security:
|
|
36
|
+
- max-age=31536000; includeSubDomains
|
|
37
|
+
Server:
|
|
38
|
+
- cloudflare
|
|
39
|
+
body:
|
|
40
|
+
encoding: UTF-8
|
|
41
|
+
string: '{"data":[{"id":"23zxk54v6gjy6v7m","whatsapp_account_id":"3enl6x27wmrxrl2v","name":"order_confirmation","readable_name":"Order confirmation","category":"UTILITY","language":"en_US","status":"approved","components":{"header":{"format":"TEXT","text":"{{1}}"},"body":{"text":"Hi {{1}}, your order is confirmed and will arrive on {{2}}."},"buttons":[{"type":"URL","text":"View order","url":"https://shop.example.com/{{1}}"}]},"created_at":"2026-10-14T12:25:33.000000Z","updated_at":"2026-10-14T12:41:07.000000Z"},{"id":"p6nq4jyzkyv5x3zl","whatsapp_account_id":"3enl6x27wmrxrl2v","name":"delivery_update","readable_name":"Delivery update","category":"UTILITY","language":"en_US","status":"approved","components":{"header":null,"body":{"text":"Your parcel is out for delivery today."},"buttons":[{"type":"QUICK_REPLY","text":"Change delivery time","url":null}]},"created_at":"2026-10-13T09:02:18.000000Z","updated_at":"2026-10-13T09:02:18.000000Z"}],"links":{"first":"https://api.mailersend.com/v1/whatsapp/templates?page=1","last":null,"prev":null,"next":null},"meta":{"current_page":1,"current_page_url":"https://api.mailersend.com/v1/whatsapp/templates?page=1","from":1,"path":"https://api.mailersend.com/v1/whatsapp/templates","per_page":25,"to":2}}'
|
|
42
|
+
recorded_at: Tue, 20 Oct 2026 08:00:00 GMT
|
|
43
|
+
recorded_with: VCR 6.3.1
|
data/flake.lock
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"nodes": {
|
|
3
|
+
"nixpkgs": {
|
|
4
|
+
"locked": {
|
|
5
|
+
"lastModified": 1789546076,
|
|
6
|
+
"narHash": "sha256-zVxLZiSnmaaPLwnhj7pwmqe3axBg/C6nG5JZsJMh2g4=",
|
|
7
|
+
"owner": "NixOS",
|
|
8
|
+
"repo": "nixpkgs",
|
|
9
|
+
"rev": "b1b875982b17dabde9b4a37f3e229e74913e6db3",
|
|
10
|
+
"type": "github"
|
|
11
|
+
},
|
|
12
|
+
"original": {
|
|
13
|
+
"owner": "NixOS",
|
|
14
|
+
"ref": "nixos-unstable",
|
|
15
|
+
"repo": "nixpkgs",
|
|
16
|
+
"type": "github"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"root": {
|
|
20
|
+
"inputs": {
|
|
21
|
+
"nixpkgs": "nixpkgs"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"root": "root",
|
|
26
|
+
"version": 7
|
|
27
|
+
}
|
data/flake.nix
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
description = "MailerSend Ruby SDK environment";
|
|
3
|
+
|
|
4
|
+
inputs = {
|
|
5
|
+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
outputs = { self, nixpkgs }:
|
|
9
|
+
let
|
|
10
|
+
systems = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ];
|
|
11
|
+
forEachSystem = f:
|
|
12
|
+
nixpkgs.lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system});
|
|
13
|
+
in
|
|
14
|
+
{
|
|
15
|
+
devShells = forEachSystem (system: pkgs: {
|
|
16
|
+
default = pkgs.mkShell {
|
|
17
|
+
packages = with pkgs; [
|
|
18
|
+
lefthook
|
|
19
|
+
gitleaks
|
|
20
|
+
git-secrets
|
|
21
|
+
];
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
}
|
data/lefthook.yml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
pre-commit:
|
|
3
|
+
commands:
|
|
4
|
+
gitleaks:
|
|
5
|
+
run: gitleaks git --pre-commit --redact --staged --verbose --no-banner
|
|
6
|
+
fail_text: Staged changes contain a secret. Remove it; never commit and revert.
|
|
7
|
+
secrets:
|
|
8
|
+
run: |
|
|
9
|
+
git secrets --list | grep -q 'mssp' || {
|
|
10
|
+
git secrets --register-aws
|
|
11
|
+
git secrets --add 'mlsn\.[A-Za-z0-9._-]+'
|
|
12
|
+
git secrets --add 'mssp\.[A-Za-z0-9._-]+'
|
|
13
|
+
}
|
|
14
|
+
git secrets --scan {staged_files}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# DMARC Monitoring endpoint from MailerSend API.
|
|
5
|
+
class DmarcMonitoring
|
|
6
|
+
attr_accessor :client, :monitor_id, :ip, :page, :limit
|
|
7
|
+
|
|
8
|
+
def initialize(client = Mailersend::Client.new)
|
|
9
|
+
@client = client
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def list(page: nil, limit: nil)
|
|
13
|
+
hash = { 'page' => page, 'limit' => limit }
|
|
14
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST,
|
|
15
|
+
path: '/v1/dmarc-monitoring',
|
|
16
|
+
query: URI.encode_www_form(hash.compact)))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create(domain_id:)
|
|
20
|
+
client.http.post("#{MAILERSEND_API_URL}/dmarc-monitoring",
|
|
21
|
+
json: { 'domain_id' => domain_id })
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def update(monitor_id:, wanted_dmarc_record:)
|
|
25
|
+
client.http.put("#{MAILERSEND_API_URL}/dmarc-monitoring/#{monitor_id}",
|
|
26
|
+
json: { 'wanted_dmarc_record' => wanted_dmarc_record })
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def delete(monitor_id:)
|
|
30
|
+
client.http.delete("#{MAILERSEND_API_URL}/dmarc-monitoring/#{monitor_id}")
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def report(monitor_id:, page: nil, limit: nil)
|
|
34
|
+
hash = { 'page' => page, 'limit' => limit }
|
|
35
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST,
|
|
36
|
+
path: "/v1/dmarc-monitoring/#{monitor_id}/report",
|
|
37
|
+
query: URI.encode_www_form(hash.compact)))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def report_by_ip(monitor_id:, ip:, page: nil, limit: nil)
|
|
41
|
+
hash = { 'page' => page, 'limit' => limit }
|
|
42
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST,
|
|
43
|
+
path: "/v1/dmarc-monitoring/#{monitor_id}/report/#{ip}",
|
|
44
|
+
query: URI.encode_www_form(hash.compact)))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def report_sources(monitor_id:)
|
|
48
|
+
client.http.get("#{MAILERSEND_API_URL}/dmarc-monitoring/#{monitor_id}/report-sources")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def add_favorite(monitor_id:, ip:)
|
|
52
|
+
client.http.put("#{MAILERSEND_API_URL}/dmarc-monitoring/#{monitor_id}/favorite/#{ip}")
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def remove_favorite(monitor_id:, ip:)
|
|
56
|
+
client.http.delete("#{MAILERSEND_API_URL}/dmarc-monitoring/#{monitor_id}/favorite/#{ip}")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -16,6 +16,7 @@ module Mailersend
|
|
|
16
16
|
:reply_to,
|
|
17
17
|
:attachments,
|
|
18
18
|
:template_id,
|
|
19
|
+
:language,
|
|
19
20
|
:tags,
|
|
20
21
|
:variables,
|
|
21
22
|
:personalization,
|
|
@@ -40,6 +41,7 @@ module Mailersend
|
|
|
40
41
|
@headers = {}
|
|
41
42
|
@list_unsubscribe = nil
|
|
42
43
|
@send_at = send_at
|
|
44
|
+
@language = nil
|
|
43
45
|
end
|
|
44
46
|
|
|
45
47
|
def add_recipients(recipients)
|
|
@@ -86,6 +88,13 @@ module Mailersend
|
|
|
86
88
|
@template_id = template_id
|
|
87
89
|
end
|
|
88
90
|
|
|
91
|
+
# Language code (e.g. 'de', 'fr', 'pt-BR'). Only meaningful when a
|
|
92
|
+
# template_id is set; ignored for raw html/text sends. Max length 10.
|
|
93
|
+
# Supported: de, en, es, fr, it, lt, nl, pl, pt-BR
|
|
94
|
+
def add_language(language)
|
|
95
|
+
@language = language
|
|
96
|
+
end
|
|
97
|
+
|
|
89
98
|
def add_tags(tags)
|
|
90
99
|
@tags << tags
|
|
91
100
|
end
|
|
@@ -131,6 +140,7 @@ module Mailersend
|
|
|
131
140
|
'variables' => @variables,
|
|
132
141
|
'personalization' => @personalization,
|
|
133
142
|
'template_id' => @template_id,
|
|
143
|
+
'language' => @language,
|
|
134
144
|
'attachments' => @attachments,
|
|
135
145
|
'headers' => @headers,
|
|
136
146
|
'list_unsubscribe' => @list_unsubscribe,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# Emails endpoint from MailerSend API.
|
|
5
|
+
class Emails
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:domain_id,
|
|
8
|
+
:date_from,
|
|
9
|
+
:date_to,
|
|
10
|
+
:limit,
|
|
11
|
+
:page,
|
|
12
|
+
:email_id
|
|
13
|
+
|
|
14
|
+
def initialize(client = Mailersend::Client.new)
|
|
15
|
+
@client = client
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def list(domain_id:, date_from:, date_to:, limit: nil, page: nil, status: nil, interaction: nil,
|
|
19
|
+
recipient_email: nil, message_id: nil, template_id: nil, subject: nil, tag: nil)
|
|
20
|
+
hash = {
|
|
21
|
+
'domain_id' => domain_id,
|
|
22
|
+
'date_from' => date_from,
|
|
23
|
+
'date_to' => date_to,
|
|
24
|
+
'limit' => limit,
|
|
25
|
+
'page' => page,
|
|
26
|
+
# The API rejects a scalar status/interaction with 422, so they are always sent in array form.
|
|
27
|
+
'status[]' => status,
|
|
28
|
+
'interaction[]' => interaction,
|
|
29
|
+
'recipient_email' => recipient_email,
|
|
30
|
+
'message_id' => message_id,
|
|
31
|
+
'template_id' => template_id,
|
|
32
|
+
'subject' => subject,
|
|
33
|
+
'tag' => tag
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
client.http.get(URI::HTTPS.build(host: MAILERSEND_API_BASE_HOST, path: '/v1/emails',
|
|
37
|
+
query: URI.encode_www_form(hash.compact)))
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def single(email_id:)
|
|
41
|
+
client.http.get("#{MAILERSEND_API_URL}/email/#{email_id}")
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
data/lib/mailersend/version.rb
CHANGED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Mailersend
|
|
4
|
+
# Send a WhatsApp message through MailerSend API
|
|
5
|
+
class WhatsApp
|
|
6
|
+
attr_accessor :client,
|
|
7
|
+
:from,
|
|
8
|
+
:to,
|
|
9
|
+
:template_id,
|
|
10
|
+
:personalization
|
|
11
|
+
|
|
12
|
+
def initialize(client = Mailersend::Client.new)
|
|
13
|
+
@client = client
|
|
14
|
+
@from = ''
|
|
15
|
+
@to = []
|
|
16
|
+
@template_id = ''
|
|
17
|
+
@personalization = []
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def add_from(from)
|
|
21
|
+
@from = from
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def add_to(to)
|
|
25
|
+
@to << to
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def add_template_id(template_id)
|
|
29
|
+
@template_id = template_id
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def add_personalization(personalization)
|
|
33
|
+
@personalization << personalization
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def send
|
|
37
|
+
message = {
|
|
38
|
+
'from' => @from,
|
|
39
|
+
'to' => @to,
|
|
40
|
+
'template_id' => @template_id,
|
|
41
|
+
'personalization' => @personalization
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
client.http.post("#{MAILERSEND_API_URL}/whatsapp/send", json: message.delete_if { |_, value| value.to_s.strip == '' || value == [] || value == {} })
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|