Skip to content

Commit

Permalink
chore: Return medium in inbox APIs (chatwoot#3025)
Browse files Browse the repository at this point in the history
Return medium in inbox APIs
  • Loading branch information
sojan-official authored Sep 16, 2021
1 parent a0ffefa commit 0c3e8b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/builders/messages/facebook/message_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def contact_params
result = {}
# OAuthException, code: 100, error_subcode: 2018218, message: (#100) No profile available for this user
# We don't need to capture this error as we don't care about contact params in case of echo messages
Sentry.capture_exception(e) unless outgoing_echo?
Sentry.capture_exception(e) unless @outgoing_echo
rescue StandardError => e
result = {}
Sentry.capture_exception(e)
Expand Down
4 changes: 4 additions & 0 deletions app/models/inbox.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ def email?
channel_type == 'Channel::Email'
end

def twilio?
channel_type == 'Channel::TwilioSms'
end

def inbox_type
channel.name
end
Expand Down
1 change: 1 addition & 0 deletions app/views/api/v1/models/_inbox.json.jbuilder
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ json.reauthorization_required resource.channel.try(:reauthorization_required?) i

## Twilio Attributes
json.phone_number resource.channel.try(:phone_number)
json.medium resource.channel.try(:medium) if resource.twilio?

## Email Channel Attributes
json.forward_to_email resource.channel.try(:forward_to_email)
Expand Down

0 comments on commit 0c3e8b6

Please sign in to comment.