Group refinements
This commit is contained in:
parent
c8ccee7ada
commit
f20cd5a53c
15 changed files with 287 additions and 23 deletions
|
|
@ -312,8 +312,21 @@ class CdrSignal
|
|||
def from_article(article)
|
||||
# sends a message from a zammad article
|
||||
|
||||
Rails.logger.debug { "Create signal message from article to '#{article[:to]}'..." }
|
||||
Rails.logger.debug { "Create signal message from article..." }
|
||||
|
||||
@api.send_message(article[:to], article[:body])
|
||||
# Get the recipient from ticket preferences
|
||||
ticket = Ticket.find_by(id: article.ticket_id)
|
||||
raise "No ticket found for article #{article.id}" unless ticket
|
||||
|
||||
recipient = ticket.preferences.dig('cdr_signal', 'chat_id')
|
||||
raise "No Signal chat_id found in ticket preferences" unless recipient
|
||||
|
||||
Rails.logger.debug { "Sending to recipient: '#{recipient}'" }
|
||||
|
||||
# Include ticket ID as conversationId for group creation callback
|
||||
options = {}
|
||||
options[:conversationId] = ticket.number if ticket
|
||||
|
||||
@api.send_message(recipient, article[:body], options)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue