PDF file download fails via WhatsApp Chat Bot
Discover what validations to perform to solve problems downloading PDF files sent by the bot and improve your users' experience.
Table of Contents
Symptom or Need
The client is reporting an intermittent failure to download PDF files through a WhatsApp chatbot. When accessing the download option for the required document, the bot does not download all the corresponding files on the first attempt. However, if the client requests the same information a second time, the bot successfully lists and allows the download of all the documents.
Context / Scenario
- This behavior occurs in the Chatbot service through flows in the WhatsApp channel. It has been specifically identified in operations that handle complex integrations for bulk document querying.
- The problem can arise when the bot interacts with an external WebService using REST API components to process the required download option and subsequently "Download doc".
- A particular scenario can occur when the bot needs to download multiple files at once, which subjects the flow to a cycle of requests that depends on a counting variable (such as $attempts_global) to avoid exceeding the bot's operational limits.
Answer / Solution
Minimum Information to Request
To properly document the case, replicate the scenario, and proceed with escalation, you must collect the following data from the client's environment:
- Infrastructure Data: Name of the affected operation, Operation Server, and Chat Server.
- Routing Data: Routing (RP) Chat affected and WhatsApp connector number.
- Impact: Percentage (%) of impact and exact start date of service unavailability or intermittency.
- Evidence : Clear documentation of the failure and the tests performed (e.g., screenshots of the interrupted flow and debug capture).
Initial Validations / Troubleshooting
FOR THE ANALYST : Before escalating the case, you must perform the following steps to diagnose the problem:
- Validate the update and available resources of the server where the operation is located.
- Verify that the name validation is being done correctly, taking into account the proper spelling (including the use of uppercase or lowercase letters, as appropriate).
- Generate evidence by attempting to replicate the incident to obtain proof.
- Migrate the Routing Chat to a test environment of a different operation and associate it with a connector, to validate if the new feature is also replicated there.
- Migrate and validate the behavior in a test Routing Chat within the same operation.
- Check the size and type of the files that are being affected.
- Identify and verify the affected chats (using the Chat IDs) within Diagram Reports report 9.
- Perform a debug within the workflow. Document whether, when performing a query with X number of documents, the process stops upon reaching a specific file number and only enables the download of some files, or validates the number of files for which it enables the download.
- Add the $intentos_global variable inside a replychat component to make it easier to track the flow.
- Validate the response from the client or administrator side of the WebService to ensure its complete stability.
- Adjust and optimize the Chat Bot flow logic to prevent the file request cycle from reaching the limit of 4000 global attempts.
When reviewing the case, the analyst should perform full traceability tests, for example, by running queries from the test line to reproduce the entire flow. These tests confirm that the component requests are correctly routed to the web service and that the PDF file is indeed generated and downloaded when the external response is valid.
Escalation
Once the initial validations have been carried out without finding an immediate solution, the case should be escalated to Level 3 ( Digital Team ), with complete documentation and evidence of the case.
Possible Causes
The intermittent connection could be due to two possible reasons:
- External provider failure: In some cases, the WebService does not return the response correctly, which immediately stops the process in the REST API component.
- Flow logic limit: The flow ends before completing the download because the maximum limit set in the if condition ($intentos_global >= 4000) is reached, preventing the upload and download of all PDFs from being completed.