Repository: zammad/zammad

Issue #2998: Telegram and Form messages can't create ticket if field is mandatory
Created: 2020-03-31T11:22:16Z
Infos:

Used Zammad version: 3.3
Installation method (source, package, ..): any
Operating system: any
Database + version: any
Elasticsearch version: any
Browser + version: tested on Google Chrome, but isn't really relevant for this issue
Note: Possibly connected to: #1653 and #2634
Ticket: #1078918, #1078918

Expected behavior:

When using mandatory fields for ticket creation, Telegram messages (incoming) can still create new tickets.
When using mandatory fields for ticket creation, you can still submit new tickets via forms.

Actual behavior:

When using mandatory fields that require you do set them during ticket creation, you can no longer create tickets via telegram channel. On the other hand you also have no chance to set these fields via a telegram message (or hack around this issue with a trigger).
When using a Zammad form, you can't provide field information for required objects. This leaves you in a required workaround soltuion (see below).

Log output:
Log output for telegram and forms look similar, which is why I only provide one in this case.
I, [2020-03-31T12:55:33.970831 #14715-85439660]  INFO -- : Started POST "/api/v1/channels_telegram_webhook/XXXXXXXXXXXXXXX" for 0.0.0.0 at 2020-03-31 12:55:33 +0200
I, [2020-03-31T12:55:33.984772 #14715-85439660]  INFO -- : Processing by ChannelsTelegramController#webhook as HTML
I, [2020-03-31T12:55:33.984992 #14715-85439660]  INFO -- :   Parameters: {"update_id"=>306197320, "message"=>{"message_id"=>36, "from"=>{"id"=>1xxxxxxx1, "is_bot"=>false, "first_name"=>"Marcel", "last_name"=>"Herrguth", "username"=>"LeUserName", "language_code"=>"de"}, "chat"=>{"id"=>1xxxxxxx1, "first_name"=>"Marcel", "last_name"=>"Herrguth", "username"=>"LeUserName", "type"=>"private"}, "date"=>1585652131, "text"=>"hi"}, "bid"=>"2xxxxxxx2", "callback_token"=>"XXXXXXXXXXXXXXX"}
I, [2020-03-31T12:55:34.042481 #14715-85439660]  INFO -- : Enqueued SearchIndexJob (Job ID: af58504b-3ddf-4ddb-a4a2-e62d9b8a0a5d) to DelayedJob(default) with arguments: "User", 18
I, [2020-03-31T12:55:34.048532 #14715-85439660]  INFO -- : Enqueued SearchIndexAssociationsJob (Job ID: d6f9da4b-81bb-4cf7-a9ca-5608b3a7323e) to DelayedJob(default) with arguments: "User", 18
I, [2020-03-31T12:55:34.054701 #14715-85439660]  INFO -- : Won't enqueue SearchIndexJob (Job ID: a98c6c80-8ac9-4a12-81c3-14f6bf10c848) because of already existing job with lock key 'SearchIndexJob/User/18'.
I, [2020-03-31T12:55:34.054833 #14715-85439660]  INFO -- : Enqueued SearchIndexJob (Job ID: a98c6c80-8ac9-4a12-81c3-14f6bf10c848) to DelayedJob(default) with arguments: "User", 18
W, [2020-03-31T12:55:34.055796 #14715-85439660]  WARN -- : Scoped order is ignored, it's forced to be batch order.
E, [2020-03-31T12:55:34.063774 #14715-85439660] ERROR -- : Validation failed: Github is required but missing., Blah is required but missing. (ActiveRecord::RecordInvalid)
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/validations.rb:80:in `raise_validation_error'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/validations.rb:52:in `save!'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/transactions.rb:315:in `block in save!'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/transactions.rb:387:in `block in with_transaction_returning_status'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/database_statements.rb:265:in `transaction'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/transactions.rb:212:in `transaction'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/transactions.rb:385:in `with_transaction_returning_status'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/transactions.rb:315:in `save!'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/suppressor.rb:48:in `save!'
/opt/zammad/lib/telegram.rb:356:in `to_ticket'
/opt/zammad/lib/telegram.rb:753:in `block in to_group'
/opt/zammad/app/models/transaction.rb:15:in `block in execute'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `block in transaction'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/usr/local/rvm/rubies/ruby-2.5.5/lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/connection_adapters/abstract/database_statements.rb:267:in `transaction'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/transactions.rb:212:in `transaction'
/opt/zammad/app/models/transaction.rb:13:in `execute'
/opt/zammad/lib/telegram.rb:751:in `to_group'
/opt/zammad/app/controllers/channels_telegram_controller.rb:71:in `webhook'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/abstract_controller/base.rb:194:in `process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_controller/metal/rendering.rb:30:in `process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:109:in `block in run_callbacks'
/opt/zammad/app/controllers/application_controller/has_secure_content_security_policy_for_downloads.rb:18:in `block (4 levels) in <module:HasSecureContentSecurityPolicyForDownloads>'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/notifications.rb:180:in `subscribed'
/opt/zammad/app/controllers/application_controller/has_secure_content_security_policy_for_downloads.rb:17:in `block (3 levels) in <module:HasSecureContentSecurityPolicyForDownloads>'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/notifications.rb:180:in `subscribed'
/opt/zammad/app/controllers/application_controller/has_secure_content_security_policy_for_downloads.rb:16:in `block (2 levels) in <module:HasSecureContentSecurityPolicyForDownloads>'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:118:in `instance_exec'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:136:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/abstract_controller/callbacks.rb:41:in `process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_controller/metal/rescue.rb:22:in `process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/notifications.rb:168:in `block in instrument'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/notifications.rb:168:in `instrument'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/activerecord-5.2.4.2/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/abstract_controller/base.rb:134:in `process'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionview-5.2.4.2/lib/action_view/rendering.rb:32:in `process'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_controller/metal.rb:191:in `dispatch'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_controller/metal.rb:252:in `dispatch'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/journey/router.rb:35:in `each'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/journey/router.rb:35:in `serve'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/routing/route_set.rb:840:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:420:in `call_app!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-saml-1.10.1/lib/omniauth/strategies/saml.rb:89:in `other_phase'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:190:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:192:in `call!'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/strategy.rb:169:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/omniauth-1.9.0/lib/omniauth/builder.rb:64:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/tempfile_reaper.rb:15:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/etag.rb:27:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/conditional_get.rb:40:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/head.rb:12:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:266:in `context'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/session/abstract/id.rb:260:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/callbacks.rb:98:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/railties-5.2.4.2/lib/rails/rack/logger.rb:38:in `call_app'
/usr/local/rvm/gems/ruby-2.5.5/gems/railties-5.2.4.2/lib/rails/rack/logger.rb:26:in `block in call'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/tagged_logging.rb:28:in `tagged'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/tagged_logging.rb:71:in `tagged'
/usr/local/rvm/gems/ruby-2.5.5/gems/railties-5.2.4.2/lib/rails/rack/logger.rb:26:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/method_override.rb:24:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/runtime.rb:22:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/activesupport-5.2.4.2/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/executor.rb:14:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/actionpack-5.2.4.2/lib/action_dispatch/middleware/static.rb:127:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/rack-2.2.2/lib/rack/sendfile.rb:110:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/railties-5.2.4.2/lib/rails/engine.rb:524:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/railties-5.2.4.2/lib/rails/railtie.rb:190:in `public_send'
/usr/local/rvm/gems/ruby-2.5.5/gems/railties-5.2.4.2/lib/rails/railtie.rb:190:in `method_missing'
/usr/local/rvm/gems/ruby-2.5.5/gems/puma-3.12.4/lib/puma/configuration.rb:227:in `call'
/usr/local/rvm/gems/ruby-2.5.5/gems/puma-3.12.4/lib/puma/server.rb:675:in `handle_request'
/usr/local/rvm/gems/ruby-2.5.5/gems/puma-3.12.4/lib/puma/server.rb:476:in `process_client'
/usr/local/rvm/gems/ruby-2.5.5/gems/puma-3.12.4/lib/puma/server.rb:334:in `block in run'
/usr/local/rvm/gems/ruby-2.5.5/gems/puma-3.12.4/lib/puma/thread_pool.rb:135:in `block in spawn_thread'
/usr/local/rvm/gems/ruby-2.5.5/gems/logging-2.2.2/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
I, [2020-03-31T12:55:34.064166 #14715-85439660]  INFO -- :   Rendering inline template
I, [2020-03-31T12:55:34.064619 #14715-85439660]  INFO -- :   Rendered inline template (0.4ms)
I, [2020-03-31T12:55:34.064719 #14715-85439660]  INFO -- : Completed 422 Unprocessable Entity in 80ms (Views: 0.6ms | ActiveRecord: 23.3ms)

Workaround:
The only working workaround is to disable mandatory fields during ticket creation.
If you only expect customers to use above functionalities, it's enough to disable the requirement for customers.
If agents also are supposed to use the form however, you also have to deactiviate it for your agents.
Steps to reproduce the behavior:

create a telegram bot and integrate it to Zammad
ensure the integration is working - end the chat with /end on your telegram client (ensures to close the current session)
create a custom object that requires your customer to fill it in during ticket creation
reload Zammad (apply these changes)
try to send a telegram message to Zammad again

-OR-

enable the Zammad form and put it into a test website (local works as well)
create a custom object where your customer is required to fill it in during ticket creation
reload Zammad to apply the changes
try to send a message via form

Yes I'm sure this is a bug and no feature request or a general question.

Duplicate issue #3369: Telegram messages does not reach Zammad
Created: 2021-01-15T11:47:26Z
Infos:

Used Zammad version: 3.6.0-1610377695.3480f859.centos7
Installation method (source, package, ..): https://docs.zammad.org/en/latest/install/centos.html
Operating system: Centos 7
Database + version: postgres (PostgreSQL) 9.2.24
Elasticsearch version: 5.6.16
Browser + version: Any braowser

Expected behavior: When the Telegram integration is installed and configured as per the Zammad documentation, when a message is sent from Telegram, there should be a notification and new ticket in Zammad.



Actual behavior:

Telegram Bot integration was done as per the Zammad documentation, the integration in Zammad gives no errors, and the Telegram client app gives no errors, but the messages are not coming up in Zammad.COmpletely unable to get any Telegram messages into Zammad.

Steps to reproduce the behavior:



Yes I'm sure this is a bug and no feature request or a general question. Yes
production.log

Closing comment (2021-01-15T12:20:53Z): Duplicate of #2998