Merge branch 'develop' into feat/email-forwarding
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# TODO : Move this to inboxes controller and deprecate this controller
|
||||
# No need to retain this controller as we could handle everything centrally in inboxes controller
|
||||
|
||||
class Api::V1::Accounts::Channels::TwilioChannelsController < Api::V1::Accounts::BaseController
|
||||
before_action :authorize_request
|
||||
|
||||
|
||||
@@ -78,10 +78,7 @@ export const mutations = {
|
||||
}
|
||||
},
|
||||
[types.SET_ALL_ATTACHMENTS](_state, { id, data }) {
|
||||
const attachments = _state.attachments[id] || [];
|
||||
|
||||
attachments.push(...data);
|
||||
_state.attachments[id] = [...attachments];
|
||||
_state.attachments[id] = [...data];
|
||||
},
|
||||
[types.SET_MISSING_MESSAGES](_state, { id, data }) {
|
||||
const [chat] = _state.allConversations.filter(c => c.id === id);
|
||||
|
||||
@@ -30,6 +30,11 @@ class Channel::TwilioSms < ApplicationRecord
|
||||
# The same parameter is used to store api_key_secret if api_key authentication is opted
|
||||
validates :auth_token, presence: true
|
||||
|
||||
EDITABLE_ATTRS = [
|
||||
:account_sid,
|
||||
:auth_token
|
||||
].freeze
|
||||
|
||||
# Must have _one_ of messaging_service_sid _or_ phone_number, and messaging_service_sid is preferred
|
||||
validates :messaging_service_sid, uniqueness: true, presence: true, unless: :phone_number?
|
||||
validates :phone_number, absence: true, if: :messaging_service_sid?
|
||||
|
||||
@@ -41,10 +41,20 @@ class Instagram::MessageText < Instagram::BaseMessageText
|
||||
# Access token has expired or become invalid.
|
||||
channel.authorization_error! if error_code == 190
|
||||
|
||||
# TODO: Remove this once we have a better way to handle this error.
|
||||
# https://developers.facebook.com/docs/messenger-platform/instagram/features/user-profile/#user-consent
|
||||
# The error typically occurs when the connected Instagram account attempts to send a message to a user
|
||||
# who has never messaged this Instagram account before.
|
||||
# We can only get consent to access a user's profile if they have previously sent a message to the connected Instagram account.
|
||||
# In such cases, we receive the error "User consent is required to access user profile".
|
||||
# We can safely ignore this error.
|
||||
return if error_code == 230
|
||||
|
||||
Rails.logger.warn("[InstagramUserFetchError]: account_id #{@inbox.account_id} inbox_id #{@inbox.id}")
|
||||
Rails.logger.warn("[InstagramUserFetchError]: #{error_message} #{error_code}")
|
||||
|
||||
ChatwootExceptionTracker.new(parsed_response, account: @inbox.account).capture_exception
|
||||
exception = StandardError.new("#{error_message} (Code: #{error_code})")
|
||||
ChatwootExceptionTracker.new(exception, account: @inbox.account).capture_exception
|
||||
end
|
||||
|
||||
def base_uri
|
||||
|
||||
@@ -62,6 +62,10 @@ json.instagram_id resource.channel.try(:instagram_id) if resource.instagram?
|
||||
json.messaging_service_sid resource.channel.try(:messaging_service_sid)
|
||||
json.phone_number resource.channel.try(:phone_number)
|
||||
json.medium resource.channel.try(:medium) if resource.twilio?
|
||||
if resource.twilio? && Current.account_user&.administrator?
|
||||
json.auth_token resource.channel.try(:auth_token)
|
||||
json.account_sid resource.channel.try(:account_sid)
|
||||
end
|
||||
|
||||
if resource.email?
|
||||
## Email Channel Attributes
|
||||
|
||||
Reference in New Issue
Block a user