Freelancer Bot —How I earned my first $500 by sending a new job notification to Telegram Group using the BOT that I coded myself
I am a freelancer working at Origami IT Lab and I usually get most of my gigs from Freelancer.com
Now for those who don’t have any idea about Freelancer, it provides a platform for the employer to post jobs and freelancers like me to get jobs. The process to find a job is fairly simple, you just have to bid on a job you like, if the employer liked your bid they will connect with you and afterwards award you the project after evaluation among other bidders.
A bid usually consists of 3 parts — Bid Amount, Description and Duration, all three are equally important. So in order to get a job awarded, you must bid with the best price, and duration and provide a good writeup on how you would complete the job. You can refer to the Writing a Winning Bid article by Freelancer in order to gain more perspective.
Problem Statement: Even with all the above things done right you may not get awarded, worst you may even not get considered. You may ask why? and the answer is the huge number of bids (manual + automatic) a job receives. For a scraping project for example an employer might receive 50–100 bids and it’s a fact that most of the bids go unnoticed. The employer usually selects from the top 20 bids and the top 20 here means those who have applied as soon as the job was posted not those who actually match the skillset and commitment.
Today there are a lot of bots working and to compete with them on the timing is very hard. So I wanted something that can bid on my behalf even when I am sleeping or doing some other jobs. And thats where I started looking out for solutions
Solution: Create a bot that will post bids on your behalf. Using bots will increase the chances the employer will view/consider your bid. And might initiate a contact. So the success rate increases once an employer contacts you. Refer to the below image —
Freelancer-Telegram Bot Workflow
Now, that I know that I have to use a bot, I have to decide the workflow and the tech stack. I have chosen Python for coding the bot and Telegram for receiving notifications. Receiving notifications is a crucial step, it allows you to go the bid and change it if you need to. I have attached a picture of the workflow -
I have selected “Scraping” as a skill for which I would like to bid, as I have 6+ years of experience in scraping so I am confident that any job related to scraping I will be able to complete.
Anatomy of a Bid
As you might have figured that “bid” is the most crucial step in getting the job. So bid consists of 3 parts
- Bid Amount — Amount which you seem to justify the effort you will put in
- Bid Description — It should contain something about yourself, how will you complete the job and any questions you have. This gives a sense to the employer bout you and your commitment.
- Duration — The time duration in which you can complete the job
My Automated Bid
In our automated bid, we need to have all the above parameters. I have made some assumptions for my auto bid.
- Bid Amount — It must be less than Project Budget; I will place a bid 20% greater than the average bid
- Bid Description —
★★★ Scrapping / Python / Selenium Expert ★★★ 6+ Years of Experience ★★★
Please allow me to generate a few sample entries in order to gain your trust and satisfaction. I have reviewed your project requirements closely and can help you with this. We can discuss also the complexity of the project so I can provide you with a realistic ETA and feel free to contact me through chat to talk about your project in more detail.
I have extensive knowledge of web scrapping with Python,scrapy, BeautifulSoup, Selenium. My extensive experience with web scraping using IP proxy rotation, multi thread and Bypassing captcha. You can see my past work on freelancer and on github.
I’ll be glad to discuss project before start so let’s chat.
Thanks for your consideration.
Best Regards,
Ritesh
- Duration — 14 days
Enough Talk! Let’s Code
Before starting, I am assuming you have an account on Freelancer.com, if not then create one. Once you have an account, freelancer provides an API that we can use to implement our workflow. In order to access it, we need to first get the authorization token. You can get it from here —
https://accounts.freelancer.com/settings/develop
Keep it in auth_tokens.py
oauth_token = 'YOUR_TOKEN_HERE'
Install below library
pip install freelancersdk
Create a new file place_bids.py and add the below-mentioned imports
Define Constants
Get all jobs posted today, add filters on project type and avg price etc
Get Bids count, if a job has less than 20 bids then apply for that job by placing bid, else ignore that job
How do I create a Telegram bot?
There’s a… bot for that. Just talk to BotFather and follow a few simple steps.
Creating a new bot
/newbot
Use the /newbot command to create a new bot. The BotFather will ask you for a name and username, then generate an authentication token for your new bot.
The name of your bot is displayed in contact details and elsewhere.
The Username is a short name, to be used in mentions and t.me links. Usernames are 5–32 characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. Your bot’s username must end in ‘bot’, e.g. ‘tetris_bot’ or ‘TetrisBot’.
The token is a string along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw that is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot.
Once the bot is ready, run the below command and Click on Enable button. With this, your bot will receive when added to a group. With privacy mode disabled, the bot will receive all messages.
/setprivacy
Create a New Group, I named my group “My Gigs”. Once the bot is ready add this bot to a group. Add yourself and the bot to the group.
Get ChatId of Telegram Group
Send a message “Hi” to the newly created group. Now open the browser and type the below URL
https://api.telegram.org/bot" + YOUR_TELEGRAM_BOT_TOKEN + "/getUpdates"
Once you have the Chat Id you are now ready to send notifications from Python to telegram.
Send Notification to Telegram
Now your bot is ready!
The Final Code!
Add below in your GitHub repo and name this file as — place_project_bid.py
The last part is to deploy this on Heroku or AWS so that it can continue to run regardless. I have deployed my Bot on Heroku, as it is free and does not charge anything.
Deploying to Heroku
For deploying an app on Heroku, first, upload the code on Github. Then follow the below steps. You need to add requirements.txt in your repo
freelancersdk==0.1.20
requests==2.27.1
urllib3==1.26.9
Next, add Procfile in the repo, please note it has no extension.
worker: python place_project_bid.py
Login to Heroku, go to Dashboard and Click on New>Create New App
After creating App, you should see your app
Click on your App and go to the Deploy tab and in the Deployment method select Github. Connect your Github account, after successful connecting Heroku and GitHub, it should look like this
App connected to GitHub — search the repository and select it. Once connected it should look like below
Enable automatic deployments, and finally click on the Deploy Branch button. On Clicking this button our Bot will be deployed on Heroku. Next, click on the Resources tab and wait for Dynamo to get activated, it takes some time before you can enable it.
Click on the edit button and enable the dynamo.
That’s it! Now your bot is Up and Running and you should start receiving notifications on telegram whenever a job is posted with your defined query.
Should you face any issues please let me know in the comment section or you can connect with me on LinkedIn
Summary
What have we learnt? We have learned —
- How to scrape the freelancer job portal using Freelancer API
- How to create a telegram bot
- How to send notification (URL link of job where we have placed a bid) on Telegram group
- How to deploy this on the cloud to keep it running 24*7
Optimization Points
- You can remove the below code to remove the wait time. time_interval = 60 # (in seconds)
- You can write a more efficient generic bid
- You can reduce the Bid Amount, to make sure your bid gets noticed and is competitive
- Add logic to not read the project where we have already placed a bid
I have tried to write a detailed article and I hope that I am successful in doing so. But if you are not a programmer and want to scrape data and use it then you can connect with me on Freelancer
💬 Leave a response to this article by providing your insights, comments, or requests for future articles.
📢 Share the articles with your friends and colleagues on social media.
➕ Follow me on Medium and check other articles.