Back to Templates

Get Colombian peso to USD exchange rate with Telegram bot and AI date recognition

Created by

Created by: Juan Sanchez || juansave
Juan Sanchez

Last update

Last update 3 months ago

Share


๐Ÿ“Œ Request TRM (Colombian Peso to US Dollar exchange rate)

๐ŸŽฏ Objective

Retrieve the TRM (Colombian Peso to US Dollar exchange rate) for a specific date provided by the user via Telegram.

๐Ÿ”„ Summary Flow

  1. ๐Ÿ“จ Telegram Message
    The user sends a text or audio message to the Telegram Bot.

  2. ๐Ÿง  Date Extraction
    AI (OpenAI) is used to identify the date in YYYY-MM-DD format.

  3. ๐Ÿ“… Validation
    If the date is in the future, the user is notified that it is not valid.

  4. ๐Ÿ“ก TRM Query
    The bot queries the open data API from the Colombian government.

  5. ๐Ÿ“ฅ Result

    • โœ… If TRM data exists for that date โ†’ The bot replies to the user.
    • โŒ If not โ†’ It searches up to 10 previous days for available data.
  6. ๐Ÿ“ค Final Response
    The most recent available value is sent, or a message indicating no information is available.

๐Ÿ”— Data Source

datos.gov.co โ€“ TRM