n8n

How to Automate Telegram Facebook Audience Research?

Get Facebook ad interest ideas straight from a Telegram message. Media buyers type a hashtag command in a group, and a CSV file comes back with interest names and audience sizes that they can use in ads.

When the bot sees a message that starts with #interest in a specific Telegram chat, it extracts the keyword. It sends that keyword to the Facebook Graph API adinterest search. The flow then reshapes the results into rows with name, audience size bounds, topic, path, and id. A CSV file is created and returned to the same Telegram group as a document. Messages that do not match the chat id or the hashtag are ignored, so noise does not trigger the search.

You will need a Telegram bot token, the group chat id, and a Facebook Graph access token. Add the bot to the group, set the chat id in the filter and send nodes, and keep the #interest format for commands. Expect faster testing and better team collaboration. It helps agencies and growth teams collect interest clusters quickly, share results in chat, and cut manual research time by a large margin.

What are the key features?

  • Telegram message trigger listens for #interest commands in a specific group.
  • Filter step checks the chat id and message text so only valid requests run.
  • Text parser extracts the keyword after the hashtag and prepares the query.
  • Facebook Graph API search returns ad interests with audience size and metadata.
  • Data shaping steps format results into a clean table with selected fields.
  • CSV file is generated and sent back to the same Telegram group as a document.

What are the benefits?

  • Reduce manual research from 60 minutes to 2 minutes per query
  • Streamline interest discovery by about 90 percent through one chat command
  • Improve accuracy by removing copy paste errors when building lists
  • Connect Telegram and Facebook Graph data in one simple flow
  • Handle dozens of team requests per day without extra workload

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Telegram and Facebook Graph API. See the Tools Required section above for links to create accounts with these services.
  3. Create a Telegram bot and get its token. Add the bot to your target group and make sure it can read messages.
  4. In n8n, open the Telegram Trigger node. In the Credential field, click Create new credential and follow the on screen steps to add your bot token.
  5. Find your Telegram group chat id and update it in the If node condition and in the Send Telegram node chatId field so both point to the same group.
  6. Set up Facebook Graph credentials. Double click the Facebook Graph API node, choose Create new credential, then add your access token from your Facebook Developer account.
  7. Confirm the endpoint path matches the adinterest search and the version is set to v17.0. Keep the locale set to en_US unless you need a different market.
  8. Review the Code nodes. Make sure the message format uses #interest followed by your keyword. Keep this format when testing.
  9. Save and activate the workflow. Send a message in your group like #interest running shoes.
  10. Check that you receive a CSV file in the group. Open it and confirm the columns show name, audience sizes, topic, path, and id.
  11. If no file arrives, verify the chat id, the hashtag format, and that the bot is in the group. If the API returns errors, check your Facebook token and app permissions.
  12. If the result is too large, lower the limit in the Facebook search query. If the data looks off, try a different keyword or adjust the locale.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Facebook Graph API

Sign up

Free: $0 (no direct API charges; usage subject to rate limits)

Telegram

Sign up

Free: $0, Telegram Bot API usage is free for developers

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.