Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
c6b657c
format message with sender
clairton Nov 22, 2022
18e5078
deleted message
clairton Apr 2, 2023
b4e66c3
message status progress for whatsapp
clairton Sep 10, 2022
5be35f7
feat: Webhook read event for whatsapp
clairton Sep 23, 2022
8acc698
add brazilian contact phone number validator
clairton Aug 26, 2022
2fbb526
self messages and group messages
clairton Feb 23, 2023
b428997
add request auth url
clairton Sep 12, 2022
cb43ef5
add WHATSAPP_MESSAGE_WINDOW_ENABLED
clairton Apr 4, 2023
ab44783
docker image push to ghcr.io/clairton
clairton Apr 4, 2023
3fed1a8
add url in whatsapp cloud api
clairton Apr 17, 2023
32905d9
fix procfile
clairton Apr 18, 2023
7218660
send with phone number where source id is uuid
clairton May 12, 2023
4ec43f5
plus build
clairton Jun 24, 2023
62bea67
updateConversationLastActivity where exist data
clairton Jun 30, 2023
4907060
private message after bot assignment
clairton Jul 3, 2023
271f001
publish on docker hub
clairton Jul 13, 2023
543b6af
docker compose
clairton Oct 20, 2023
10b6f76
Revert "add request auth url"
clairton Oct 30, 2023
a0d71dc
add validator for zero in ddd phone number
clairton Oct 30, 2023
35dc117
fix validate brazilian number
clairton Oct 30, 2023
b9e018a
feat: update contact_inboxes.source_id when update contact.phone_numb…
nithindavid Nov 10, 2023
bd1f84f
fix brazilian number fixed_line
clairton Nov 11, 2023
077e1a6
update contact_inbox source id in controller
clairton Nov 13, 2023
b86a7b2
use update attributes to contact inbox source
clairton Nov 14, 2023
d74ef6e
send activity do view conversation
clairton Nov 30, 2023
b2ea69c
better update last seen
clairton Dec 4, 2023
e16ebd0
fix param
clairton Dec 4, 2023
2ea900d
fix user view message
clairton Dec 8, 2023
854cd42
feat: Conversation sort old activity
clairton Dec 14, 2023
a40c0ac
show visualization message
clairton Dec 18, 2023
58b6ee9
add profile.picture and grou_picture field
clairton Dec 19, 2023
6db17f3
fix sender name
clairton Dec 20, 2023
919834d
return @contact_inbox out of transaction
clairton Dec 21, 2023
c2f075b
update contact avatar on message received
clairton Dec 21, 2023
8666996
Update publish_foss_docker.yml to plataform with linux/arm64
clairton Dec 23, 2023
635a0ac
better logs
clairton Jan 9, 2024
b06b557
feat: add features hide_all_chats_for_agent
clairton Jan 18, 2024
abdd006
feat: configure send agent name on whatsapp message
clairton Jan 18, 2024
2dbc3ca
fix: message send in whatsapp app without sender
clairton Jan 18, 2024
cf6ff73
run arm64 github action in separated job
clairton Jan 18, 2024
c5ae884
run arm64 github action in separated job
clairton Jan 18, 2024
412c333
image in arm
clairton Jan 20, 2024
c31cc0b
fix: message created_at receive timestamp field in whatsapp cloud api
clairton Jan 24, 2024
f8b9364
feature hide contacts for agent
clairton Jan 28, 2024
9d3b0ab
feature hide filters for agent
clairton Jan 28, 2024
b6c8863
config feature read message
clairton Jan 29, 2024
8c56e91
add disable_whatsapp_messaging_window feature
clairton Jan 31, 2024
0a442b2
better erro message on validate whatsapp config
clairton Jan 31, 2024
8e3fe14
fix disable_whatsapp_messaging_window
clairton Jan 31, 2024
0addfb7
use current when not exist
clairton Jan 31, 2024
04ac0fa
feat: show more info on failed create conversation
clairton Feb 10, 2024
b972378
unblock enterprise features
clairton Feb 12, 2024
aad5075
add feature agent viewed
clairton Feb 12, 2024
0159c0d
fix update last seen
clairton Feb 13, 2024
d538944
convert timestamp to integer
clairton Feb 15, 2024
92db8bf
unochat features
clairton Feb 19, 2024
2975b81
whatsapp message update status
clairton Feb 21, 2024
c2a04a3
disable window message when url is not https://graph.facebook.com
clairton Mar 1, 2024
36569aa
not resend message if has source id
clairton Mar 2, 2024
eefd954
validate sender present
clairton Mar 18, 2024
70b2cbf
validate sender present
clairton Mar 18, 2024
6c689ba
add conversation filter by contact id
clairton Mar 22, 2024
3a91932
fix media caption
clairton Apr 15, 2024
e99b23b
fix media caption
clairton Apr 15, 2024
dd9429b
fix: clean cache to process message again when fail
clairton Jun 8, 2024
1ee240e
save created_at in message with milliseconds of current second
clairton Jun 8, 2024
9475de9
fix: use microsecond to add in timestamp when create message in whats…
clairton Jun 9, 2024
3dbeb0a
fix: use sequencial microsecond to add in timestamp when create messa…
clairton Jun 10, 2024
2c21564
fix: use sequencial microsecond to add in timestamp when create messa…
clairton Jun 10, 2024
8988a1e
fix: use sequencial microsecond to add in timestamp when create messa…
clairton Jun 10, 2024
7dfa9b6
fix: format incoming_message_base_service
clairton Jun 10, 2024
586fdec
fix: fallback to retry show image
clairton Jun 13, 2024
72b2f9a
feat: conversation style css
clairton Jun 15, 2024
8a2be4c
fix: hide filters for agent
clairton Jun 18, 2024
a356a23
fix: automation erro caused by sintax in file filter_keys.yml
clairton Jun 18, 2024
a7650f4
fix: icon error
clairton Jun 18, 2024
8c068aa
fix: icon clock for pending messages
clairton Jun 18, 2024
0eb559c
fix: retry SendReplyJob and WhatsappEventsJob on ActiveRecord::Record…
clairton Jun 20, 2024
18d1edc
agent viewed only for open conversations
clairton Jun 22, 2024
bb53835
feat: add automation rule event conversation resolved
clairton Jun 22, 2024
900829d
chore: run specs on branch uno
clairton Jun 22, 2024
98afe8f
feat: hide unassigned for agent
clairton Jun 22, 2024
100b349
feat: add channel whatsapp with provider unoapi
clairton Jun 23, 2024
94a9858
highlight target message
clairton Jun 26, 2024
1b29928
feat: hide delete message for agent
clairton Jul 4, 2024
578f957
fix: replace http by ws protocol
clairton Jul 9, 2024
135a2ab
fix: use UNOAPI_AUTH_TOKEN on validate provider config
clairton Jul 9, 2024
d4312aa
feat: add webhook send new messages config
clairton Jul 14, 2024
15f2d54
feat: campaign audience with phone numbers
clairton Jul 24, 2024
dee9ff1
feat: create message on unoapi campaign
clairton Jul 25, 2024
ec6a254
feat: create message on unoapi campaign with perform later
clairton Jul 25, 2024
6a2faf3
feat: campaign bind message
clairton Jul 25, 2024
5d085f3
feat: first name on message campaign and campaign id on message
clairton Jul 25, 2024
0258d48
feat: refactor generate campaign display_id
clairton Jul 27, 2024
ef29a25
feat: revert create message on unoapi campaign with perform later
clairton Jul 28, 2024
f78f25e
Update UnoapiConfiguration.vue
wkarts Jul 26, 2024
351b913
Update inboxMgmt.json
wkarts Jul 26, 2024
a4520dc
Update inboxMgmt.json
wkarts Jul 26, 2024
ad3809a
Update Unoapi.vue
wkarts Jul 26, 2024
fdfe58e
Update unoapi_webhook_setup_service.rb
wkarts Jul 26, 2024
e1af53d
Update UnoapiConfiguration.vue
wkarts Jul 27, 2024
7b288b2
Update UnoapiConfiguration.vue
wkarts Jul 27, 2024
58a348e
Update unoapi_webhook_setup_service.rb
wkarts Jul 27, 2024
678d0fc
feat: pt translation unoapi inbox
clairton Jul 30, 2024
1d3391c
feat: add campaign report
clairton Aug 1, 2024
8629d46
fix: campaign message job retry
clairton Aug 3, 2024
6d195a0
fix: delete + in whatsapp source
clairton Aug 5, 2024
1d2d068
fix: not put 9 digit in non mobile numbers
clairton Aug 6, 2024
977c398
feat: better translations, some layout improvements and update vue va…
wkarts Aug 6, 2024
a0b7a5c
fix: normalize phone number in campaign message
clairton Aug 6, 2024
29ecf87
fix campaign message job
clairton Aug 8, 2024
a4061b1
feat: campaign order by created desc
clairton Aug 8, 2024
f415a91
feat: add email campaign audience
clairton Aug 10, 2024
046396f
feat: add in campaign audience field wait_for_seconds to create messages
clairton Aug 10, 2024
07f6445
fix: message error font size and position from unoapi conf
wkarts Aug 17, 2024
356bd09
run arm64 github action in separated job
clairton Jan 18, 2024
d70e3a9
feat: update contact identifier and email if empty
clairton Aug 13, 2024
ff4521a
test cache build
clairton Aug 17, 2024
ab22feb
change build cache image
clairton Aug 17, 2024
748e805
open conversation where message failed
clairton Aug 20, 2024
0db4073
ignore errors to update identifier and email
clairton Aug 22, 2024
13ff6c5
some fixes
clairton Aug 22, 2024
c0aaba6
feat: load reply to message
clairton Aug 25, 2024
058e3fc
feat: add thumb_url to ImageAudioVideo component
clairton Aug 25, 2024
e35b05d
feat: preview in reply to message
clairton Aug 25, 2024
ca8fbaf
better css in reply to
clairton Aug 25, 2024
cb8ecb0
add short param in message preview
clairton Aug 26, 2024
5f16665
remove connect/disconnect from unoapi channel provider config
clairton Aug 30, 2024
707ca8f
fix: css in reply message
clairton Aug 31, 2024
23971a3
fix: short param in replyTo
clairton Aug 31, 2024
e2ff053
fix: remove report
clairton Sep 11, 2024
058d074
fix create channel return true without connect/disconnect param
clairton Sep 11, 2024
7c6bc45
fix: unoapi config update
clairton Sep 13, 2024
d531562
add notificame
clairton Sep 14, 2024
171e90c
fix url mercado_livre
clairton Sep 15, 2024
0650ef7
limit campaign in 50
clairton Sep 15, 2024
836b57e
fix sintax on migration alter_message_source_id_length
clairton Sep 17, 2024
fb4e228
fix: campaign status with error where does not has phone number
clairton Sep 18, 2024
bfec549
fix: disable multiple files for whatsapp
clairton Sep 20, 2024
7488c62
some fix in rebase
clairton Sep 21, 2024
3fb9a79
fix: hide unassigned, all and filter for agents
clairton Sep 22, 2024
fbcb46d
add: unoapi configuration in super admin
clairton Sep 22, 2024
9121c14
feat: webhook support in macros
nestordavalos Mar 30, 2024
00550c7
fix: param multiple in ConversationForm.vue
clairton Sep 26, 2024
4fc2dc1
feat: show error campaign audience
clairton Sep 27, 2024
8c26b8e
feat: wavoip support in unoapi inbox
clairton Oct 2, 2024
9295f63
feat: webphone en and pt
clairton Oct 2, 2024
4478d67
fix: load wavoipToken
clairton Oct 3, 2024
117a5e8
fix: disable channels by super admin config
clairton Oct 3, 2024
263ec5a
Update unoapi_webhook_setup_service.rb
wkarts Oct 5, 2024
810d011
Update UnoapiConfiguration.vue
wkarts Oct 5, 2024
2f7d1d4
Update unoapi_webhook_setup_service.rb
wkarts Oct 5, 2024
666ff03
Update inboxMgmt.json
wkarts Oct 5, 2024
8dbcc12
Update inboxMgmt.json
wkarts Oct 5, 2024
b1e490d
Update inboxMgmt.json
wkarts Oct 5, 2024
d783b72
Update inboxMgmt.json
wkarts Oct 5, 2024
a1addae
fix: refactor disconect to disconnect in unoapi configuration
clairton Oct 5, 2024
1423d75
fix: disabled channels on create
clairton Oct 5, 2024
19375c5
Update UnoapiConfiguration.vue
wkarts Oct 5, 2024
82745f4
Merge branch 'uno' into uno-clairton-v3.13.4-uno-05102024
wkarts Oct 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 28 additions & 12 deletions .github/workflows/publish_foss_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
push:
branches:
- develop
- master
- uno
tags:
- v*
workflow_dispatch:
Expand All @@ -27,37 +27,53 @@ jobs:
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3

- name: Strip enterprise code
run: |
rm -rf enterprise
rm -rf spec/enterprise
# - name: Strip enterprise code
# run: |
# rm -rf enterprise
# rm -rf spec/enterprise

- name: Set Chatwoot edition
run: |
echo -en '\nENV CW_EDITION="ce"' >> docker/Dockerfile
# - name: Set Chatwoot edition
# run: |
# echo -en '\nENV CW_EDITION="ce"' >> docker/Dockerfile

- name: set docker tag
run: |
echo "DOCKER_TAG=chatwoot/chatwoot:$GIT_REF-ce" >> $GITHUB_ENV
echo "DOCKER_TAG=clairton/chatwoot:$GIT_REF" >> $GITHUB_ENV
echo "DOCKER_ARM_TAG=clairton/chatwoot-arm:$GIT_REF" >> $GITHUB_ENV

- name: replace docker tag if master
if: github.ref_name == 'master'
run: |
echo "DOCKER_TAG=chatwoot/chatwoot:latest-ce" >> $GITHUB_ENV
echo "DOCKER_TAG=clairton/chatwoot:latest" >> $GITHUB_ENV
echo "DOCKER_ARM_TAG=clairton/chatwoot-arm:latest" >> $GITHUB_ENV

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# https://github.com/docker/buildx/discussions/1382 cache build
- name: Build and push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.DOCKER_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build and push arm64
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
platforms: linux/arm64
push: true
tags: ${{ env.DOCKER_ARM_TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
1 change: 1 addition & 0 deletions .github/workflows/run_foss_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
branches:
- develop
- master
- uno
pull_request:
workflow_dispatch:

Expand Down
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ gem 'stripe'
## to populate db with sample data
gem 'faker'

gem 'phonelib'

# Include logrange conditionally in intializer using env variable
gem 'lograge', '~> 0.14.0', require: false

Expand Down
6 changes: 5 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ GEM
pg_search (2.3.6)
activerecord (>= 5.2)
activesupport (>= 5.2)
pgvector (0.1.1)
pgvector (0.2.2)
phonelib (0.7.1)
coderay (~> 1.1)
method_source (~> 1.0)
procore-sift (1.0.0)
activerecord (>= 6.1)
pry (0.14.2)
Expand Down Expand Up @@ -916,6 +919,7 @@ DEPENDENCIES
pg
pg_search
pgvector
phonelib
procore-sift
pry-rails
puma
Expand Down
4 changes: 2 additions & 2 deletions Procfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
release: POSTGRES_STATEMENT_TIMEOUT=600s bundle exec rails db:chatwoot_prepare && echo $SOURCE_VERSION > .git_sha
web: bundle exec rails ip_lookup:setup && bin/rails server -p $PORT -e $RAILS_ENV
worker: bundle exec rails ip_lookup:setup && bundle exec sidekiq -C config/sidekiq.yml
web: bundle exec rails server -p $PORT -e $RAILS_ENV
worker: bundle exec sidekiq -C config/sidekiq.yml
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,24 @@

___

# Chatwoot
# Chatwoot Uno
- essa versão do chatwoot que esta sendo usada aqui tem algumas customizações que ainda não foram aceitas pelo time do chatwoot e para um melhor uso com a unoapi(http://github.com/clairton/unoapi-cloud):
- funciona as conversas em grupo
- trata a mensagem enviadas por outras conexões, inclusive o aplicativo
- desabilita a janela de 24 horas do whatsapp cloud oficial
- sincroniza as imagens de perfil dos grupos e usuarios
- possibilidade de editar o endereço da caixa de entrada do whatsapp, assim pode usar a oficial e a unoapi na mesma instalação(não usar a env WHATSAPP_CLOUD_BASE_URL)
- opção no superadmin de habilitar para colocar o nome do agente na mensagem
- opção no superadmin de habilitar para marcar as mensagem no whatsapp como lido quando o agente visualiza a conversa
- opção no superadmin de esconder para a aba de todas as conversas
- opção no superadmin de esconder para o filtro de conversas
- opção no superadmin de esconder a parte de contatos
- da opção de alterar logo e nome da empresa
Exemplo de stack com os dois projetos integrados: https://github.com/clairton/unoapi-cloud/tree/main/examples/unochat



# Chatwoot

Customer engagement suite, an open-source alternative to Intercom, Zendesk, Salesforce Service Cloud etc.
<p>
Expand Down Expand Up @@ -98,7 +115,7 @@ Chatwoot now supports 1-Click deployment to DigitalOcean as a kubernetes app.

### Other deployment options

For other supported options, checkout our [deployment page](https://chatwoot.com/deploy).
For other supported options, checkout our [deployment page](https://chatwoot.com/deploy).

## Security

Expand Down
10 changes: 10 additions & 0 deletions app/builders/contact_inbox_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,21 @@ def generate_source_id
phone_source_id
when 'Channel::Api', 'Channel::WebWidget'
SecureRandom.uuid
when 'Channel::NotificaMe'
notifica_me_source_id
else
raise "Unsupported operation for this channel: #{@inbox.channel_type}"
end
end

def notifica_me_source_id
if ['telegram', 'whatsapp', 'sms'].include?(@inbox.channel.notifica_me_type)
return @contact.phone_number
end
raise ActionController::ParameterMissing, 'contact email' unless @contact.source_id
return @contact.source_id
end

def email_source_id
raise ActionController::ParameterMissing, 'contact email' unless @contact.email

Expand Down
8 changes: 6 additions & 2 deletions app/builders/contact_inbox_with_contact_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ def perform

def find_or_create_contact_and_contact_inbox
@contact_inbox = inbox.contact_inboxes.find_by(source_id: source_id) if source_id.present?
return @contact_inbox if @contact_inbox
if @contact_inbox
update_contact_avatar(@contact_inbox.contact) unless @contact_inbox.contact.avatar.attached?
return @contact_inbox
end

ActiveRecord::Base.transaction(requires_new: true) do
build_contact_with_contact_inbox
update_contact_avatar(@contact) unless @contact.avatar.attached?
end
update_contact_avatar(@contact) unless @contact.avatar.attached?

@contact_inbox
end

Expand Down
23 changes: 20 additions & 3 deletions app/builders/messages/message_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def validate_email_addresses(all_emails)
end

def message_type
if @conversation.inbox.channel_type != 'Channel::Api' && @message_type == 'incoming'
if @conversation.inbox.channel_type != 'Channel::Api' && @message_type == 'incoming' && !@private
raise StandardError, 'Incoming messages are only allowed in Api inboxes'
end

Expand Down Expand Up @@ -138,6 +138,15 @@ def message_sender
AgentBot.where(account_id: [nil, @conversation.account.id]).find_by(id: @params[:sender_id])
end

def status_param
@params[:status] = :progress if params_status_progress?
@params[:status].present? ? { status: @params[:status] } : {}
end

def source_id_param
@params[:source_id].present? ? { source_id: @params[:source_id] } : {}
end

def message_params
{
account_id: @conversation.account_id,
Expand All @@ -150,7 +159,15 @@ def message_params
items: @items,
in_reply_to: @in_reply_to,
echo_id: @params[:echo_id],
source_id: @params[:source_id]
}.merge(external_created_at).merge(automation_rule_id).merge(campaign_id).merge(template_params)
}.merge(external_created_at)
.merge(automation_rule_id)
.merge(campaign_id)
.merge(template_params)
.merge(status_param)
.merge(source_id_param)
end

def params_status_progress?
@params[:status].blank? && @message_type == 'outgoing' && !@private && @params[:action] == 'create' && (@conversation.inbox&.whatsapp? || @conversation.inbox&.notifica_me?)
end
end
12 changes: 9 additions & 3 deletions app/controllers/api/v1/accounts/campaigns_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Api::V1::Accounts::CampaignsController < Api::V1::Accounts::BaseController
before_action :check_authorization

def index
@campaigns = Current.account.campaigns
@campaigns = Current.account.campaigns.limit(200).order(created_at: :desc)
end

def show; end
Expand All @@ -28,7 +28,13 @@ def campaign
end

def campaign_params
params.require(:campaign).permit(:title, :description, :message, :enabled, :trigger_only_during_business_hours, :inbox_id, :sender_id,
:scheduled_at, audience: [:type, :id], trigger_rules: {})
fields = [:title, :description, :message, :enabled, :trigger_only_during_business_hours, :inbox_id, :sender_id, :scheduled_at]
fields << { trigger_rules: {} }
fields << if Inbox.find(params[:inbox_id])&.channel.try(:provider) == 'unoapi'
{ audience: [:name, :phone_number, :identifier, :due_at, :value, :scheduled_at, :email, :wait_for_seconds] }
else
{ audience: [:type, :id] }
end
params.require(:campaign).permit(fields)
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

class Api::V1::Accounts::Channels::NotificaMeChannelsController < Api::V1::Accounts::BaseController
before_action :authorize_request


def index
unless request.query_parameters["token"]
return render :json => { error: "Put the NotificaMe Token" }, status: 422
end
url = URI("https://hub.notificame.com.br/v1/channels")
response = HTTParty.get(
url,
headers: {
'X-API-Token' => request.query_parameters["token"],
'Content-Type' => 'application/json'
},
format: :json
)
if response.success?
render json: { data: { channels: response.parsed_response }}, status: 200
else
render json: { error: response.parsed_response }, status: 422
end
end

def create
ActiveRecord::Base.transaction do
build_inbox
setup_webhooks
render json: @inbox, status: 200
rescue StandardError => e
Rails.logger.error("NotificaMe channel create error #{e}, #{e.backtrace}")
render_could_not_create_error(e.message)
raise ActiveRecord::Rollback
end
end

private

def authorize_request
authorize ::Inbox
end

def setup_webhooks
::NotificaMe::WebhookSetupService.new(inbox: @inbox).perform
end

def build_inbox
@notifica_me_channel = Current.account.notifica_me_channels.create!(
notifica_me_id: permitted_params[:notifica_me_id],
notifica_me_token: permitted_params[:notifica_me_token],
notifica_me_type: permitted_params[:notifica_me_type],
)
@inbox = Current.account.inboxes.create!(
name: permitted_params[:name],
channel: @notifica_me_channel
)
end

def permitted_params
params.require(:notifica_me_channel).permit(:notifica_me_id, :notifica_me_token, :notifica_me_type, :name)
end
end
8 changes: 7 additions & 1 deletion app/controllers/api/v1/accounts/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ def create

def update
@contact.assign_attributes(contact_update_params)
@contact.save!
# 'Channel::TwilioSms', 'Channel::Whatsapp', 'Channel::Sms'
Contact.transaction do
@contact.contact_inboxes
.select{ |ci| ['Channel::Whatsapp'].include?(ci.inbox.channel_type) }
.each{ |ci| ci.update_attribute(:source_id, @contact.phone_number.delete('+').to_s) }
@contact.save!
end
process_avatar_from_url
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def permitted_update_params

def update_last_seen_on_conversation(last_seen_at, update_assignee)
# rubocop:disable Rails/SkipsModelValidations
@conversation.update_column(:agent_last_seen_at, last_seen_at)
@conversation.update_column(:agent_last_seen_at, last_seen_at) && UpdateLastSeenJob.perform_later(@conversation.id, current_user, last_seen_at)
@conversation.update_column(:assignee_last_seen_at, last_seen_at) if update_assignee.present?
# rubocop:enable Rails/SkipsModelValidations
end
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/dashboard_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def set_global_config
'LOGOUT_REDIRECT_LINK',
'DISABLE_USER_PROFILE_UPDATE',
'DEPLOYMENT_ENV',
'CSML_EDITOR_HOST'
'CSML_EDITOR_HOST', 'CONVERSATION_STYLE_CSS'
).merge(app_config)
end

Expand Down Expand Up @@ -64,6 +64,7 @@ def app_config
FACEBOOK_API_VERSION: GlobalConfigService.load('FACEBOOK_API_VERSION', 'v17.0'),
IS_ENTERPRISE: ChatwootApp.enterprise?,
AZURE_APP_ID: GlobalConfigService.load('AZURE_APP_ID', ''),
UNOAPI_AUTH_TOKEN: GlobalConfigService.load('UNOAPI_AUTH_TOKEN', ''),
GIT_SHA: GIT_HASH
}
end
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/super_admin/app_configs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def allowed_configs
%w[FB_APP_ID FB_VERIFY_TOKEN FB_APP_SECRET IG_VERIFY_TOKEN FACEBOOK_API_VERSION ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT]
when 'microsoft'
%w[AZURE_APP_ID AZURE_APP_SECRET]
when 'unoapi'
%w[UNOAPI_AUTH_TOKEN]
when 'email'
['MAILER_INBOUND_EMAIL_DOMAIN']
else
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/webhooks/notifica_me_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class Webhooks::NotificaMeController < ActionController::API
def process_payload
Webhooks::NotificaMeEventsJob.perform_later(params.to_unsafe_hash)
head :ok
end
end
Loading
Loading