Issue with Repeated file_id and file_path in Rasa Action

Hello Rasa community!

I’m facing an issue in my Rasa chatbot where I’m experiencing repeated file_id and file_path values for different images uploaded by users. I’m seeking some guidance or suggestions on how to resolve this issue. Let me provide some details about my setup and the problem I’m encountering.

Context: I have a Telegram integration in my Rasa chatbot, where users can upload images as part of their interaction with the bot. I’m using the Telegram API to retrieve the file_id and file_path of the uploaded images. However, I’ve noticed that the same file_id and file_path values are being reused for different images, which is causing incorrect processing and storage of the images.

Problem Description:

  • When users upload different images, the file_id and file_path values are being repeated, leading to incorrect identification and processing of the images.

  • This issue occurs even when different images are uploaded by different users during different sessions.

  • Expected Behavior:

  • Each uploaded image should have a unique file_id and file_path to ensure proper identification and handling of the images.

*** Steps Taken:**

  • I’ve implemented the logic to extract the file_id and file_path from the Telegram API response.
  • I’m using the Rasa SDK to access the tracker and retrieve the metadata of the message events.
  • Within the custom action, I iterate over the events in the tracker to find the message event containing the photo information.
  • I then extract the file_id and file_path from the message metadata.

Current Code Snippet:

# Relevant code snippet within the custom action
for event in
    if 'metadata' in event and 'message' in event['metadata']:
        message = event['metadata']['message']
        if 'photo' in message and len(message['photo']) > 0:
            file_id = message['photo'][0]['file_id']
            file_path = message['photo'][0]['file_path']

Request for Assistance: I kindly request the community’s help in understanding the root cause of this issue and finding a suitable solution. Here are some specific questions I have:

  1. What could be causing the repeated usage of file_id and file_path values for different images?
  2. Is there a better approach or alternative method to retrieve the file_id and file_path for each uploaded image?
  3. How can I ensure that each uploaded image receives a unique file_id and file_path?

Any insights, suggestions, or code examples would be greatly appreciated. Thank you in advance for your support and assistance!

Feel free to modify the post as per your specific requirements and add any additional information or context that might be helpful. Good luck with resolving the issue, and I hope the Rasa community will provide valuable insights to help you find a solution!