{"id":480440,"date":"2026-05-20T16:23:04","date_gmt":"2026-05-20T16:23:04","guid":{"rendered":"https:\/\/savepearlharbor.com\/?p=480440"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=480440","title":{"rendered":"\u041a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u043c\u0443 \u0431\u0438\u0437\u043d\u0435\u0441\u0443 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432"},"content":{"rendered":"<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u043e\u043a\u0430 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0443\u0441\u043b\u0443\u0433\u0435 \u0441\u0432\u0435\u0436\u0435\u0435, \u043a\u043b\u0438\u0435\u043d\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043c\u043d\u0438\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u0438 \u043e\u0445\u043e\u0442\u043d\u0435\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u044c\u044e. \u0411\u0438\u0437\u043d\u0435\u0441\u0443 \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043b\u0430\u0431\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445.<\/p>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u043b\u043e, \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438\u0445 \u043e\u0431\u0437\u0432\u043e\u043d\u0438\u0442\u044c: \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c, \u0432\u0441\u0451 \u043b\u0438 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0438 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b. \u041f\u0440\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442: \u0437\u0432\u043e\u043d\u043a\u0438 \u043e\u0442\u043d\u0438\u043c\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0447\u0430\u0441\u0442\u044c \u0432\u0438\u0437\u0438\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0430 \u0431\u0438\u0437\u043d\u0435\u0441 \u0443\u0437\u043d\u0430\u0451\u0442 \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043e\u0442\u0437\u044b\u0432 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u0443\u0445\u0443\u0434\u0448\u0438\u0432 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0432\u043e\u043d\u043a\u0438. \u041a\u043b\u0438\u0435\u043d\u0442\u0443, \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u043c\u0443 \u0443\u0441\u043b\u0443\u0433\u0443,\u00a0 \u0437\u0432\u043e\u043d\u0438\u0442 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0439 \u0440\u043e\u0431\u043e\u0442 \u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0430\u043d\u043a\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u043f\u0440\u043e\u0441\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0430 \u0435\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u0435\u043d, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0421\u041c\u0421 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438.<\/p>\n<p><em>\u0421\u0442\u0435\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044f: Python 3.10+, Flask, requests, python-dotenv, SQLite, YCLIENTS API, \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0439 \u0440\u043e\u0431\u043e\u0442 \u0438 SMS API \u041c\u0422\u0421 Exolve, MWS Tables.<\/em><\/p>\n<h3>\u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b<\/h3>\n<p>\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 YCLIENTS \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0438\u0437\u0438\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u043c. \u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u0435\u0431\u0445\u0443\u043a, \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0432\u0438\u0437\u0438\u0442\u0443 \u0435\u0449\u0451 \u043d\u0435 \u0431\u044b\u043b\u043e \u0437\u0432\u043e\u043d\u043a\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0432\u043e\u043d\u0438\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0438 \u0437\u0430\u0434\u0430\u0451\u0442 \u0442\u0440\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430: \u043a\u0430\u043a \u043e\u043d \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0443\u0441\u043b\u0443\u0433\u0443, \u0446\u0435\u043d\u0443 \u0438 \u0433\u043e\u0442\u043e\u0432 \u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f. \u0422\u0430\u043a\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0437\u0432\u043e\u043d\u043e\u043a \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c \u0438 \u0434\u0430\u0451\u0442 \u0431\u0438\u0437\u043d\u0435\u0441\u0443 \u043e\u0446\u0435\u043d\u043a\u0443 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b, \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0440\u0438\u0441\u043a \u043f\u043e\u0442\u0435\u0440\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043a\u043e\u043b\u0431\u044d\u043a, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0448\u0430\u0433 \u043e\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u0432\u0438\u0437\u0438\u0442\u0430 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435. \u0415\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b \u0438\u043b\u0438 \u0437\u0432\u043e\u043d\u043e\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u0446\u0435\u043d\u043a\u0430 \u0443\u0441\u043b\u0443\u0433\u0438 \u043d\u0438\u0437\u043a\u0430\u044f, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0421\u041c\u0421, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0432\u0438\u0437\u0438\u0442\u0443 \u0432\u0438\u0434\u043d\u043e, \u0434\u043e\u0448\u0451\u043b \u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043e\u043f\u0440\u043e\u0441\u0430 \u0438 \u043a\u0430\u043a\u0430\u044f \u0431\u044b\u043b\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c.<\/p>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c Flask-\u0441\u0435\u0440\u0432\u0438\u0441\u0435, \u0442\u0440\u0451\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435.<\/p>\n<p>YCLIENTS \u0445\u0440\u0430\u043d\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0438\u0437\u0438\u0442\u0430 \u0438 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043e \u0435\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438. SQLite \u0445\u0440\u0430\u043d\u0438\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430: \u0441\u0442\u0430\u0442\u0443\u0441, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0432\u043e\u043d\u043a\u0430, \u043e\u0442\u0432\u0435\u0442\u044b \u043f\u043e \u0448\u0430\u0433\u0430\u043c \u0438 \u043e\u0442\u043c\u0435\u0442\u043a\u0443 \u043e\u0431 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0430\u043b\u0435\u0440\u0442\u0430. MWS Tables \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0443\u0436\u0435 \u0438\u0442\u043e\u0433 \u043f\u043e \u0432\u0438\u0437\u0438\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d.<\/p>\n<p>App.py \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c\u0438 \u0432\u0438\u0437\u0438\u0442\u0430: \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0435\u0431\u0445\u0443\u043a\u0438, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u044e\u0447 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u2014 visit_id. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0432\u043e\u043d\u043a\u0430 \u043d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043b\u0431\u044d\u043a \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043a \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.<\/p>\n<p>\u0412\u043d\u0435\u0448\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b: yclients_api.py \u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0438\u0437\u0438\u0442 \u0438\u0437 YCLIENTS, exolve_voice.py \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0437\u0432\u043e\u043d\u043e\u043a, sms_alerts.py \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0421\u041c\u0421, tables_api.py \u043f\u0438\u0448\u0435\u0442 \u0438\u0442\u043e\u0433 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<h3>\u041f\u0440\u0435\u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442<\/h3>\n<p>\u041d\u0443\u0436\u0435\u043d Python 3.10+: \u0432 \u043a\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 str | None. \u0422\u043e\u043a\u0435\u043d\u044b, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u043e\u0440\u043e\u0433 \u043d\u0438\u0437\u043a\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 .env.<\/p>\n<pre><code class=\"bash\">python -m venv .venvsource .venv\/bin\/activatepip install -r requirements.txt<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:87px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">WEBHOOK_SECRET=change-meYCLIENTS_BASE_URL=https:\/\/api.yclients.com\/api\/v1YCLIENTS_PARTNER_TOKEN=***YCLIENTS_USER_TOKEN=***MWS_TABLES_BASE_URL=https:\/\/tables.mws.ruMWS_TABLES_API_KEY=***MWS_TABLE_ID=***MWS_VIEW_ID=***EXOLVE_API_KEY=***EXOLVE_CAMPAIGN_ID=***EXOLVE_CAMPAIGN_URL=https:\/\/api.exolve.ru\/campaign\/v1\/CallEXOLVE_SENDER=SalonBotOWNER_ALERT_PHONE=79990001122LOW_SCORE_THRESHOLD=2DB_NAME=salon_quality.db<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u043b\u044f \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 MWS Tables \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 quality_results_table \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p>visit_id \u2014 \u0441\u0442\u0440\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>client_name \u2014 \u0441\u0442\u0440\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>master_name \u2014 \u0441\u0442\u0440\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>branch_name \u2014 \u0441\u0442\u0440\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>visit_at \u2014 \u0434\u0430\u0442\u0430\/\u0432\u0440\u0435\u043c\u044f<\/p>\n<\/li>\n<li>\n<p>service_score \u2014 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/li>\n<li>\n<p>price_score \u2014 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/li>\n<li>\n<p>return_intent \u2014 \u0447\u0438\u0441\u043b\u043e<\/p>\n<\/li>\n<li>\n<p>survey_status \u2014 \u0441\u0442\u0440\u043e\u043a\u0430<\/p>\n<\/li>\n<li>\n<p>alert_sent \u2014 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u043e\u043b\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u043e\u0434\u0435 \u0441\u0435\u043a\u0440\u0435\u0442 \u0432\u0435\u0431\u0445\u0443\u043a\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 token, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0430\u043c URL \u0432\u0435\u0431\u0445\u0443\u043a\u0430 \u0442\u043e\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0432\u0435\u0442\u0438\u0442\u044c. \u041a\u043b\u044e\u0447\u0438 API \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 python-dotenv.<\/p>\n<h3>\u0428\u0430\u0433 1. \u041f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435<\/h3>\n<p>\u041e\u043f\u0440\u043e\u0441 \u043d\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u043d\u0443\u0436\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0432\u0438\u0437\u0438\u0442\u0443. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u0435\u0440\u0436\u0438\u0442 \u0432 Config \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 surveys. \u0412 \u043d\u0435\u0439 \u043b\u0435\u0436\u0430\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u0438\u0437\u0438\u0442\u0430 \u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u043e\u043f\u0440\u043e\u0441\u0430: status, call_id, \u0442\u0440\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0438 alert_sent. \u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430 visit_id \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u043e\u0442 \u0434\u0443\u0431\u043b\u0435\u0439.<\/p>\n<pre><code class=\"python\"># config.pyfrom dotenv import load_dotenvimport osload_dotenv()class Config:   WEBHOOK_SECRET = os.environ.get(\"WEBHOOK_SECRET\", \"super-secret-token\")   YCLIENTS_BASE_URL = os.environ.get(\"YCLIENTS_BASE_URL\", \"https:\/\/api.yclients.com\/api\/v1\")   YCLIENTS_PARTNER_TOKEN = os.environ.get(\"YCLIENTS_PARTNER_TOKEN\", \"***\")   YCLIENTS_USER_TOKEN = os.environ.get(\"YCLIENTS_USER_TOKEN\", \"***\")   MWS_TABLES_BASE_URL = os.environ.get(\"MWS_TABLES_BASE_URL\", \"https:\/\/tables.mws.ru\")   MWS_TABLES_API_KEY = os.environ.get(\"MWS_TABLES_API_KEY\", \"***\")   MWS_TABLE_ID = os.environ.get(\"MWS_TABLE_ID\", \"***\")   MWS_VIEW_ID = os.environ.get(\"MWS_VIEW_ID\", \"***\")   EXOLVE_API_KEY = os.environ.get(\"EXOLVE_API_KEY\", \"your_exolve_key\")   EXOLVE_CAMPAIGN_ID = os.environ.get(\"EXOLVE_CAMPAIGN_ID\", \"***\")   EXOLVE_CAMPAIGN_URL = os.environ.get(\"EXOLVE_CAMPAIGN_URL\", \"https:\/\/api.exolve.ru\/campaign\/v1\/Call\")   EXOLVE_SENDER = os.environ.get(\"EXOLVE_SENDER\", \"SalonBot\")   OWNER_ALERT_PHONE = os.environ.get(\"OWNER_ALERT_PHONE\", \"79990001122\")   LOW_SCORE_THRESHOLD = int(os.environ.get(\"LOW_SCORE_THRESHOLD\", 2))   DB_NAME = os.environ.get(\"DB_NAME\", \"salon_quality.db\")<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0438\u0436\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430.  <\/p>\n<pre><code class=\"python\"># database.pydef init_db():   with get_conn() as conn:       conn.execute(\"\"\"       CREATE TABLE IF NOT EXISTS surveys (           visit_id TEXT PRIMARY KEY,           client_name TEXT,           client_phone TEXT,           master_name TEXT,           branch_name TEXT,           visit_at TEXT,           status TEXT NOT NULL,           call_id TEXT,           q1_service_score INTEGER,           q2_price_score INTEGER,           q3_return_intent INTEGER,           alert_sent INTEGER NOT NULL DEFAULT 0,           created_at INTEGER NOT NULL,           updated_at INTEGER NOT NULL       )       \"\"\")       conn.commit()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u042d\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u0438\u0437\u0438\u0442\u0430 \u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u0431\u0435\u0437 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0436\u0443\u0440\u043d\u0430\u043b\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.<\/p>\n<p>\u0421\u0435\u0440\u0432\u0438\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u044b:<\/p>\n<ul>\n<li>\n<p>NEW \u2014 \u0432\u0438\u0437\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u043e\u043f\u0440\u043e\u0441 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d<\/p>\n<\/li>\n<li>\n<p>CALL_STARTED \u2014 \u0437\u0432\u043e\u043d\u043e\u043a \u0437\u0430\u043f\u0443\u0449\u0435\u043d<\/p>\n<\/li>\n<li>\n<p>Q1_ANSWERED \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441<\/p>\n<\/li>\n<li>\n<p>Q2_ANSWERED \u2014 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439<\/p>\n<\/li>\n<li>\n<p>Q3_ANSWERED \u2014 \u0438 \u043d\u0430 \u0442\u0440\u0435\u0442\u0438\u0439<\/p>\n<\/li>\n<li>\n<p>COMPLETED \u2014 \u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d<\/p>\n<\/li>\n<li>\n<p>NO_ANSWER \u2014 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b<\/p>\n<\/li>\n<li>\n<p>FAILED \u2014 \u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432 \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0437\u0432\u043e\u043d\u043a\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<ul>\n<li>\n<p>NEW -&gt; CALL_STARTED -&gt; Q1_ANSWERED -&gt; Q2_ANSWERED -&gt; Q3_ANSWERED -&gt; COMPLETED<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b:<\/p>\n<ul>\n<li>\n<p>NEW -&gt; CALL_STARTED -&gt; NO_ANSWER<\/p>\n<\/li>\n<\/ul>\n<p>\u0415\u0441\u043b\u0438 \u0437\u0432\u043e\u043d\u043e\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<ul>\n<li>\n<p>NEW -&gt; CALL_STARTED -&gt; FAILED<\/p>\n<\/li>\n<\/ul>\n<h3>\u0428\u0430\u0433 2. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u0432\u0438\u0437\u0438\u0442 \u0438\u0437 YCLIENTS<\/h3>\n<p>\u0412\u0435\u0431\u0445\u0443\u043a YCLIENTS \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0438\u0437\u0438\u0442 \u0437\u0430\u043a\u0440\u044b\u0442. \u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 token, \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 attendance == 1 \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u0432\u0438\u0437\u0438\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 get_visit(). \u0412 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0411\u0414 \u043e\u043d \u043f\u0438\u0448\u0435\u0442 \u0443\u0436\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432\u0435\u0431\u0445\u0443\u043a\u0430:<\/p>\n<pre><code class=\"json\">{ \"id\": \"98765\", \"company_id\": \"12345\", \"attendance\": 1}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0438\u0436\u0435 \u0441\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u044d\u0442\u043e\u0433\u043e \u0432\u0435\u0431\u0445\u0443\u043a\u0430.  <\/p>\n<pre><code class=\"python\"># app.py@app.route(\"\/webhook\/yclients\/visit\", methods=[\"POST\"])def yclients_webhook():   if request.args.get(\"token\") != Config.WEBHOOK_SECRET:       return \"Forbidden\", 403   data = request.get_json(silent=True) or {}   visit_id = str(data.get(\"id\") or \"\")   company_id = str(data.get(\"company_id\") or \"\")   if not visit_id or not company_id:       return \"Bad Request: visit_id or company_id missing\", 400   if data.get(\"attendance\") != 1:       return jsonify({\"status\": \"ignored_status\"}), 200   visit_raw = get_visit(company_id, visit_id)   visit = normalize_visit(visit_raw)   if not visit[\"client_phone\"]:      return jsonify({\"status\": \"invalid_phone\"}), 200   created = create_survey_if_new(visit)   if not created:      return jsonify({\"status\": \"duplicate\"}), 200<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 YCLIENTS \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0443\u0436\u0435 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0432\u0438\u0437\u0438\u0442\u0430.  <\/p>\n<pre><code class=\"python\"># yclients_api.pydef normalize_phone(phone: str | None) -&gt; str | None:   if not phone:       return None   digits = \"\".join(ch for ch in str(phone) if ch.isdigit())   if len(digits) == 11 and digits.startswith(\"8\"):       digits = \"7\" + digits[1:]   return digits if len(digits) == 11 and digits.startswith(\"7\") else Nonedef normalize_visit(visit: dict) -&gt; dict:   return {       \"visit_id\": str(visit.get(\"id\")),       \"client_name\": visit.get(\"client\", {}).get(\"name\"),       \"client_phone\": normalize_phone(visit.get(\"client\", {}).get(\"phone\")),       \"master_name\": visit.get(\"staff\", {}).get(\"name\"),       \"branch_name\": visit.get(\"company\", {}).get(\"title\"),       \"visit_at\": visit.get(\"datetime\")   }<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430 \u0432\u0438\u0437\u0438\u0442\u0430 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c, \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u043c, \u0444\u0438\u043b\u0438\u0430\u043b\u043e\u043c \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u0435\u0431\u0445\u0443\u043a \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u0443\u0431\u043b\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a visit_id. \u0415\u0441\u043b\u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 invalid_phone. \u0417\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u043c \u0432\u0438\u0437\u0438\u0442 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e attendance == 1.<\/p>\n<h3>\u0428\u0430\u0433 3. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0439 \u043e\u043f\u0440\u043e\u0441 \u0447\u0435\u0440\u0435\u0437 \u041c\u0422\u0421 Exolve<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0432\u0438\u0437\u0438\u0442 \u0443\u0436\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0441\u0435\u0440\u0432\u0438\u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0443\u044e \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u044e \u0432 \u041c\u0422\u0421 Exolve.<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2f4\/06f\/cbc\/2f406fcbccc676702109af0ac53f72bf.png\" alt=\"\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0441\u0445\u0435\u043c\u044b \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430 \u041c\u0422\u0421 Exolve  \" title=\"\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0441\u0445\u0435\u043c\u044b \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430 \u041c\u0422\u0421 Exolve  \" width=\"1249\" height=\"831\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/2f4\/06f\/cbc\/2f406fcbccc676702109af0ac53f72bf.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2f4\/06f\/cbc\/2f406fcbccc676702109af0ac53f72bf.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0441\u0445\u0435\u043c\u044b \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430 \u041c\u0422\u0421 Exolve<\/em>  <\/figcaption><\/div>\n<\/figure>\n<p>\u0412 \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u043d\u043e \u0438 initialData.visit_id. \u042d\u0442\u043e\u0442 \u043a\u043b\u044e\u0447 \u043d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043b\u0431\u044d\u043a \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u0432\u0438\u0437\u0438\u0442\u043e\u043c. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043e\u0442 \u041c\u0422\u0421 Exolve \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 call_id \u043a\u0430\u043a \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0432\u043e\u043d\u043a\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u0442\u0430\u0442\u0443\u0441 CALL_STARTED.  <\/p>\n<pre><code class=\"python\"># exolve_voice.pydef start_quality_campaign(phone: str, visit_id: str) -&gt; dict:   headers = {\"Authorization\": f\"Bearer {Config.EXOLVE_API_KEY}\", \"Content-Type\": \"application\/json\"}   payload = {       \"campaign_id\": Config.EXOLVE_CAMPAIGN_ID,       \"params\": {           \"destination\": phone,           \"initialData\": {\"visit_id\": visit_id}       }   }   resp = requests.post(Config.EXOLVE_CAMPAIGN_URL, headers=headers, json=payload, timeout=20)   resp.raise_for_status()   return resp.json()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0432\u043e\u043d\u043a\u0430 \u0432 SQLite \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0432\u0438\u0437\u0438\u0442 \u0432 \u0441\u0442\u0430\u0442\u0443\u0441 CALL_STARTED.<\/p>\n<pre><code class=\"python\"># app.pyresponse = start_quality_campaign(visit[\"client_phone\"], visit[\"visit_id\"])call_id = response.get(\"call_id\") or response.get(\"id\")update_survey_status(visit[\"visit_id\"], \"CALL_STARTED\", call_id=call_id)return jsonify({\"status\": \"accepted\"}), 200<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0437\u0432\u043e\u043d\u043e\u043a \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0434\u0432\u0430 \u043a\u043b\u044e\u0447\u0430: \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0432\u0438\u0437\u0438\u0442\u0430 \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0432\u043e\u043d\u043a\u0430. \u0415\u0441\u043b\u0438 \u0432\u044b\u0437\u043e\u0432 \u043a \u041c\u0422\u0421 Exolve \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0438\u0437-\u0437\u0430 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 \u043d\u0435 \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u043e\u0439 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0432\u0435\u0431\u0445\u0443\u043a YCLIENTS \u043d\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u0448\u0442\u0430\u0442\u043d\u043e. \u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u044f\u043c\u043e\u0435: \u0432\u044b\u0437\u043e\u0432 \u043a \u041c\u0422\u0421 Exolve \u0438\u0434\u0451\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0435\u0431\u0445\u0443\u043a\u0430.<\/p>\n<h3>\u0428\u0430\u0433 4. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u043e\u0442\u0432\u0435\u0442\u044b DTMF \u0438 \u0432\u0435\u0434\u0451\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430<\/h3>\n<p>\u0412\u043e \u0432\u0442\u043e\u0440\u043e\u043c \u0432\u0435\u0431\u0445\u0443\u043a\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0435 \u0438\u0442\u043e\u0433 \u043e\u043f\u0440\u043e\u0441\u0430 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0448\u0430\u0433\u0438: \u0432\u043e\u043f\u0440\u043e\u0441, \u0446\u0438\u0444\u0440\u0443 \u043e\u0442\u0432\u0435\u0442\u0430 \u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u0437\u0432\u043e\u043d\u043a\u0430. q1_service_score \u0445\u0440\u0430\u043d\u0438\u0442 \u043e\u0446\u0435\u043d\u043a\u0443 \u0443\u0441\u043b\u0443\u0433\u0438, q2_price_score \u2014 \u043e\u0446\u0435\u043d\u043a\u0443 \u0446\u0435\u043d\u044b, q3_return_intent \u2014 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u044c \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f. \u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0442\u043a\u0438 NO_ANSWER \u0438 FAILED \u043d\u0443\u0436\u043d\u044b, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0431\u043e\u044f.<\/p>\n<p>\u041c\u0430\u0440\u0448\u0440\u0443\u0442 \/webhook\/exolve\/survey \u0441\u043d\u043e\u0432\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 token, \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u043b\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 normalize_callback, \u0438\u0449\u0435\u0442 \u043e\u043f\u0440\u043e\u0441 \u043f\u043e call_id \u0438\u043b\u0438 visit_id, \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 dtmf_digit \u0432 \u0447\u0438\u0441\u043b\u043e \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0432 \u043e\u0434\u043d\u043e \u0438\u0437 \u0442\u0440\u0451\u0445 \u043f\u043e\u043b\u0435\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u043b\u0431\u044d\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439:<\/p>\n<pre><code class=\"json\">{ \"visit_id\": \"98765\", \"call_id\": \"call_001\", \"current_step\": \"q2\", \"dtmf_digit\": \"4\", \"result_status\": \"COMPLETED\"}<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043b\u0431\u044d\u043a \u043a \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u043c\u0443 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0443.  <\/p>\n<pre><code class=\"python\"># exolve_voice.pydef normalize_callback(payload: dict) -&gt; dict:   return {       \"call_id\": payload.get(\"call_id\"),       \"visit_id\": payload.get(\"visit_id\"),       \"step\": payload.get(\"current_step\"),       \"digit\": payload.get(\"dtmf_digit\"),       \"result_status\": payload.get(\"result_status\")   }<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043f\u044f\u0442\u044c \u043f\u043e\u043b\u0435\u0439: \u0448\u0430\u0433, \u0446\u0438\u0444\u0440\u0430, \u0441\u0442\u0430\u0442\u0443\u0441, visit_id \u0438 call_id.  <\/p>\n<pre><code class=\"python\"># app.pyif cb.get(\"result_status\") == \"NO_ANSWER\":   update_survey_status(visit_id, \"NO_ANSWER\")   return jsonify({\"status\": \"processed\"}), 200if cb.get(\"result_status\") == \"FAILED\":   update_survey_status(visit_id, \"FAILED\")   return jsonify({\"status\": \"processed\"}), 200 if step == \"q1\":   update_survey_status(visit_id, \"Q1_ANSWERED\", q1_service_score=digit)   return jsonify({\"status\": \"step_saved\"}), 200if step == \"q2\":   update_survey_status(visit_id, \"Q2_ANSWERED\", q2_price_score=digit)   return jsonify({\"status\": \"step_saved\"}), 200 if step == \"q3\":   update_survey_status(visit_id, \"Q3_ANSWERED\", q3_return_intent=digit)   finalize_survey(visit_id)   return jsonify({\"status\": \"step_saved\"}), 200<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u043b\u0438\u0431\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u043e\u0442\u0432\u0435\u0442, \u043b\u0438\u0431\u043e \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u043e\u043f\u0440\u043e\u0441 \u0432 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441. \u041f\u0440\u0438\u043a\u043b\u0430\u0434\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0437\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u0435: 404, \u0435\u0441\u043b\u0438 \u0432\u0438\u0437\u0438\u0442 \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d, \u0438 400, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0448\u0451\u043b \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u0439 \u0448\u0430\u0433 \u0438\u043b\u0438 \u0446\u0438\u0444\u0440\u0430. \u041a\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e int, \u043d\u043e \u043d\u0435 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043e\u0446\u0435\u043d\u043a\u0438.<\/p>\n<h3>\u0428\u0430\u0433 5. \u0424\u0438\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043e\u043f\u0440\u043e\u0441, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0421\u041c\u0421 \u0438 \u043f\u0438\u0448\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443<\/h3>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0441\u0435\u0440\u0432\u0438\u0441 \u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 SQLite, \u043f\u0440\u0438 \u043d\u0438\u0437\u043a\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0421\u041c\u0421 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443 \u0438 \u0437\u0430\u0442\u0435\u043c \u043f\u0438\u0448\u0435\u0442 \u0438\u0442\u043e\u0433 \u043f\u043e \u0432\u0438\u0437\u0438\u0442\u0443 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<figure class=\"full-width \"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/469\/411\/1d3\/4694111d39b290334ffeae6428557928.png\" alt=\"\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0438\u0437 MWS Tables \" title=\"\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0438\u0437 MWS Tables \" width=\"1388\" height=\"289\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/469\/411\/1d3\/4694111d39b290334ffeae6428557928.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/469\/411\/1d3\/4694111d39b290334ffeae6428557928.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0438\u0437 MWS Tables<\/em> <\/figcaption><\/div>\n<\/figure>\n<p>\u0424\u0443\u043d\u043a\u0446\u0438\u044f finalize_survey \u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u0437 \u0411\u0414 \u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0446\u0435\u043d\u043a\u0443. \u0415\u0441\u043b\u0438 q1_service_score \u043c\u0435\u043d\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u0435\u043d LOW_SCORE_THRESHOLD, \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 send_low_score_alert \u0447\u0435\u0440\u0435\u0437 SMS API \u041c\u0422\u0421 Exolve. \u0417\u0430\u0442\u0435\u043c \u0438\u0437 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442 \u0438\u0442\u043e\u0433 \u043f\u043e \u0432\u0438\u0437\u0438\u0442\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0433\u043e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"python\"># app.pydef finalize_survey(visit_id: str):   survey = get_survey(visit_id)   if not survey:       return   is_alert_sent = False   if survey[\"q1_service_score\"] is not None and survey[\"q1_service_score\"] &lt;= Config.LOW_SCORE_THRESHOLD:   try:       send_low_score_alert(           survey[\"master_name\"],           survey[\"client_name\"],           survey[\"q1_service_score\"]       )       is_alert_sent = True   except Exception:       is_alert_sent = False   record = {       \"visit_id\": survey[\"visit_id\"],       \"client_name\": survey[\"client_name\"],       \"master_name\": survey[\"master_name\"],       \"branch_name\": survey[\"branch_name\"],       \"visit_at\": survey[\"visit_at\"],       \"service_score\": survey[\"q1_service_score\"],       \"price_score\": survey[\"q2_price_score\"],       \"return_intent\": survey[\"q3_return_intent\"],       \"survey_status\": \"COMPLETED\",       \"alert_sent\": is_alert_sent   }<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 app.py \u0443\u0436\u0435 \u0441\u043e\u0431\u0440\u0430\u043b \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 record. \u0414\u0430\u043b\u044c\u0448\u0435 \u043e\u0434\u0438\u043d \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0421\u041c\u0421 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u043f\u0438\u0448\u0435\u0442 \u0438\u0442\u043e\u0433 \u043f\u043e \u0432\u0438\u0437\u0438\u0442\u0443 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.<\/p>\n<pre><code class=\"python\"># sms_alerts.pyheaders = {\"Authorization\": f\"Bearer {Config.EXOLVE_API_KEY}\", \"Content-Type\": \"application\/json\"}payload = {\"number\": Config.EXOLVE_SENDER, \"destination\": Config.OWNER_ALERT_PHONE, \"text\": text}resp = requests.post(url, headers=headers, json=payload, timeout=20)resp.raise_for_status()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0412 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0443\u0445\u043e\u0434\u0438\u0442 \u0443\u0436\u0435 \u0438\u0442\u043e\u0433 \u043f\u043e \u0432\u0438\u0437\u0438\u0442\u0443: \u043e\u0446\u0435\u043d\u043a\u0438, \u0441\u0442\u0430\u0442\u0443\u0441 \u043e\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0442\u043c\u0435\u0442\u043a\u0430 \u043e\u0431 \u0430\u043b\u0435\u0440\u0442\u0435.  <\/p>\n<pre><code class=\"python\"># tables_api.pyheaders = {\"Authorization\": f\"Bearer {Config.MWS_TABLES_API_KEY}\", \"Content-Type\": \"application\/json\"}payload = {   \"records\": [{\"fields\": record}],   \"fieldKey\": \"name\",}resp = requests.post(url, params=params, headers=headers, json=payload, timeout=20)resp.raise_for_status()<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041d\u0430 \u044d\u0442\u043e\u043c \u0448\u0430\u0433\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0421\u041c\u0421 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443 \u0438 \u043f\u0438\u0448\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. SQLite \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u0438\u0442\u043e\u0433 \u0443\u0436\u0435 \u0432 \u0422\u0430\u0431\u043b\u0438\u0446\u0430\u0445. \u0415\u0441\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0432\u044b\u0437\u043e\u0432 \u0432 \u044d\u0442\u043e\u043c \u0431\u043b\u043e\u043a\u0435 \u043f\u0430\u0434\u0430\u0435\u0442, \u0432\u0438\u0437\u0438\u0442 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 FAILED. \u041e\u0431\u0449\u0435\u0439 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u043c\u0435\u0436\u0434\u0443 \u0421\u041c\u0421, \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u0442.<\/p>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/h3>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0446\u0435\u043b\u0438\u043a\u043e\u043c, \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0442\u043e\u043a\u0435\u043d\u044b YCLIENTS, \u041c\u0422\u0421 Exolve \u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f .env \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u043d\u044f\u0442\u044c Flask-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u043b\u0438\u0431\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0432\u0438\u0437\u0438\u0442 \u0432 YCLIENTS, \u043b\u0438\u0431\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0435\u0431\u0445\u0443\u043a \u0432\u0440\u0443\u0447\u043d\u0443\u044e.<\/p>\n<pre><code class=\"bash\">python -m venv .venvsource .venv\/bin\/activatepip install -r requirements.txtflask --app app run --port 5000<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0432\u0440\u0443\u0447\u043d\u0443\u044e, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 \u0432\u0435\u0431\u0445\u0443\u043a YCLIENTS. \u041f\u0440\u0438 \u0432\u0430\u043b\u0438\u0434\u043d\u043e\u043c \u0441\u0435\u043a\u0440\u0435\u0442\u0435 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0442\u043e\u043a\u0435\u043d\u0430\u0445 \u043e\u0436\u0438\u0434\u0430\u0435\u043c {&#171;status&#187;:&#187;accepted&#187;}.<\/p>\n<pre><code class=\"bash\">curl -X POST \"http:\/\/127.0.0.1:5000\/webhook\/yclients\/visit?token=super-secret-token\" \\ -H \"Content-Type: application\/json\" \\ -d '{\"id\":\"98765\",\"company_id\":\"12345\",\"attendance\":1}'<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0430, \u043a\u043e\u043b\u0431\u044d\u043a \u043e\u0442 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u044d\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e. \u0414\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0443\u0434\u043e\u0431\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c visit_id \u0431\u0435\u0437 call_id, \u0442\u043e\u0433\u0434\u0430 \u043c\u0430\u0440\u0448\u0440\u0443\u0442 \u0438\u0449\u0435\u0442 \u043e\u043f\u0440\u043e\u0441 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043f\u043e \u0432\u0438\u0437\u0438\u0442\u0443. \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0432\u0435\u0431\u0445\u0443\u043a\u0430 \u0432 SQLite \u0443\u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u043b\u0435\u0436\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0430 \u0441\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c CALL_STARTED \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u043c call_id, \u0435\u0441\u043b\u0438 \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u044b\u0437\u043e\u0432 \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u0438 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0448\u0442\u0430\u0442\u043d\u043e.<\/p>\n<pre><code class=\"bash\">curl -X POST \"http:\/\/127.0.0.1:5000\/webhook\/exolve\/survey?token=super-secret-token\" \\ -H \"Content-Type: application\/json\" \\ -d '{\"visit_id\":\"98765\",\"current_step\":\"q1\",\"dtmf_digit\":\"2\",\"result_status\":\"COMPLETED\"}'<\/code><div class=\"code-explainer\"><a href=\"https:\/\/sourcecraft.dev\/\" class=\"tm-button code-explainer__link\" style=\"visibility: hidden;\"><img style=\"width:14px;height:14px;object-fit:cover;object-position:left;\"\/><\/a><\/div><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043a\u043e\u043b\u0431\u044d\u043a\u0430 \u0441 q1 \u0441\u0442\u0440\u043e\u043a\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 Q1_ANSWERED \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c q1_service_score. \u041f\u043e\u0441\u043b\u0435 \u043a\u043e\u043b\u0431\u044d\u043a\u0430 \u0441 q3 \u0441\u0435\u0440\u0432\u0438\u0441 \u043b\u0438\u0431\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442 \u043e\u043f\u0440\u043e\u0441 \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c COMPLETED \u0438 \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u043b\u0438\u0431\u043e \u043f\u043e\u043c\u0435\u0442\u0438\u0442 \u0432\u0438\u0437\u0438\u0442 \u043a\u0430\u043a FAILED, \u0435\u0441\u043b\u0438 \u0444\u0438\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0435 \u043f\u0440\u043e\u0448\u043b\u0430. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0432 \u0438\u0442\u043e\u0433\u0435 \u043d\u0443\u0436\u043d\u043e \u0442\u0440\u0438 \u0442\u043e\u0447\u043a\u0438: \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b status \u0432 SQLite, \u0421\u041c\u0421 \u043d\u0430 OWNER_ALERT_PHONE \u043f\u0440\u0438 \u043d\u0438\u0437\u043a\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0435 \u0438 \u0438\u0442\u043e\u0433\u043e\u0432\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043f\u043e\u0441\u043b\u0435 \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0448\u0430\u0433\u0430.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 4xx, \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 token, company_id, visit_id \u0438 \u0444\u043e\u0440\u043c\u0430\u0442 \u0446\u0438\u0444\u0440\u044b. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 5xx, \u043f\u0440\u0438\u0447\u0438\u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u0432 \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u0435 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 YCLIENTS, \u041c\u0422\u0421 Exolve \u0438\u043b\u0438 \u0422\u0430\u0431\u043b\u0438\u0446.<\/p>\n<h3>\u0412 \u0438\u0442\u043e\u0433\u0435<\/h3>\n<p>\u0422\u0430\u043a\u043e\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0431\u0438\u0437\u043d\u0435\u0441\u0443 \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043e\u0431\u0440\u0430\u0442\u043d\u0443\u044e \u0441\u0432\u044f\u0437\u044c \u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044f \u0443\u0437\u043d\u0430\u0451\u0442 \u043e \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u043e\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u0443\u0441\u043b\u0443\u0433\u0438. \u042d\u0442\u043e \u0434\u0430\u0451\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u00a0 \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u043d\u0435 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0435\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u0435\u043d\u0438\u044f, \u0430 \u0435\u0449\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0448\u0430\u043d\u0441 \u043d\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u0438\u0437\u0438\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0430, \u043c\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0441\u043b\u044b\u0448\u0430\u043b\u0438 \u0438 \u0443\u0447\u043b\u0438.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0437\u0430 \u043f\u0430\u0440\u0443 \u0432\u0435\u0447\u0435\u0440\u043e\u0432. \u0415\u0441\u043b\u0438 \u044d\u0444\u0444\u0435\u043a\u0442 \u0435\u0441\u0442\u044c, \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c: \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0432 CRM, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0435 \u043a\u0430\u0441\u0430\u043d\u0438\u044f, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0431\u043e\u0440 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u0430. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 \u0432 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0433\u043e \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f.<\/p>\n<h3>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f<\/h3>\n<ul>\n<li>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0430\u043a\u0442 \u043f\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0438 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0437\u0432\u0435\u0441\u0442\u0438 \u0440\u0435\u0430\u043a\u0446\u0438\u044e \u043f\u043e \u0443\u0440\u043e\u0432\u043d\u044e \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u0430: \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u043b\u0443\u0447\u0430\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0440\u0430\u0437\u0443, \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u0434\u043d\u044f<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043d\u0438\u0437\u043a\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043b\u0430\u0442\u044c \u0421\u041c\u0421 \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443, \u043d\u043e \u0438 \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443 \u043d\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a \u0438\u043b\u0438 \u0440\u0430\u0437\u0431\u043e\u0440 \u043a\u0435\u0439\u0441\u0430<\/p>\n<\/li>\n<li>\n<p>\u0421\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u043e \u0444\u0438\u043b\u0438\u0430\u043b\u0430\u043c, \u043c\u0430\u0441\u0442\u0435\u0440\u0430\u043c, \u0443\u0441\u043b\u0443\u0433\u0430\u043c \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u0438\u0437\u0438\u0442\u0430<\/p>\n<\/li>\n<li>\n<p>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0434\u043b\u044f \u043d\u043e\u0432\u044b\u0445 \u0438 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0431\u0440\u0430\u0442\u044c \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0439 \u043e\u0442\u0447\u0451\u0442 \u043f\u043e \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044e \u043e\u043f\u0440\u043e\u0441\u0430, \u0434\u043e\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u043e\u0432, \u043d\u0438\u0437\u043a\u0438\u043c \u043e\u0446\u0435\u043d\u043a\u0430\u043c \u0438 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0435\u0430\u043a\u0446\u0438\u0438<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435 \u043d\u0438\u0437\u043a\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f: \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u0437\u0432\u043e\u043d\u043e\u043a, \u0438\u0437\u0432\u0438\u043d\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u0438\u0437\u0438\u0442<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 CRM \u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u043d\u0435\u0439<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/github.com\/duckdevdotdev\/postprod-article-apr2026-yclients-sms-api-dtfm-robot-exolve-mws-tables\">\u043d\u0430 \u0433\u0438\u0442\u0445\u0430\u0431\u0435<\/a>.<\/p>\n<\/div>\n<p>\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/1037412\/\">https:\/\/habr.com\/ru\/articles\/1037412\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041f\u043e\u043a\u0430 \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435 \u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0439 \u0443\u0441\u043b\u0443\u0433\u0435 \u0441\u0432\u0435\u0436\u0435\u0435, \u043a\u043b\u0438\u0435\u043d\u0442 \u043b\u0443\u0447\u0448\u0435 \u043f\u043e\u043c\u043d\u0438\u0442 \u0434\u0435\u0442\u0430\u043b\u0438 \u0438 \u043e\u0445\u043e\u0442\u043d\u0435\u0435 \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u0441\u0432\u044f\u0437\u044c\u044e. \u0411\u0438\u0437\u043d\u0435\u0441\u0443 \u044d\u0442\u043e \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043b\u0430\u0431\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432 \u0441\u0435\u0440\u0432\u0438\u0441\u0435 \u0438 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445.\u041a\u043e\u0433\u0434\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u043b\u043e, \u0430\u0434\u043c\u0438\u043d\u0438\u0441\u0442\u0440\u0430\u0442\u043e\u0440 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0438\u0445 \u043e\u0431\u0437\u0432\u043e\u043d\u0438\u0442\u044c: \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c, \u0432\u0441\u0451 \u043b\u0438 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u043e\u0441\u044c, \u0438 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0432\u0435\u0442\u044b. \u041f\u0440\u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441\u0430 \u044d\u0442\u043e\u0442 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0443\u0436\u0435 \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442: \u0437\u0432\u043e\u043d\u043a\u0438 \u043e\u0442\u043d\u0438\u043c\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0447\u0430\u0441\u0442\u044c \u0432\u0438\u0437\u0438\u0442\u043e\u0432 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0430 \u0431\u0438\u0437\u043d\u0435\u0441 \u0443\u0437\u043d\u0430\u0451\u0442 \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043b \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043e\u0442\u0437\u044b\u0432 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435, \u0443\u0445\u0443\u0434\u0448\u0438\u0432 \u0440\u0435\u0439\u0442\u0438\u043d\u0433 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f.\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u044f\u0449\u0438\u0435 \u0437\u0432\u043e\u043d\u043a\u0438. \u041a\u043b\u0438\u0435\u043d\u0442\u0443, \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0435\u043c\u0443 \u0443\u0441\u043b\u0443\u0433\u0443,\u00a0 \u0437\u0432\u043e\u043d\u0438\u0442 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0439 \u0440\u043e\u0431\u043e\u0442 \u0438 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0435 \u0430\u043d\u043a\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u043f\u0440\u043e\u0441\u0430 \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u0440\u0430\u0431\u043e\u0447\u0443\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0430 \u0435\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043d\u0435\u0434\u043e\u0432\u043e\u043b\u0435\u043d, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0421\u041c\u0421 \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438.\u0421\u0442\u0435\u043a \u0440\u0435\u0448\u0435\u043d\u0438\u044f: Python 3.10+, Flask, requests, python-dotenv, SQLite, YCLIENTS API, \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0439 \u0440\u043e\u0431\u043e\u0442 \u0438 SMS API \u041c\u0422\u0421 Exolve, MWS Tables.\u041e\u0431\u0449\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b\u0421\u0446\u0435\u043d\u0430\u0440\u0438\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 YCLIENTS \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0438\u0437\u0438\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u043c. \u0421\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0432\u0435\u0431\u0445\u0443\u043a, \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0447\u0442\u043e \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0432\u0438\u0437\u0438\u0442\u0443 \u0435\u0449\u0451 \u043d\u0435 \u0431\u044b\u043b\u043e \u0437\u0432\u043e\u043d\u043a\u0430.\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u043d \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0432\u043e\u043d\u0438\u0442 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0438 \u0437\u0430\u0434\u0430\u0451\u0442 \u0442\u0440\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430: \u043a\u0430\u043a \u043e\u043d \u043e\u0446\u0435\u043d\u0438\u0432\u0430\u0435\u0442 \u0443\u0441\u043b\u0443\u0433\u0443, \u0446\u0435\u043d\u0443 \u0438 \u0433\u043e\u0442\u043e\u0432 \u043b\u0438 \u0432\u0435\u0440\u043d\u0443\u0442\u044c\u0441\u044f. \u0422\u0430\u043a\u043e\u0439 \u043d\u0430\u0431\u043e\u0440 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0437\u0432\u043e\u043d\u043e\u043a \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u043c \u0438 \u0434\u0430\u0451\u0442 \u0431\u0438\u0437\u043d\u0435\u0441\u0443 \u043e\u0446\u0435\u043d\u043a\u0443 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u044b, \u0432\u043e\u0441\u043f\u0440\u0438\u044f\u0442\u0438\u0435 \u0441\u0442\u043e\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0440\u0438\u0441\u043a \u043f\u043e\u0442\u0435\u0440\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430.\u041f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043a\u043e\u043b\u0431\u044d\u043a, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0448\u0430\u0433 \u043e\u043f\u0440\u043e\u0441\u0430 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u0432\u0438\u0437\u0438\u0442\u0430 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435. \u0415\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b \u0438\u043b\u0438 \u0437\u0432\u043e\u043d\u043e\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u044d\u0442\u043e \u0442\u043e\u0436\u0435 \u0444\u0438\u043a\u0441\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u043c.\u0415\u0441\u043b\u0438 \u043e\u0446\u0435\u043d\u043a\u0430 \u0443\u0441\u043b\u0443\u0433\u0438 \u043d\u0438\u0437\u043a\u0430\u044f, \u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0421\u041c\u0421, \u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443. \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0432\u0438\u0437\u0438\u0442\u0443 \u0432\u0438\u0434\u043d\u043e, \u0434\u043e\u0448\u0451\u043b \u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043e \u043a\u043e\u043d\u0446\u0430 \u043e\u043f\u0440\u043e\u0441\u0430 \u0438 \u043a\u0430\u043a\u0430\u044f \u0431\u044b\u043b\u0430 \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c.\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u043e\u0434\u043d\u043e\u043c Flask-\u0441\u0435\u0440\u0432\u0438\u0441\u0435, \u0442\u0440\u0451\u0445 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0431\u0430\u0437\u0435.YCLIENTS \u0445\u0440\u0430\u043d\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432\u0438\u0437\u0438\u0442\u0430 \u0438 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0435\u0442 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043e \u0435\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438. SQLite \u0445\u0440\u0430\u043d\u0438\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430: \u0441\u0442\u0430\u0442\u0443\u0441, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0432\u043e\u043d\u043a\u0430, \u043e\u0442\u0432\u0435\u0442\u044b \u043f\u043e \u0448\u0430\u0433\u0430\u043c \u0438 \u043e\u0442\u043c\u0435\u0442\u043a\u0443 \u043e\u0431 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0430\u043b\u0435\u0440\u0442\u0430. MWS Tables \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0443\u0436\u0435 \u0438\u0442\u043e\u0433 \u043f\u043e \u0432\u0438\u0437\u0438\u0442\u0443, \u043a\u043e\u0433\u0434\u0430 \u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043d.App.py \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441\u0430\u043c\u0438 \u0432\u0438\u0437\u0438\u0442\u0430: \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0432\u0435\u0431\u0445\u0443\u043a\u0438, \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u0445 \u0441 \u043d\u0443\u0436\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043b\u044e\u0447 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u2014 visit_id. \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0432\u043e\u043d\u043a\u0430 \u043d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043b\u0431\u044d\u043a \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u043a \u0443\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438.\u0412\u043d\u0435\u0448\u043d\u0438\u0435 \u0432\u044b\u0437\u043e\u0432\u044b \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b: yclients_api.py \u0447\u0438\u0442\u0430\u0435\u0442 \u0432\u0438\u0437\u0438\u0442 \u0438\u0437 YCLIENTS, exolve_voice.py \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0437\u0432\u043e\u043d\u043e\u043a, sms_alerts.py \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0421\u041c\u0421, tables_api.py \u043f\u0438\u0448\u0435\u0442 \u0438\u0442\u043e\u0433 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0443.\u041f\u0440\u0435\u0440\u0435\u043a\u0432\u0438\u0437\u0438\u0442\u041d\u0443\u0436\u0435\u043d Python 3.10+: \u0432 \u043a\u043e\u0434\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 str | None. \u0422\u043e\u043a\u0435\u043d\u044b, \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u043e\u0440\u043e\u0433 \u043d\u0438\u0437\u043a\u043e\u0439 \u043e\u0446\u0435\u043d\u043a\u0438 \u043b\u0435\u0436\u0430\u0442 \u0432 .env.python -m venv .venvsource .venv\/bin\/activatepip install -r requirements.txt\u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f:WEBHOOK_SECRET=change-meYCLIENTS_BASE_URL=https:\/\/api.yclients.com\/api\/v1YCLIENTS_PARTNER_TOKEN=***YCLIENTS_USER_TOKEN=***MWS_TABLES_BASE_URL=https:\/\/tables.mws.ruMWS_TABLES_API_KEY=***MWS_TABLE_ID=***MWS_VIEW_ID=***EXOLVE_API_KEY=***EXOLVE_CAMPAIGN_ID=***EXOLVE_CAMPAIGN_URL=https:\/\/api.exolve.ru\/campaign\/v1\/CallEXOLVE_SENDER=SalonBotOWNER_ALERT_PHONE=79990001122LOW_SCORE_THRESHOLD=2DB_NAME=salon_quality.db\u0414\u043b\u044f \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0432 MWS Tables \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 quality_results_table \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c\u0438 \u043a\u043e\u043b\u043e\u043d\u043a\u0430\u043c\u0438:visit_id \u2014 \u0441\u0442\u0440\u043e\u043a\u0430client_name \u2014 \u0441\u0442\u0440\u043e\u043a\u0430master_name \u2014 \u0441\u0442\u0440\u043e\u043a\u0430branch_name \u2014 \u0441\u0442\u0440\u043e\u043a\u0430visit_at \u2014 \u0434\u0430\u0442\u0430\/\u0432\u0440\u0435\u043c\u044fservice_score \u2014 \u0447\u0438\u0441\u043b\u043eprice_score \u2014 \u0447\u0438\u0441\u043b\u043ereturn_intent \u2014 \u0447\u0438\u0441\u043b\u043esurvey_status \u2014 \u0441\u0442\u0440\u043e\u043a\u0430alert_sent \u2014 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u043e\u043b\u0435\u0412 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043a\u043e\u0434\u0435 \u0441\u0435\u043a\u0440\u0435\u0442 \u0432\u0435\u0431\u0445\u0443\u043a\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 token, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0430\u043c URL \u0432\u0435\u0431\u0445\u0443\u043a\u0430 \u0442\u043e\u0436\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0441\u0432\u0435\u0442\u0438\u0442\u044c. \u041a\u043b\u044e\u0447\u0438 API \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0447\u0438\u0442\u0430\u0435\u0442 \u0447\u0435\u0440\u0435\u0437 python-dotenv.\u0428\u0430\u0433 1. \u041f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u041e\u043f\u0440\u043e\u0441 \u043d\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0435\u0440\u0432\u0438\u0441\u0443 \u043d\u0443\u0436\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u0432\u0438\u0437\u0438\u0442\u0443. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u0435\u0440\u0436\u0438\u0442 \u0432 Config \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 surveys. \u0412 \u043d\u0435\u0439 \u043b\u0435\u0436\u0430\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u0432\u0438\u0437\u0438\u0442\u0430 \u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u043e\u043b\u044f \u043e\u043f\u0440\u043e\u0441\u0430: status, call_id, \u0442\u0440\u0438 \u043e\u0446\u0435\u043d\u043a\u0438 \u0438 alert_sent. \u041f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u043d\u0430 visit_id \u0437\u0430\u0449\u0438\u0449\u0430\u0435\u0442 \u043e\u0442 \u0434\u0443\u0431\u043b\u0435\u0439.# config.pyfrom dotenv import load_dotenvimport osload_dotenv()class Config:   WEBHOOK_SECRET = os.environ.get(&#171;WEBHOOK_SECRET&#187;, &#171;super-secret-token&#187;)   YCLIENTS_BASE_URL = os.environ.get(&#171;YCLIENTS_BASE_URL&#187;, &#171;https:\/\/api.yclients.com\/api\/v1&#187;)   YCLIENTS_PARTNER_TOKEN = os.environ.get(&#171;YCLIENTS_PARTNER_TOKEN&#187;, &#171;***&#187;)   YCLIENTS_USER_TOKEN = os.environ.get(&#171;YCLIENTS_USER_TOKEN&#187;, &#171;***&#187;)   MWS_TABLES_BASE_URL = os.environ.get(&#171;MWS_TABLES_BASE_URL&#187;, &#171;https:\/\/tables.mws.ru&#187;)   MWS_TABLES_API_KEY = os.environ.get(&#171;MWS_TABLES_API_KEY&#187;, &#171;***&#187;)   MWS_TABLE_ID = os.environ.get(&#171;MWS_TABLE_ID&#187;, &#171;***&#187;)   MWS_VIEW_ID = os.environ.get(&#171;MWS_VIEW_ID&#187;, &#171;***&#187;)   EXOLVE_API_KEY = os.environ.get(&#171;EXOLVE_API_KEY&#187;, &#171;your_exolve_key&#187;)   EXOLVE_CAMPAIGN_ID = os.environ.get(&#171;EXOLVE_CAMPAIGN_ID&#187;, &#171;***&#187;)   EXOLVE_CAMPAIGN_URL = os.environ.get(&#171;EXOLVE_CAMPAIGN_URL&#187;, &#171;https:\/\/api.exolve.ru\/campaign\/v1\/Call&#187;)   EXOLVE_SENDER = os.environ.get(&#171;EXOLVE_SENDER&#187;, &#171;SalonBot&#187;)   OWNER_ALERT_PHONE = os.environ.get(&#171;OWNER_ALERT_PHONE&#187;, &#171;79990001122&#187;)   LOW_SCORE_THRESHOLD = int(os.environ.get(&#171;LOW_SCORE_THRESHOLD&#187;, 2))   DB_NAME = os.environ.get(&#171;DB_NAME&#187;, &#171;salon_quality.db&#187;)\u041d\u0438\u0436\u0435 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0435\u0440\u0432\u0438\u0441 \u0445\u0440\u0430\u043d\u0438\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430.  # database.pydef init_db():   with get_conn() as conn:       conn.execute(&#171;&#187;&#187;       CREATE TABLE IF NOT EXISTS surveys (           visit_id TEXT PRIMARY KEY,           client_name TEXT,           client_phone TEXT,           master_name TEXT,           branch_name TEXT,           visit_at TEXT,           status TEXT NOT NULL,           call_id TEXT,           q1_service_score INTEGER,           q2_price_score INTEGER,           q3_return_intent INTEGER,           alert_sent INTEGER NOT NULL DEFAULT 0,           created_at INTEGER NOT NULL,           updated_at INTEGER NOT NULL       )       &#171;&#187;&#187;)       conn.commit()\u042d\u0442\u0430 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0445\u0440\u0430\u043d\u0438\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0440\u043e\u0441\u0430. \u0414\u0430\u043d\u043d\u044b\u0435 \u0432\u0438\u0437\u0438\u0442\u0430 \u0438 \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0441\u0442\u0430\u0442\u0443\u0441 \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u0435\u0440\u0436\u0438\u0442 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438, \u0431\u0435\u0437 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0436\u0443\u0440\u043d\u0430\u043b\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439.\u0421\u0435\u0440\u0432\u0438\u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0430\u0442\u0443\u0441\u044b:NEW \u2014 \u0432\u0438\u0437\u0438\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u043e\u043f\u0440\u043e\u0441 \u0435\u0449\u0435 \u043d\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043dCALL_STARTED \u2014 \u0437\u0432\u043e\u043d\u043e\u043a \u0437\u0430\u043f\u0443\u0449\u0435\u043dQ1_ANSWERED \u2014 \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u043e\u043f\u0440\u043e\u0441Q2_ANSWERED \u2014 \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439Q3_ANSWERED \u2014 \u0438 \u043d\u0430 \u0442\u0440\u0435\u0442\u0438\u0439COMPLETED \u2014 \u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043dNO_ANSWER \u2014 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043bFAILED \u2014 \u043e\u043f\u0440\u043e\u0441 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439\u041f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432 \u043f\u0440\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0437\u0432\u043e\u043d\u043a\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:NEW -&gt; CALL_STARTED -&gt; Q1_ANSWERED -&gt; Q2_ANSWERED -&gt; Q3_ANSWERED -&gt; COMPLETED\u0415\u0441\u043b\u0438 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b:NEW -&gt; CALL_STARTED -&gt; NO_ANSWER\u0415\u0441\u043b\u0438 \u0437\u0432\u043e\u043d\u043e\u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439:NEW -&gt; CALL_STARTED -&gt; FAILED\u0428\u0430\u0433 2. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u043c \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0439 \u0432\u0438\u0437\u0438\u0442 \u0438\u0437 YCLIENTS\u0412\u0435\u0431\u0445\u0443\u043a YCLIENTS \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u0432\u0438\u0437\u0438\u0442 \u0437\u0430\u043a\u0440\u044b\u0442. \u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u0435\u0440\u0432\u0438\u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 token, \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 attendance == 1 \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0443 \u0432\u0438\u0437\u0438\u0442\u0430 \u0447\u0435\u0440\u0435\u0437 get_visit(). \u0412 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0411\u0414 \u043e\u043d \u043f\u0438\u0448\u0435\u0442 \u0443\u0436\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435.\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0432\u0435\u0431\u0445\u0443\u043a\u0430:{ &#171;id&#187;: &#171;98765&#187;, &#171;company_id&#187;: &#171;12345&#187;, &#171;attendance&#187;: 1}\u041d\u0438\u0436\u0435 \u0441\u0430\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u044d\u0442\u043e\u0433\u043e \u0432\u0435\u0431\u0445\u0443\u043a\u0430.  # app.py@app.route(&#171;\/webhook\/yclients\/visit&#187;, methods=[&#171;POST&#187;])def yclients_webhook():   if request.args.get(&#171;token&#187;) != Config.WEBHOOK_SECRET:       return &#171;Forbidden&#187;, 403   data = request.get_json(silent=True) or {}   visit_id = str(data.get(&#171;id&#187;) or &#171;&#187;)   company_id = str(data.get(&#171;company_id&#187;) or &#171;&#187;)   if not visit_id or not company_id:       return &#171;Bad Request: visit_id or company_id missing&#187;, 400   if data.get(&#171;attendance&#187;) != 1:       return jsonify({&#171;status&#187;: &#171;ignored_status&#187;}), 200   visit_raw = get_visit(company_id, visit_id)   visit = normalize_visit(visit_raw)   if not visit[&#171;client_phone&#187;]:      return jsonify({&#171;status&#187;: &#171;invalid_phone&#187;}), 200   created = create_survey_if_new(visit)   if not created:      return jsonify({&#171;status&#187;: &#171;duplicate&#187;}), 200\u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 YCLIENTS \u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0443\u0436\u0435 \u0441 \u043e\u0434\u043d\u043e\u0439 \u0438 \u0442\u043e\u0439 \u0436\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0432\u0438\u0437\u0438\u0442\u0430.  # yclients_api.pydef normalize_phone(phone: str | None) -&gt; str | None:   if not phone:       return None   digits = &#171;&#187;.join(ch for ch in str(phone) if ch.isdigit())   if len(digits) == 11 and digits.startswith(&#171;8&#187;):       digits = &#171;7&#187; + digits[1:]   return digits if len(digits) == 11 and digits.startswith(&#171;7&#187;) else Nonedef normalize_visit(visit: dict) -&gt; dict:   return {       &#171;visit_id&#187;: str(visit.get(&#171;id&#187;)),       &#171;client_name&#187;: visit.get(&#171;client&#187;, {}).get(&#171;name&#187;),       &#171;client_phone&#187;: normalize_phone(visit.get(&#171;client&#187;, {}).get(&#171;phone&#187;)),       &#171;master_name&#187;: visit.get(&#171;staff&#187;, {}).get(&#171;name&#187;),       &#171;branch_name&#187;: visit.get(&#171;company&#187;, {}).get(&#171;title&#187;),       &#171;visit_at&#187;: visit.get(&#171;datetime&#187;)   }\u041f\u043e\u0441\u043b\u0435 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u0443\u044e \u0431\u0430\u0437\u0443 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u043e\u0447\u043a\u0430 \u0432\u0438\u0437\u0438\u0442\u0430 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c, \u043c\u0430\u0441\u0442\u0435\u0440\u043e\u043c, \u0444\u0438\u043b\u0438\u0430\u043b\u043e\u043c \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u0441\u0435\u0449\u0435\u043d\u0438\u044f. \u041f\u043e\u0432\u0442\u043e\u0440\u043d\u044b\u0439 \u0432\u0435\u0431\u0445\u0443\u043a \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0434\u0443\u0431\u043b\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u0430 \u043a visit_id. \u0415\u0441\u043b\u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 invalid_phone. \u0417\u0430\u0432\u0435\u0440\u0448\u0451\u043d\u043d\u044b\u043c \u0432\u0438\u0437\u0438\u0442 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e attendance == 1.\u0428\u0430\u0433 3. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0439 \u043e\u043f\u0440\u043e\u0441 \u0447\u0435\u0440\u0435\u0437 \u041c\u0422\u0421 Exolve\u041a\u043e\u0433\u0434\u0430 \u0432\u0438\u0437\u0438\u0442 \u0443\u0436\u0435 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0441\u0435\u0440\u0432\u0438\u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u043a\u043b\u0438\u0435\u043d\u0442\u0443 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0443\u044e \u043a\u0430\u043c\u043f\u0430\u043d\u0438\u044e \u0432 \u041c\u0422\u0421 Exolve.\u0421\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0441\u0445\u0435\u043c\u044b \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u043e\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430 \u041c\u0422\u0421 Exolve  \u0412 \u0437\u0430\u043f\u0440\u043e\u0441 \u0443\u0445\u043e\u0434\u0438\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435\u043b\u0435\u0444\u043e\u043d, \u043d\u043e \u0438 initialData.visit_id. \u042d\u0442\u043e\u0442 \u043a\u043b\u044e\u0447 \u043d\u0443\u0436\u0435\u043d, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u0441\u0432\u044f\u0437\u0430\u0442\u044c \u043a\u043e\u043b\u0431\u044d\u043a \u0441 \u043d\u0443\u0436\u043d\u044b\u043c \u0432\u0438\u0437\u0438\u0442\u043e\u043c. \u0412 \u043e\u0442\u0432\u0435\u0442\u0435 \u043e\u0442 \u041c\u0422\u0421 Exolve \u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 call_id \u043a\u0430\u043a \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0432\u043e\u043d\u043a\u0430 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430 \u0432\u0435\u0431\u0445\u0443\u043a\u0430 \u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0441\u0442\u0430\u0442\u0443\u0441 CALL_STARTED.  # exolve_voice.pydef start_quality_campaign(phone: str, visit_id: str) -&gt; dict:   headers = {&#171;Authorization&#187;: f&#187;Bearer {Config.EXOLVE_API_KEY}&#187;, &#171;Content-Type&#187;: &#171;application\/json&#187;}   payload = {       &#171;campaign_id&#187;: Config.EXOLVE_CAMPAIGN_ID,       &#171;params&#187;: {           &#171;destination&#187;: phone,           &#171;initialData&#187;: {&#171;visit_id&#187;: visit_id}       }   }   resp = requests.post(Config.EXOLVE_CAMPAIGN_URL, headers=headers, json=payload, timeout=20)&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-480440","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/480440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=480440"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/480440\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=480440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=480440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=480440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}