Class: Zavudev::Resources::Senders

Inherits:
Object
  • Object
show all
Defined in:
lib/zavudev/resources/senders.rb,
lib/zavudev/resources/senders/agent.rb,
lib/zavudev/resources/senders/agent/flows.rb,
lib/zavudev/resources/senders/agent/tools.rb,
lib/zavudev/resources/senders/whatsapp_sync.rb,
lib/zavudev/resources/senders/agent/executions.rb,
lib/zavudev/resources/senders/agent/knowledge_bases.rb,
lib/zavudev/resources/senders/agent/knowledge_bases/documents.rb,
sig/zavudev/resources/senders.rbs,
sig/zavudev/resources/senders/agent.rbs,
sig/zavudev/resources/senders/agent/flows.rbs,
sig/zavudev/resources/senders/agent/tools.rbs,
sig/zavudev/resources/senders/whatsapp_sync.rbs,
sig/zavudev/resources/senders/agent/executions.rbs,
sig/zavudev/resources/senders/agent/knowledge_bases.rbs,
sig/zavudev/resources/senders/agent/knowledge_bases/documents.rbs

Defined Under Namespace

Classes: Agent, WhatsappSync

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Senders

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

Parameters:



277
278
279
280
281
# File 'lib/zavudev/resources/senders.rb', line 277

def initialize(client:)
  @client = client
  @agent = Zavudev::Resources::Senders::Agent.new(client: client)
  @whatsapp_sync = Zavudev::Resources::Senders::WhatsappSync.new(client: client)
end

Instance Attribute Details

#agentZavudev::Resources::Senders::Agent (readonly)



7
8
9
# File 'lib/zavudev/resources/senders.rb', line 7

def agent
  @agent
end

#whatsapp_syncZavudev::Resources::Senders::WhatsappSync (readonly)



10
11
12
# File 'lib/zavudev/resources/senders.rb', line 10

def whatsapp_sync
  @whatsapp_sync
end

Instance Method Details

#create(name:, email_address: nil, email_domain_id: nil, email_from_name: nil, email_receiving_enabled: nil, enable_sms_oneway: nil, enable_voice: nil, phone_number: nil, set_as_default: nil, webhook_events: nil, webhook_signature_version: nil, webhook_url: nil, request_options: {}) ⇒ Zavudev::Models::Sender

Some parameter documentations has been truncated, see Models::SenderCreateParams for more details.

Create sender

Parameters:

  • name (String)
  • email_address (String)

    From-address for the email channel (e.g. noreply@yourdomain.com). The address's

  • email_domain_id (String)

    ID of the verified email domain to attach. Optional — resolved from `emailAddres

  • email_from_name (String)

    Display name shown in the recipient's inbox for the email channel.

  • email_receiving_enabled (Boolean)

    Enable inbound email receiving on this sender. Requires a verified MX record on

  • enable_sms_oneway (Boolean)

    Enable the one-way SMS channel (sms_oneway). Needs nothing else — no phone num

  • enable_voice (Boolean)

    Let this sender place and answer phone calls. Requires phoneNumber; enabling i

  • phone_number (String)

    Phone number in E.164 format, and it must be a number your project already owns

  • set_as_default (Boolean)
  • webhook_events (Array<Symbol, Zavudev::Models::WebhookEvent>)

    Events to subscribe to.

  • webhook_signature_version (Symbol, Zavudev::Models::SenderCreateParams::WebhookSignatureVersion)

    Which X-Zavu-Signature scheme this receiver is sent.

  • webhook_url (String)

    HTTPS URL for webhook events.

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

Returns:

See Also:



48
49
50
51
52
53
54
55
56
57
# File 'lib/zavudev/resources/senders.rb', line 48

def create(params)
  parsed, options = Zavudev::SenderCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "v1/senders",
    body: parsed,
    model: Zavudev::Sender,
    options: options
  )
end

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

Delete sender

Parameters:

Returns:

  • (nil)

See Also:



163
164
165
166
167
168
169
170
# File 'lib/zavudev/resources/senders.rb', line 163

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

#get_profile(sender_id, request_options: {}) ⇒ Zavudev::Models::WhatsappBusinessProfileResponse

Get the WhatsApp Business profile for a sender. The sender must have a WhatsApp Business Account connected.

Parameters:

Returns:

See Also:



183
184
185
186
187
188
189
190
# File 'lib/zavudev/resources/senders.rb', line 183

def get_profile(sender_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/senders/%1$s/profile", sender_id],
    model: Zavudev::WhatsappBusinessProfileResponse,
    options: params[:request_options]
  )
end

#list(cursor: nil, limit: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Sender>

List senders

Parameters:

Returns:

See Also:



140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/zavudev/resources/senders.rb', line 140

def list(params = {})
  parsed, options = Zavudev::SenderListParams.dump_request(params)
  query = Zavudev::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "v1/senders",
    query: query,
    page: Zavudev::Internal::Cursor,
    model: Zavudev::Sender,
    options: options
  )
end

#regenerate_webhook_secret(sender_id, request_options: {}) ⇒ Zavudev::Models::WebhookSecretResponse

Regenerate the webhook secret for a sender. The old secret will be invalidated immediately.

Parameters:

Returns:

See Also:



203
204
205
206
207
208
209
210
# File 'lib/zavudev/resources/senders.rb', line 203

def regenerate_webhook_secret(sender_id, params = {})
  @client.request(
    method: :post,
    path: ["v1/senders/%1$s/webhook/secret", sender_id],
    model: Zavudev::WebhookSecretResponse,
    options: params[:request_options]
  )
end

#retrieve(sender_id, request_options: {}) ⇒ Zavudev::Models::Sender

Get sender

Parameters:

Returns:

See Also:



69
70
71
72
73
74
75
76
# File 'lib/zavudev/resources/senders.rb', line 69

def retrieve(sender_id, params = {})
  @client.request(
    method: :get,
    path: ["v1/senders/%1$s", sender_id],
    model: Zavudev::Sender,
    options: params[:request_options]
  )
end

#update(sender_id, email_address: nil, email_catch_all_enabled: nil, email_domain_id: nil, email_from_name: nil, email_receiving_enabled: nil, enable_sms_oneway: nil, enable_voice: nil, name: nil, set_as_default: nil, webhook_active: nil, webhook_events: nil, webhook_signature_version: nil, webhook_url: nil, request_options: {}) ⇒ Zavudev::Models::Sender

Some parameter documentations has been truncated, see Models::SenderUpdateParams for more details.

Update sender

Parameters:

  • sender_id (String)
  • email_address (String)

    Attach or change the sender's email from-address (e.g. noreply@yourdomain.com).

  • email_catch_all_enabled (Boolean)

    Enable or disable domain catch-all. When enabled (with emailReceivingEnabled tru

  • email_domain_id (String)

    ID of the verified email domain to attach. Optional — resolved from `emailAddres

  • email_from_name (String)

    Display name shown in the recipient's inbox for the email channel.

  • email_receiving_enabled (Boolean)

    Enable or disable inbound email receiving for this sender.

  • enable_sms_oneway (Boolean)

    Turn the one-way SMS channel on or off. Enabling needs nothing else and takes ef

  • enable_voice (Boolean)

    Turn the voice channel on or off. The sender must already have a phone number pr

  • name (String)
  • set_as_default (Boolean)
  • webhook_active (Boolean)

    Whether the webhook is active.

  • webhook_events (Array<Symbol, Zavudev::Models::WebhookEvent>)

    Events to subscribe to.

  • webhook_signature_version (Symbol, Zavudev::Models::SenderUpdateParams::WebhookSignatureVersion)

    Which X-Zavu-Signature scheme this receiver is sent.

  • webhook_url (String, nil)

    HTTPS URL for webhook events. Set to null to remove webhook.

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

Returns:

See Also:



118
119
120
121
122
123
124
125
126
127
# File 'lib/zavudev/resources/senders.rb', line 118

def update(sender_id, params = {})
  parsed, options = Zavudev::SenderUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v1/senders/%1$s", sender_id],
    body: parsed,
    model: Zavudev::Sender,
    options: options
  )
end

#update_profile(sender_id, about: nil, address: nil, description: nil, email: nil, vertical: nil, websites: nil, request_options: {}) ⇒ Zavudev::Models::SenderUpdateProfileResponse

Update the WhatsApp Business profile for a sender. The sender must have a WhatsApp Business Account connected.

Parameters:

  • sender_id (String)
  • about (String)

    Short description of the business (max 139 characters).

  • address (String)

    Physical address of the business (max 256 characters).

  • description (String)

    Extended description of the business (max 512 characters).

  • email (String)

    Business email address.

  • vertical (Symbol, Zavudev::Models::WhatsappBusinessProfileVertical)

    Business category for WhatsApp Business profile.

  • websites (Array<String>)

    Business website URLs (maximum 2).

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

Returns:

See Also:



236
237
238
239
240
241
242
243
244
245
# File 'lib/zavudev/resources/senders.rb', line 236

def update_profile(sender_id, params = {})
  parsed, options = Zavudev::SenderUpdateProfileParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["v1/senders/%1$s/profile", sender_id],
    body: parsed,
    model: Zavudev::Models::SenderUpdateProfileResponse,
    options: options
  )
end

#upload_profile_picture(sender_id, image_url:, mime_type:, request_options: {}) ⇒ Zavudev::Models::SenderUploadProfilePictureResponse

Upload a new profile picture for the WhatsApp Business profile. The image will be uploaded to Meta and set as the profile picture.

Parameters:

Returns:

See Also:



263
264
265
266
267
268
269
270
271
272
# File 'lib/zavudev/resources/senders.rb', line 263

def upload_profile_picture(sender_id, params)
  parsed, options = Zavudev::SenderUploadProfilePictureParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/senders/%1$s/profile/picture", sender_id],
    body: parsed,
    model: Zavudev::Models::SenderUploadProfilePictureResponse,
    options: options
  )
end