Class: Zavudev::Resources::Senders
- Inherits:
-
Object
- Object
- Zavudev::Resources::Senders
- 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
Defined Under Namespace
Classes: Agent, WhatsappSync
Instance Attribute Summary collapse
- #agent ⇒ Zavudev::Resources::Senders::Agent readonly
- #whatsapp_sync ⇒ Zavudev::Resources::Senders::WhatsappSync readonly
Instance Method Summary collapse
-
#create(name:, phone_number:, set_as_default: nil, webhook_events: nil, webhook_url: nil, request_options: {}) ⇒ Zavudev::Models::Sender
Create sender.
-
#delete(sender_id, request_options: {}) ⇒ nil
Delete sender.
-
#get_profile(sender_id, request_options: {}) ⇒ Zavudev::Models::WhatsappBusinessProfileResponse
Get the WhatsApp Business profile for a sender.
-
#initialize(client:) ⇒ Senders
constructor
private
A new instance of Senders.
-
#list(cursor: nil, limit: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Sender>
List senders.
-
#regenerate_webhook_secret(sender_id, request_options: {}) ⇒ Zavudev::Models::WebhookSecretResponse
Regenerate the webhook secret for a sender.
-
#retrieve(sender_id, request_options: {}) ⇒ Zavudev::Models::Sender
Get sender.
-
#update(sender_id, email_receiving_enabled: nil, name: nil, set_as_default: nil, webhook_active: nil, webhook_events: nil, webhook_url: nil, request_options: {}) ⇒ Zavudev::Models::Sender
Update sender.
-
#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.
-
#upload_profile_picture(sender_id, image_url:, mime_type:, request_options: {}) ⇒ Zavudev::Models::SenderUploadProfilePictureResponse
Upload a new profile picture for the WhatsApp Business profile.
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.
243 244 245 246 247 |
# File 'lib/zavudev/resources/senders.rb', line 243 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
#agent ⇒ Zavudev::Resources::Senders::Agent (readonly)
7 8 9 |
# File 'lib/zavudev/resources/senders.rb', line 7 def agent @agent end |
#whatsapp_sync ⇒ Zavudev::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:, phone_number:, set_as_default: nil, webhook_events: nil, webhook_url: nil, request_options: {}) ⇒ Zavudev::Models::Sender
Create sender
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/zavudev/resources/senders.rb', line 31 def create(params) parsed, = Zavudev::SenderCreateParams.dump_request(params) @client.request( method: :post, path: "v1/senders", body: parsed, model: Zavudev::Sender, options: ) end |
#delete(sender_id, request_options: {}) ⇒ nil
Delete sender
129 130 131 132 133 134 135 136 |
# File 'lib/zavudev/resources/senders.rb', line 129 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.
149 150 151 152 153 154 155 156 |
# File 'lib/zavudev/resources/senders.rb', line 149 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
106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/zavudev/resources/senders.rb', line 106 def list(params = {}) parsed, = 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: ) 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.
169 170 171 172 173 174 175 176 |
# File 'lib/zavudev/resources/senders.rb', line 169 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
52 53 54 55 56 57 58 59 |
# File 'lib/zavudev/resources/senders.rb', line 52 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_receiving_enabled: nil, name: nil, set_as_default: nil, webhook_active: nil, webhook_events: nil, webhook_url: nil, request_options: {}) ⇒ Zavudev::Models::Sender
Update sender
84 85 86 87 88 89 90 91 92 93 |
# File 'lib/zavudev/resources/senders.rb', line 84 def update(sender_id, params = {}) parsed, = Zavudev::SenderUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/senders/%1$s", sender_id], body: parsed, model: Zavudev::Sender, 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.
202 203 204 205 206 207 208 209 210 211 |
# File 'lib/zavudev/resources/senders.rb', line 202 def update_profile(sender_id, params = {}) parsed, = Zavudev::SenderUpdateProfileParams.dump_request(params) @client.request( method: :patch, path: ["v1/senders/%1$s/profile", sender_id], body: parsed, model: Zavudev::Models::SenderUpdateProfileResponse, 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.
229 230 231 232 233 234 235 236 237 238 |
# File 'lib/zavudev/resources/senders.rb', line 229 def upload_profile_picture(sender_id, params) parsed, = 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: ) end |