Skip to content

Commit

Permalink
Handle errors in statuses
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwr18 committed Nov 11, 2024
1 parent e1b35e1 commit a3baa0a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ class ThreeSixtyDialogWebhookController < ApplicationController

def message
head :ok
handle_error(@components[:statuses].first[:errors].first) and return if @components[:statuses]&.first[:errors].present?
return if @components[:statuses].present? # TODO: Handle statuses

handle_error(@components[:errors].first) and return if @components[:errors].present?

WhatsAppAdapter::ThreeSixtyDialog::ProcessWebhookJob.perform_later(organization_id: @organization.id, components: @components)
end

Expand Down Expand Up @@ -39,8 +38,9 @@ def message_params
{ context: %i[from id] }],
statuses: [:id, :status, :timestamp, :expiration_timestamp, :recipient_id,
{ conversation: [:id, { origin: [:type] }] },
{ pricing: %i[billable pricing_model category] }],
errors: [:code, :title, :message, :href, { error_data: [:details] }] }]
{ pricing: %i[billable pricing_model category],
errors: [:code, :title, :message, :href, { error_data: [:details] }] }] }]

}]
}])
end
Expand Down

0 comments on commit a3baa0a

Please sign in to comment.