Class: Courier::Resources::Send
- Inherits:
-
Object
- Object
- Courier::Resources::Send
- Defined in:
- lib/courier/resources/send.rb,
sig/courier/resources/send.rbs
Overview
Send a message to one or more recipients — users, lists, audiences, or tenants — across every channel you have configured.
Instance Method Summary collapse
-
#initialize(client:) ⇒ Send
constructor
private
A new instance of Send.
-
#message(message:, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::SendMessageResponse
Some parameter documentations has been truncated, see Models::SendMessageParams for more details.
Constructor Details
#initialize(client:) ⇒ Send
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Send.
45 46 47 |
# File 'lib/courier/resources/send.rb', line 45 def initialize(client:) @client = client end |
Instance Method Details
#message(message:, idempotency_key: nil, x_idempotency_expiration: nil, request_options: {}) ⇒ Courier::Models::SendMessageResponse
Some parameter documentations has been truncated, see Models::SendMessageParams for more details.
Sends a message to one or more recipients and returns a requestId. Courier routes it to email, SMS, push, chat, or in-app based on your rules. Use the returned requestId to look up delivery status via the Messages API.
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/courier/resources/send.rb', line 28 def (params) parsed, = Courier::SendMessageParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_idempotency_expiration: "x-idempotency-expiration"} @client.request( method: :post, path: "send", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Courier::Models::SendMessageResponse, options: ) end |