The MVP is as follows: a user subscribes to a bot, with /start, then every day he receives 3 questions:
1) What did you do yesterday?
2) What are you going to do today?
3) What problems did you encounter?
The user answers in the chat. Everything is stored in a database and the reports are controlled by the project manager. Profit!
First, let's create a simple database in Airtable consisting of two tables - "id_users" with the "tg_id_chat" column - where we will store the unique IDs of our users' accounts and the "reports" table with the "tg_id_chat" key and the "report" column, where the users' answers will be stored. An example of DB can be copied here
Let's create the first integromat script “standups_get_answer”(that will receive messages from users)
The first Telegram bot "Watch updates" module to listen to all incoming messages. To configure it, you need to create a connection through the API token of your bot's telegram, which can be obtained in tg @BotFather /newbot
Next, let's create two branches of the script, for the case when a user registers for the first time through the command "/start", and when he or she sends in answers to the questions.
Add the element "Router", adjust the branching by matching the text from the listened message.
If you entered a message that is not equal to "/start", go to the Airtable module "Create a record" to log the responses. First, you need to connect the Airtable API.
Then select a table, columns to record and drag and drop the desired data sources into them.
To implement a new user registration script via "/start" let's first check if it is in the database. You can do this using the Airtable "Search Records" module.
In the "Formula" field we enter a search query, "sort" sorts the output, "limit" limits the number of output lines.
Run the current script and pay attention to the output data from the "Coincidence" search module. The image on the left - no matches, on the right - with the output of the found strings.
For the branching of the script we will check the existence of the ID parameter in "Bundle 1", i.e. if this user does not exist in the id_users table, we will create a new line in Airtable, if it does exist - we will send the answer in Telegram with the text "You already subscribed".
In the 'condition' field we also drag and drop the required 'ID' field with the mouse.
On the route "Not found" we create the Airtable module "Create a record", with which we record the ID of a new user.
On the "exist" route, we create a Telegram module "Send a text message or a reply", and set up the message sending.
Second script standups_send_message
Connect Airtable’s "Search Records" module, it will display a list of all entries in the id_users table. In this case, there is a restriction on the output of 10 rows, but it is possible to see more.
By clicking on the clock icon, we can set up mailing start schedules, here - it’s set to every day at 10 o'clock.
Now that we have got the list of all user IDs, let's configure the mailing of messages using the Telegram bot module "Send a text message or a reply". In the field "Chat ID" drag and drop the appropriate source, fill in "text".
Save it and... Done!
Now you can run both scripts in automatic mode
That's what the telegram test looks like.
A team of 10 people will spend about 900 operations per month, which is covered by a free Integromat subscription.
Subscribe to the blog and stay tuned for new articles about Nocode tools!