Написати Node.js демон для роботи з Instagram Graph API
259 USDОпис
Створити NodeJS демон (cron job) який через Instagram Graph API збирає дані про аудиторію користувача, кількість читачів та зберігає цю інформацію в базі даних.
Вимоги:
- Дані про аудиторію користувача та кількість читачів мають зберігатись в окрмих колекціях в MongoDB: audience_analytics (regular collection) та followers_analytics (time series collection).
- Дані про аудиторію користувача мають збиратися один раз на добу для кожного окремого Інстаграм акаунта та оновлюватися в колекції audience_analytics
- Дані про кількість читачів мають збиратися щогодини і записуватися як новий запис в followers_analytics. Новий запис створюється щогодини для кожного Інстаграм акаунта користувача.
Технічні замітки
Facebook API
Щоб збирати дані через Facebook API необхідно отримати перманентний токен з такими дозволами: pages_show_list, instagram_basic, instagram_manage_insights, pages_read_engagement, pages_manage_metadata, public_profile.
Як отримати перманентний токен
00000000000000000 - замінити на Instagram user id
followers_analytics збирається через Facebook graph api endpoint:
v14.0/00000000000000000/insights?metric=follower_count&period=day&since=1662377839 (респонс містить кількість нових читачів щодня, починаючи з дати since).
Важливо: дані надаються із запізненням на 2 дні. Приклад - сьогодні 10 вересня. Дані про нових читачів будуть за 8 і раніше. 9 та 10 вересня будуть нульові показники і оновляться у відповіді тільки 11 та 12 вересня. Нам потрібно брати дані за останні 7 днів.
v14.0/00000000000000000?fields=followers_count (загальна кількість читачів на момент запиту)
audience_analytics збирається через Facebook graph api endpoint:
v14.0/00000000000000000/insights?metric=audience_city,audience_country,audience_gender_age,audience_locale,online_followers&period=lifetime
Структура колекції в MongoDB
Схема followers_analytics time series колекції
{
"_id": ObjectId, // generated automatically by mongo
"timestamp": ISODate, //
"metadata": {
"user_id": Number, // instagram user id
},
"followers_count": Number, // total number of followers for that day.
"followers_change": [ // Array of followers change for current and previous day
{
"value": Number,
"end_time": String
},
{
"value": Number,
"end_time": String
}
]
}followers_count - беремо з v14.0/00000000000000000?fields=followers_count API response.
followers_change - беремо з v14.0/00000000000000000/insights?metric=follower_count&period=day&since=0000000000 API response data[0].values Array.
Приклад відповіді від Фейсбук v14.0/00000000000000000/insights?metric=follower_count&period=day&since=1662377839
Facebook API response:
{
"data": [
{
"name": "follower_count",
"period": "day",
"values": [
{
"value": 5,
"end_time": "2022-09-06T07:00:00+0000"
},
{
"value": 5,
"end_time": "2022-09-07T07:00:00+0000"
},
{
"value": 5,
"end_time": "2022-09-08T07:00:00+0000"
},
{
"value": 6,
"end_time": "2022-09-09T07:00:00+0000"
},
{
"value": 4,
"end_time": "2022-09-10T07:00:00+0000"
},
{
"value": 0,
"end_time": "2022-09-11T07:00:00+0000"
},
{
"value": 0,
"end_time": "2022-09-12T07:00:00+0000"
}
],
"title": "Число подписчиков",
"description": "Общее количество уникальных аккаунтов, подписанных на этот профиль",
"id": "17841411749422633/insights/follower_count/day"
}
],
"paging": {
"previous": "https://graph.facebook.com/v14.0/17841411749422633/insights?access_token=EAAH2ZCdHE5IcBAMEXIhnA8W6Tmuo21NWY2MMMmOZBxsWvu5UpdZCDBcUettGUrZAtwiaSNRbZAvZBrBVHRLWukDgZC45QgWkZA0TcttFKgkbxLjGSW1ui2IxQdy94LPJiSylZC9dElHpAMSlt80UYe7NCrbFgjakRpJdGeyim4jViJZA4G4oCxOZAo7mmlgRZAIQNlSYlMCzqmTUZBGk7dOKi622HEtiP6ZCCK5UUZD&pretty=0&since=1661767386&metric=follower_count&period=day&until=1662377838",
"next": "https://graph.facebook.com/v14.0/17841411749422633/insights?access_token=EAAH2ZCdHE5IcBAMEXIhnA8W6Tmuo21NWY2MMMmOZBxsWvu5UpdZCDBcUettGUrZAtwiaSNRbZAvZBrBVHRLWukDgZC45QgWkZA0TcttFKgkbxLjGSW1ui2IxQdy94LPJiSylZC9dElHpAMSlt80UYe7NCrbFgjakRpJdGeyim4jViJZA4G4oCxOZAo7mmlgRZAIQNlSYlMCzqmTUZBGk7dOKi622HEtiP6ZCCK5UUZD&pretty=0&since=1662988292&metric=follower_count&period=day&until=1663598744"
}
}Схема audience_analytics
{
"_id": ObjectId, // generated automatically by mongo
"timestamp": ISODate, //
"metadata": {
"user_id": Number, // instagram user id
},
"audience_city": Array, // Array of values from API response
"audience_country": Array, // Array of values from API response
"audience_gender_age": Array, // Array of values from API response
"audience_locale": Array, // Array of values from API response
"online_followers": Array // Array of values from API response
}Приклад v14.0/00000000000000000/insights?metric=audience_city,audience_country,audience_gender_age,audience_locale,online_followers&period=lifetime
Facebook API response:
{
"data": [
{
"name": "audience_city",
"period": "lifetime",
"values": [
{
"value": {
"London, England": 3,
"Almere, Flevoland": 2,
"Odessa, Odessa Oblast": 7,
"Kharkiv, Kharkiv Oblast": 40,
"Barcelona, Cataluña": 4,
"Sumy, Sumy Oblast": 2,
"Amsterdam, Noord-Holland": 4,
"Kamianets-Podilskyi, Khmelnytskyi Oblast": 3,
"Alanya, Antalya Province": 2,
"Cherkasy, Cherkasy Oblast": 2,
"Lisbon, Lisbon District": 2,
"Berlin, Berlin": 18,
"Khmelnytskyi, Khmelnytskyi Oblast": 4,
"Valky, Kharkiv Oblast": 3,
"Lviv, Lviv Oblast": 23,
"Kyiv, Kyiv": 86,
"Prague, Prague": 3,
"Merefa, Kharkiv Oblast": 3,
"Moscow, Moscow": 2,
"Cologne, Nordrhein-Westfalen": 3,
"Uzhhorod, Zakarpattia Oblast": 5,
"Rivne, Rivne Oblast": 2,
"Vladivostok, Primorsky Krai": 2,
"Dnipro, Dnipropetrovsk Oblast": 6,
"Warsaw, Masovian Voivodeship": 13,
"Hoogeveen, Drenthe": 2,
"Stockholm, Stockholm County": 2,
"Dikanka, Poltava Oblast": 3,
"Chernivtsi, Chernivtsi Oblast": 6,
"Kraków, Lesser Poland Voivodeship": 2,
"Ivano-Frankivsk, Ivano-Frankivsk Oblast": 7,
"Hannoversch Münden, Niedersachsen": 2,
"Korotych, Kharkiv Oblast": 2,
"Ternopil, Ternopil Oblast": 5,
"Wroclaw, Lower Silesian Voivodeship": 8,
"Istanbul, Istanbul Province": 3,
"Toronto, Ontario": 2,
"Vinnytsia, Vinnytsia Oblast": 7,
"Frankfurt, Hessen": 2,
"Mukacheve, Zakarpattia Oblast": 2,
"Gdansk, Pomeranian Voivodeship": 2,
"Lyubotyn, Kharkiv Oblast": 2,
"Chortkiv, Ternopil Oblast": 2,
"Poltava, Poltava Oblast": 11,
"Okhtyrka, Sumy Oblast": 2
}
}
],
"title": "Audience City",
"description": "The cities of this profile's followers",
"id": "00000000000000000/insights/audience_city/lifetime"
},
{
"name": "audience_country",
"period": "lifetime",
"values": [
{
"value": {
"DE": 38,
"BE": 2,
"RU": 7,
"PT": 5,
"DK": 1,
"HR": 2,
"FR": 3,
"UA": 252,
"HU": 1,
"QA": 1,
"BR": 2,
"SE": 4,
"SK": 1,
"GB": 6,
"IE": 2,
"GE": 2,
"CA": 4,
"US": 4,
"EE": 1,
"IL": 2,
"AE": 1,
"CH": 3,
"MX": 1,
"CN": 1,
"IT": 2,
"ES": 8,
"AT": 1,
"CZ": 5,
"PH": 1,
"PK": 1,
"PL": 32,
"RO": 1,
"TR": 7,
"NL": 11,
"BA": 1
}
}
],
"title": "Audience Country",
"description": "The countries of this profile's followers",
"id": "00000000000000000/insights/audience_country/lifetime"
},
{
"name": "audience_gender_age",
"period": "lifetime",
"values": [
{
"value": {
"F.18-24": 15,
"F.25-34": 117,
"F.35-44": 15,
"F.45-54": 1,
"F.55-64": 3,
"F.65+": 2,
"M.18-24": 19,
"M.25-34": 135,
"M.35-44": 33,
"M.45-54": 2,
"M.55-64": 2,
"M.65+": 2,
"U.13-17": 1,
"U.18-24": 10,
"U.25-34": 55,
"U.35-44": 3,
"U.65+": 1
}
}
],
"title": "Gender and Age",
"description": "The gender and age distribution of this profile's followers",
"id": "00000000000000000/insights/audience_gender_age/lifetime"
},
{
"name": "audience_locale",
"period": "lifetime",
"values": [
{
"value": {
"it_IT": 1,
"es_LA": 1,
"ru_RU": 163,
"pl_PL": 7,
"da_DK": 1,
"tr_TR": 2,
"fr_FR": 3,
"de_DE": 6,
"ar_AR": 1,
"en_GB": 7,
"ru_UA": 1,
"en_US": 133,
"uk_UA": 84,
"zh_CN": 1,
"es_ES": 2,
"pt_PT": 1
}
}
],
"title": "Location",
"description": "The locales by country codes of this profile's followers",
"id": "00000000000000000/insights/audience_locale/lifetime"
},
{
"name": "online_followers",
"period": "lifetime",
"values": [
{
"value": {
},
"end_time": "2022-08-31T07:00:00+0000"
}
],
"title": "Online Followers",
"description": "Total number of this profile's followers that were online during the specified period",
"id": "00000000000000000/insights/online_followers/lifetime"
}
]
}Архітектура
Analytics planner
Потрібно також зробити планер, який буде додавати Instagram id в чергу на оновлення аналітики користувачів, раз на добу або раз на годину в залежності від типу аналітики
Acceptance criteria:
- Використовується останній Yarn package manager.
- Використовується остання стабільна версія NodeJS.
- Raw MongoDB driver використовуєтьяс для з'єднання з MongoDB.
- Analytics daemon створюється як пакет всередені yarn workspace.
- Analytics Data (followers_analytics) зберігаєтьяс в MongoDB як time series collection https://www.mongodb.com/docs/manual/core/timeseries-collections/
- Analytics daemon збирає дані щогодини та використовує чергу щоб визначити які саме Інстаграм профілі потрібно оновити. Профілі додаються в чергу щогодини. Черга може бути поділена поміж декількох копій демона.
- Mongo Collection має використовуватися як черга (якщо можливо). Якщо це неможливо, використовувати Kafka фбо RabbitMq(краще Kafka).
Client's review of cooperation with Andrii Tsapenko
Написати Node.js демон для роботи з Instagram Graph APIEverything was fast and good. I recommend it. Thank you !
Freelancer's review of cooperation with Konstantin Rogovenko
Написати Node.js демон для роботи з Instagram Graph APIA very professional customer, it was pleasant to work together. Immediately clearly placed TZ with all the details, on the additional questions quickly answered, the work was checked as well quickly and immediately completed the project, paid the reward. I strongly recommend cooperation.
-
3232 37 3 Good Morning, Constantine
I am interested in your project, I have all the necessary competences to perform it and realize it with all the requirements and with high quality code.
You have a very detailed TZ, pleasant that you can immediately analyze all the details, this is a rarity. But there’s still one incomprehensible detail, which is also noted by Roman – what is the mechanism of getting new Instagram IDs in the Analytics planner? Should it be the rest of the fire?
In addition, all the details of the project are clear, the turn can be realised in the Mongo collection, this is not a problem. I’ve already considered a deep project, but this moment will need to be discussed. If this is not necessary, then the price will be reduced, or if there are any additional details of this, it may be slightly increased.
I’ve already prepared a table with a decomposition of the project with an estimate of the time of each point. Write to me, and I will send it to you so that you understand how the price for the project was formed.
I will be happy to work together, write and I will do everything in the best way.
-
1558 10 1 1 I have been working on web development for more than 3 years.
You can be sure that the work will be done properly.
Web developer
Summary of Qualifications
More than 3 years experience in developing Full-Stack on JavaScript.
Language: HTML, CSS and JavaScript
The platform: Node.js
Library: React.js and Bootstrap
… Frameworks: Angular 2, Express.js and LoopBack.
I am a very dedicated and responsible person.
You can be sure that your work will be done in time and quality.
The Habits
Programming Languages / Technology
• JavaScript
HTML / CSS
• TypeScript
The Node.js
The MongoDB
The MySQL
Postgresql
The rest of fire
The Axios
• Express
The Socket.io
Development Tools
The Git
The ESLINT
The Webpack
The Bitbucket
• Stylized components
The React.js
The Redux
The Redux-Saga
The Bootstrap
General Skills
• OOP
Instruments of management
by Jira
• Slack
The Trello
Languages
English - Free
Ukrainian - Rhodes
Russian - Free
If the price does not rise, we can agree.
-
558 10 4 Good Morning, Constantine, interested in your project linked to Instagram and Facebook analytics!
The task is understood!
I have a few clarifications: how will the devil get users? What do you mean by dividing the order into a few copies of the demon?
Do I understand what you say about receiving users from the file? And a few demons - do you mean launched a few projects?
I will be happy to cooperate!
-
Добрий день, Костя. Чому ви повторно опублікували цей проект українською мовою? Які ваші очікування по ціні і тривалості виконання?
-
Current freelance projects in the category Databases & SQL
Setting up a backup system and optimizing server infrastructureObjective of the work: Ensure reliable data storage for the CRM system and application by implementing an automated backup system, as well as carry out a series of server improvements to enhance the stability, security, and performance of the infrastructure. DevOps, Databases & SQL ∙ 11 minutes back ∙ 6 proposals |
PIM system
225 USD
A PIM system needs to be created. The number of products is several million. There are several suppliers providing data in different formats: csv, xml, API. The data is limited, and often it is necessary to find product characteristics from other sources and supplement them. A… Databases & SQL, Web Programming ∙ 2 hours 9 minutes back ∙ 27 proposals |
Integration of BAS Shveyka 8
225 USD
Good day, it is necessary to integrate BAS Shveyka 8, connect the website and CRM Sales Drive, set up reports and other data. Databases & SQL ∙ 3 hours 14 minutes back ∙ 6 proposals |
Create a dashboard in https://airtable.com/ for the performance of advertising creatives from Facebook ads.Full specification https://docs.google.com/document/d/1_n_oYRNZWYxalUA---DM5AD1b5ZSrtePw5J4G42svGw/edit?usp=sharing Databases & SQL, Data Parsing ∙ 22 hours 2 minutes back ∙ 16 proposals |
Vibe coding through Claude Code
350 USD
Develop a closed web platform for corporate events with personal invitations via unique links and QR codes. After scanning the QR code, the user is directed to a personal invitation page with a welcome message, a greeting by name, a photo and a message from the CEO, a countdown… AI Art, Databases & SQL ∙ 1 day 1 hour back ∙ 42 proposals |
