Class: Sentdm::Resources::Messages
- Inherits:
-
Object
- Object
- Sentdm::Resources::Messages
- Defined in:
- lib/sentdm/resources/messages.rb
Overview
Send and track SMS and WhatsApp messages
Instance Method Summary collapse
-
#initialize(client:) ⇒ Messages
constructor
private
A new instance of Messages.
-
#retrieve_activities(id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::MessageRetrieveActivitiesResponse
Some parameter documentations has been truncated, see Models::MessageRetrieveActivitiesParams for more details.
-
#retrieve_status(id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::MessageRetrieveStatusResponse
Some parameter documentations has been truncated, see Models::MessageRetrieveStatusParams for more details.
-
#send_(channel: nil, sandbox: nil, template: nil, to: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::MessageSendResponse
Some parameter documentations has been truncated, see Models::MessageSendParams for more details.
Constructor Details
#initialize(client:) ⇒ Messages
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 Messages.
107 108 109 |
# File 'lib/sentdm/resources/messages.rb', line 107 def initialize(client:) @client = client end |
Instance Method Details
#retrieve_activities(id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::MessageRetrieveActivitiesResponse
Some parameter documentations has been truncated, see Models::MessageRetrieveActivitiesParams for more details.
Retrieves the activity log for a specific message. Activities track the message lifecycle including acceptance, processing, sending, delivery, and any errors.
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sentdm/resources/messages.rb', line 24 def retrieve_activities(id, params = {}) parsed, = Sentdm::MessageRetrieveActivitiesParams.dump_request(params) @client.request( method: :get, path: ["v3/messages/%1$s/activities", id], headers: parsed.transform_keys(x_profile_id: "x-profile-id"), model: Sentdm::Models::MessageRetrieveActivitiesResponse, options: ) end |
#retrieve_status(id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::MessageRetrieveStatusResponse
Some parameter documentations has been truncated, see Models::MessageRetrieveStatusParams for more details.
Retrieves the current status and details of a message by ID. Includes delivery status, timestamps, and error information if applicable.
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/sentdm/resources/messages.rb', line 52 def retrieve_status(id, params = {}) parsed, = Sentdm::MessageRetrieveStatusParams.dump_request(params) @client.request( method: :get, path: ["v3/messages/%1$s", id], headers: parsed.transform_keys(x_profile_id: "x-profile-id"), model: Sentdm::Models::MessageRetrieveStatusResponse, options: ) end |
#send_(channel: nil, sandbox: nil, template: nil, to: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::MessageSendResponse
Some parameter documentations has been truncated, see Models::MessageSendParams for more details.
Sends a message to one or more recipients using a template. Supports multi-channel broadcast — when multiple channels are specified (e.g. [“sms”, “whatsapp”]), a separate message is created for each (recipient, channel) pair. Returns immediately with per-recipient message IDs for async tracking via webhooks or the GET /messages/id endpoint.
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/sentdm/resources/messages.rb', line 91 def send_(params = {}) parsed, = Sentdm::MessageSendParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"} @client.request( method: :post, path: "v3/messages", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::Models::MessageSendResponse, options: ) end |