Trend Moon Docs
  • Overview
    • What is TrendMoon?
    • Project History
    • Social Alerts
    • Explorer
    • Telegram Chat Statistics
    • Automated Trading Strategies
      • Strategy Development Overview
      • Backtests - Memecoin strategy
  • Roadmap
  • TMOON Token
    • TBC
  • Taimat API
    • Authentification
    • Messages Endpoints
    • Chats
    • Coins
    • Processed Insights
    • Error Handling
    • Social
Powered by GitBook
On this page
  1. Taimat API

Messages Endpoints

Message Endpoints

1. Search Messages

GET https://api.qa.trendmoon.ai/messages/search

Description:

  • Performs a search across messages based on various optional criteria like text content, group, user, message type, bot/spammer status, and date range.

Parameters:

  • text (string, optional): Search in message text

  • group_username (string, optional): Filter by group username

  • username (string, optional): Filter by sender username

  • message_type (string, optional): Filter by message type ("raw" or "clean")

  • user_is_bot (boolean, optional): Filter by bot status

  • user_is_spammer (boolean, optional): Filter by spammer status

  • spam_flag (boolean, optional): Filter by spam flag

  • start_date (string, optional): Start date in ISO 8601 format

  • end_date (string, optional): End date in ISO 8601 format

  • from_ (integer, optional, default=0): Starting offset for pagination

  • size (integer, optional, default=100): Number of messages to return

Example request:

curl -X GET 'https://api.qa.trendmoon.ai/messages/search?text=roadmap&group_username=some_project_chat&start_date=2025-02-01T00:00:00&end_date=2025-02-15T23:59:59&spam_flag=false&size=20' \
     -H 'accept: application/json' \
     -H 'Api-key: YOUR_API_KEY'

Response:

{
    "id": 367523,
    "chat_id": 1176547813,
    "group_username": "taraxa_project",
    "user_id": 443349745,
    "username": "reedvoid",
    "user_is_bot": false,
    "user_is_spammer": false,
    "date": "2025-04-02T23:57:50Z",
    "sender_type": "MessageSenderUser",
    "text": "and it shows up on Kucoin?",
    "clean_text": "and it shows up on kucoin?",
    "message_type": "clean",
    "spam_flag": false,
    "views": 0,
    "replies": 1,
    "forwards": 0,
    "reply_to_id": null,
    "member_online_count": 259
  },
  {
    "id": 367522,
    "chat_id": 1176547813,
    "group_username": "taraxa_project",
    "user_id": 1344821719,
    "username": "bonmangali",
    "user_is_bot": false,
    "user_is_spammer": false,
    "date": "2025-04-02T23:57:35Z",
    "sender_type": "MessageSenderUser",
    "text": "I can send it to Kucoin via Taraxa network",
    "clean_text": "i can send it to kucoin via taraxa network",
    "message_type": "clean",
    "spam_flag": false,
    "views": 0,
    "replies": 0,
    "forwards": 0,
    "reply_to_id": null,
    "member_online_count": 259
  },
  {
    "id": 367521,
    "chat_id": 1176547813,
    "group_username": "taraxa_project",
    "user_id": 1344821719,
    "username": "bonmangali",
    "user_is_bot": false,
    "user_is_spammer": false,
    "date": "2025-04-02T23:56:56Z",
    "sender_type": "MessageSenderUser",
    "text": "I bought Taraxa with my Trustwallet. So I am wrong by saying it is on ETH, right?",
    "clean_text": "i bought taraxa with my trustwallet. so i am wrong by saying it is on eth, right?",
    "message_type": "clean",
    "spam_flag": false,
    "views": null,
    "replies": null,
    "forwards": null,
    "reply_to_id": 367520,
    "member_online_count": 259
  },

Response Fields:

  • id (integer)

    • Unique message ID (only unique within the same chat_id)

  • chat_id (integer)

    • Internal Telegram chat ID

  • user_id (integer)

    • Internal Telegram user ID

  • date (string)

    • Timestamp of when the message was sent (ISO 8601 format)

  • group_username (string)

    • Username of the group where the message was sent

  • username (string)

    • Telegram username of the sender

  • user_is_bot (boolean)

    • Indicates if the user has been previously identified as a bot

  • user_is_spammer (boolean)

    • Indicates if the user has been previously identified as a spammer

  • sender_type (string)

    • Type of sender: MessageSenderUser (user) or MessageSenderChat (chat)

  • text (string)

    • Raw original message text

  • clean_text (string)

    • Cleaned version of the message text after processing

  • message_type (string)

    • Type of message, can be “raw” or “clean” depending if the message has been cleansed or not

  • spam_flag (boolean)

    • Whether the message has been flagged as spam

  • views (integer)

    • Number of times the message has been viewed

  • replies (integer)

    • Number of replies to this message

  • forwards (integer)

    • Number of times the message has been forwarded

  • reply_to_id (integer/null)

    • If the message is a reply, contains the ID of the referenced message

  • member_online_count (integer)

    • Number of members online in the group at the time the message was sent

2. Get User Messages

GET https://api.qa.trendmoon.ai/messages/user

Description:

  • Retrieves a list of messages sent by a specific user, identified by either username or user_id, within a given date range. Allows filtering by message type and spam status.

Parameters:

  • username (string, required): Telegram username

  • start_date (string, required): Start date in ISO format

  • end_date (string, required): End date in ISO format

Example request:

curl -X GET 'https://api.qa.trendmoon.ai/messages/user?username=user123&start_date=2025-02-01T00:00:00&end_date=2025-02-15T23:59:59&size=10' \
     -H 'accept: application/json' \
     -H 'Api-key: YOUR_API_KEY'

Response Fields have same structure as Search Messages, filtered for specific user.

3. Get Chat Messages

GET https://api.qa.trendmoon.ai/messages/chat

Description:

  • Retrieves a list of messages for a specific chat group, identified by either group_username or chat_id, within a given date range. Allows filtering by message type (raw/clean) and spam status.

Parameters:

  • group_username (string, optional): The username of the group chat. Either this or chat_id must be provided.

  • chat_id (integer, optional): The internal Telegram ID of the chat. Either this or group_username must be provided.

  • start_date (datetime, required): Start date for the message query in ISO 8601 format (e.g., 2023-10-26T00:00:00).

  • end_date (datetime, required): End date for the message query in ISO 8601 format (e.g., 2023-10-27T23:59:59).

  • message_type (string, optional): Filter messages by type. Accepts "raw" or "clean". If omitted, retrieves messages regardless of type.

  • with_spams (boolean, optional): Filter messages based on spam status. true includes spam, false excludes spam. If omitted, the default behavior depends on the service implementation (likely excludes spam unless specified).

  • from_ (integer, optional, default: 0): Starting offset for pagination.

  • size (integer, optional, default: 100): Number of messages to return per page.

Example request:

curl -X GET 'https://api.qa.trendmoon.ai/messages/chat?group_username=solana&start_date=2025-02-01T00:00:00&end_date=2025-02-15T23:59:59&message_type=clean&with_spams=false&size=5' \
     -H 'accept: application/json' \
     -H 'Api-key: YOUR_API_KEY'

Response fields have the same structure as Search Messages, filtered for specific chat.

Example response:

[
    {
        "id": 123456,
        "chat_id": 789012,
        "user_id": 345678,
        "date": "2025-02-10T10:00:00",
        "group_username": "solana",
        "username": "user123",
        "user_is_bot": false,
        "user_is_spammer": false,
        "sender_type": "MessageSenderUser",
        "text": "Original message about Solana performance.",
        "clean_text": "message about Solana performance",
        "message_type": "clean",
        "spam_flag": false,
        "views": 150,
        "replies": 8,
        "forwards": 1,
        "reply_to_id": null,
        "member_online_count": 16000
    },
    {
        "id": 123457,
        "chat_id": 789012,
        "user_id": 345679,
        "date": "2025-02-10T10:05:00",
        "group_username": "solana",
        "username": "another_user",
        "user_is_bot": false,
        "user_is_spammer": false,
        "sender_type": "MessageSenderUser",
        "text": "Any news on the next update?",
        "clean_text": "Any news on the next update",
        "message_type": "clean",
        "spam_flag": false,
        "views": 120,
        "replies": 3,
        "forwards": 0,
        "reply_to_id": 123456,
        "member_online_count": 16050
    }
    // ... more messages
]

4. Get Messages by Timeframe

GET https://api.qa.trendmoon.ai/messages/timeframe

Description:

  • Retrieves all messages across all monitored chats within a specific date range. Allows optional filtering by message type and spam status. Useful for broad analysis over time.

Parameters:

  • start_date (string, required): Start date in ISO 8601 format (e.g., 2023-01-01T00:00:00)

  • end_date (string, required): End date in ISO 8601 format (e.g., 2023-01-31T23:59:59)

  • message_type (string, optional): Type of messages to retrieve ("raw" or "clean")

  • with_spams (boolean, optional): Filter by spam status

  • from_ (integer, optional, default=0): Starting point for pagination

  • size (integer, optional, default=100): Number of messages to return

Example request:

curl -X GET 'https://api.qa.trendmoon.ai/messages/timeframe?start_date=2025-02-01T10:00:00&end_date=2025-02-01T10:15:00&message_type=clean&size=50' \
     -H 'accept: application/json' \
     -H 'Api-key: YOUR_API_KEY'

Response fields have the same structure as Search Messages, filtered for timeframe.

PreviousAuthentificationNextChats

Last updated 2 months ago