Skip to content

Commit

Permalink
Support custom headers (nylas#474)
Browse files Browse the repository at this point in the history
Support sending a message with customer headers, on the /send endpoint, according to the documentation: https://developer.nylas.com/docs/api/v2/#post-/send
  • Loading branch information
axfcampos authored Apr 5, 2024
1 parent 5561ab7 commit fff90dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions lib/nylas/new_message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ class NewMessage

attribute :tracking, :message_tracking

has_n_of_attribute :custom_headers, :hash

# Sends the new message
# @return [Message] The sent message
# @raise [RuntimeError] if the API response data was not a hash
Expand Down
6 changes: 5 additions & 1 deletion spec/nylas/new_message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
subject: "A draft emails subject",
body: "<h1>A draft Email</h1>",
file_ids: [1234, 5678],
tracking: { opens: true }
tracking: { opens: true },
custom_headers: [
{ "name" => "List-Unsubscribe-Post", "value" => "List-Unsubscribe=One-Click" },
{ "name" => "List-Unsubscribe", "value" => "<https://example.com/unsubscribe>" }
]
}

it "sends the message directly" do
Expand Down

0 comments on commit fff90dd

Please sign in to comment.