Some checks failed
Lock Threads / action (push) Has been cancelled
Mark stale issues and pull requests / stale (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot EE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot EE docker images / merge (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/amd64, ubuntu-latest) (push) Has been cancelled
Publish Chatwoot CE docker images / build (linux/arm64, ubuntu-22.04-arm) (push) Has been cancelled
Publish Chatwoot CE docker images / merge (push) Has been cancelled
Run Chatwoot CE spec / lint-backend (push) Has been cancelled
Run Chatwoot CE spec / lint-frontend (push) Has been cancelled
Run Chatwoot CE spec / frontend-tests (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (0, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (1, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (10, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (11, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (12, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (13, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (14, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (15, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (2, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (3, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (4, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (5, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (6, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (7, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (8, 16) (push) Has been cancelled
Run Chatwoot CE spec / backend-tests (9, 16) (push) Has been cancelled
Run Linux nightly installer / nightly (push) Has been cancelled
- Add Logistics component with progress tracking - Add OrderDetail component for order information - Support data-driven steps and actions - Add blue color scale to widget SCSS - Fix node overflow and progress bar rendering issues - Add English translations for dashboard components Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
55 lines
1.4 KiB
Ruby
55 lines
1.4 KiB
Ruby
class Integrations::Dyte::ProcessorService
|
|
pattr_initialize [:account!, :conversation!]
|
|
|
|
def create_a_meeting(agent)
|
|
title = I18n.t('integration_apps.dyte.meeting_name', agent_name: agent.available_name)
|
|
response = dyte_client.create_a_meeting(title)
|
|
|
|
return response if response[:error].present?
|
|
|
|
meeting = response
|
|
message = create_a_dyte_integration_message(meeting, title, agent)
|
|
message.push_event_data
|
|
end
|
|
|
|
def add_participant_to_meeting(meeting_id, user)
|
|
dyte_client.add_participant_to_meeting(meeting_id, user.id, user.name, avatar_url(user))
|
|
end
|
|
|
|
private
|
|
|
|
def create_a_dyte_integration_message(meeting, title, agent)
|
|
@conversation.messages.create!(
|
|
{
|
|
account_id: conversation.account_id,
|
|
inbox_id: conversation.inbox_id,
|
|
message_type: :outgoing,
|
|
content_type: :integrations,
|
|
content: title,
|
|
content_attributes: {
|
|
type: 'dyte',
|
|
data: {
|
|
meeting_id: meeting['id']
|
|
}
|
|
},
|
|
sender: agent
|
|
}
|
|
)
|
|
end
|
|
|
|
def avatar_url(user)
|
|
return user.avatar_url if user.avatar_url.present?
|
|
|
|
"#{ENV.fetch('FRONTEND_URL', nil)}/integrations/slack/user.png"
|
|
end
|
|
|
|
def dyte_hook
|
|
@dyte_hook ||= account.hooks.find_by!(app_id: 'dyte')
|
|
end
|
|
|
|
def dyte_client
|
|
credentials = dyte_hook.settings
|
|
@dyte_client ||= Dyte.new(credentials['organization_id'], credentials['api_key'])
|
|
end
|
|
end
|