Class: Telnyx::Resources::WhatsappMessageTemplates

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/whatsapp_message_templates.rb

Overview

Manage Whatsapp message templates

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ WhatsappMessageTemplates

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 WhatsappMessageTemplates.

Parameters:



76
77
78
# File 'lib/telnyx/resources/whatsapp_message_templates.rb', line 76

def initialize(client:)
  @client = client
end

Instance Method Details

#delete(id, request_options: {}) ⇒ nil

Delete a Whatsapp message template

Parameters:

  • id (String)

    Whatsapp message template ID

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



64
65
66
67
68
69
70
71
# File 'lib/telnyx/resources/whatsapp_message_templates.rb', line 64

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["v2/whatsapp_message_templates/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::WhatsappMessageTemplateRetrieveResponse

Get a Whatsapp message template by ID

Parameters:

  • id (String)

    Whatsapp message template ID

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



18
19
20
21
22
23
24
25
# File 'lib/telnyx/resources/whatsapp_message_templates.rb', line 18

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["v2/whatsapp_message_templates/%1$s", id],
    model: Telnyx::Models::WhatsappMessageTemplateRetrieveResponse,
    options: params[:request_options]
  )
end

#update(id, category: nil, components: nil, request_options: {}) ⇒ Telnyx::Models::WhatsappMessageTemplateUpdateResponse

Update a Whatsapp message template



42
43
44
45
46
47
48
49
50
51
# File 'lib/telnyx/resources/whatsapp_message_templates.rb', line 42

def update(id, params = {})
  parsed, options = Telnyx::WhatsappMessageTemplateUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v2/whatsapp_message_templates/%1$s", id],
    body: parsed,
    model: Telnyx::Models::WhatsappMessageTemplateUpdateResponse,
    options: options
  )
end