{"id":1382,"date":"2022-03-02T15:13:12","date_gmt":"2022-03-02T15:13:12","guid":{"rendered":"https:\/\/blog.ultramsg.com\/%d0%bf%d1%80%d0%be%d0%b3%d1%80%d0%b0%d0%bc%d0%bc%d0%b8%d1%80%d1%83%d0%b5%d0%bc%d1%8b%d0%b9-whatsapp-api-%d0%be%d0%b1%d0%bc%d0%b5%d0%bd-%d1%81%d0%be%d0%be%d0%b1%d1%89%d0%b5%d0%bd%d0%b8%d1%8f%d0%bc\/"},"modified":"2022-03-02T15:13:13","modified_gmt":"2022-03-02T15:13:13","slug":"%d0%bf%d1%80%d0%be%d0%b3%d1%80%d0%b0%d0%bc%d0%bc%d0%b8%d1%80%d1%83%d0%b5%d0%bc%d1%8b%d0%b9-whatsapp-api-%d0%be%d0%b1%d0%bc%d0%b5%d0%bd-%d1%81%d0%be%d0%be%d0%b1%d1%89%d0%b5%d0%bd%d0%b8%d1%8f%d0%bc","status":"publish","type":"post","link":"https:\/\/blog.ultramsg.com\/ru\/%d0%bf%d1%80%d0%be%d0%b3%d1%80%d0%b0%d0%bc%d0%bc%d0%b8%d1%80%d1%83%d0%b5%d0%bc%d1%8b%d0%b9-whatsapp-api-%d0%be%d0%b1%d0%bc%d0%b5%d0%bd-%d1%81%d0%be%d0%be%d0%b1%d1%89%d0%b5%d0%bd%d0%b8%d1%8f%d0%bc\/","title":{"rendered":"\u041a\u0430\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c WhatsApp API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python | \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"introduction\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n\n<p>\u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 API WhatsApp \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Python.<\/p>\n\n<p>\u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <a href=\"https:\/\/pypi.org\/project\/python-http-client\/\" data-type=\"URL\" data-id=\"https:\/\/pypi.org\/project\/python-http-client\/\" rel=\"nofollow noopener\" target=\"_blank\">http.client<\/a> \u0433\u043e\u0442\u043e\u0432\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043d\u0430 \u0448\u043b\u044e\u0437 Ultramsg.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"quicke-example-usage-for-whatsapp-api-using-python\">quicke \u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f API WhatsApp \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Python<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;body=WhatsApp API on UltraMsg.com works good&amp;priority=10&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/chat\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<p>\u041f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0439 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u0432\u0435\u0442 \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0438\u043c:<\/p>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"powershell\" class=\"EnlighterJSRAW\">{\"sent\":\"true\",\"message\":\"ok\",\"id\":44897}<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-image\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;image=https:\/\/file-example.s3-accelerate.amazonaws.com\/images\/test.jpg&amp;caption=image Caption&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/image\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-document\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;filename=hello.pdf&amp;document=https:\/\/file-example.s3-accelerate.amazonaws.com\/documents\/cv.pdf&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/document\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-audio\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u043e<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;audio=https:\/\/file-example.s3-accelerate.amazonaws.com\/audio\/2.mp3&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/audio\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-voice\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0433\u043e\u043b\u043e\u0441<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;audio=https:\/\/file-example.s3-accelerate.amazonaws.com\/voice\/oog_example.ogg&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/voice\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-video\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0432\u0438\u0434\u0435\u043e<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;video=https:\/\/file-example.s3-accelerate.amazonaws.com\/video\/test.mp4&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/video\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-link\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;link=https:\/\/en.wikipedia.org\/wiki\/COVID-19&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/link\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-contact\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0442\u0430\u043a\u0442<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;contact=14000000001@c.us&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/contact\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-location\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;address=ABC company \\n Sixth floor , office 38&amp;lat=25.197197&amp;lng=55.2721877&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/location\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h3 class=\"wp-block-heading\" id=\"send-vcard\">\u041e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u043a\u0443<\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import http.client\nconn = http.client.HTTPSConnection(\"api.ultramsg.com\")\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;vcard= BEGIN:VCARD\\nVERSION:3.0\\nN:lastname;firstname\\nFN:firstname lastname\\nTEL;TYPE=CELL;waid=14000000001:14000000002\\nNICKNAME:nickname\\nBDAY:01.01.1987\\nX-GENDER:M\\nNOTE:note\\nADR;TYPE=home:;;;;;;\\nADR;TYPE=work_:;;;;;;\\nEND:VCARD&amp;referenceId=\"\nheaders = { 'content-type': \"application\/x-www-form-urlencoded\" }\nconn.request(\"POST\", \"\/instance16\/messages\/vcard\", payload, headers)\nres = conn.getresponse()\ndata = res.read()\nprint(data.decode(\"utf-8\"))<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"using-requests-lib\">\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <\/h2>\n\n<p>\u041c\u044b \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/pypi.org\/project\/requests\/\" data-type=\"URL\" data-id=\"https:\/\/pypi.org\/project\/requests\/\" rel=\"nofollow noopener\" target=\"_blank\">\u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432<\/a> .<\/p>\n\n<p><\/p>\n\n<h3 class=\"wp-block-heading\" id=\"example-usage-for-whatsapp-api-using-python-requests-lib\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f WhatsApp API \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Python \u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <\/h3>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"python\" class=\"EnlighterJSRAW\">import requests\nurl = \"https:\/\/api.ultramsg.com\/instance16\/messages\/chat\"\npayload = \"token=1v941eyo9eqixrsi&amp;to=14155552671&amp;body=test message;priority=1&amp;referenceId=\"\nheaders = {'content-type': 'application\/x-www-form-urlencoded'}\nresponse = requests.request(\"POST\", url, data=payload, headers=headers)\nprint(response.text)<\/code><\/code><\/pre>\n\n<p>\u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043b\u043d\u043e\u0439 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 \u043f\u043e <a href=\"https:\/\/docs.ultramsg.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Whatsapp API<\/a> \u0438 <a href=\"https:\/\/blog.ultramsg.com\/whatsapp-api-by-ultramsg-faq\/\" data-type=\"URL\" data-id=\"https:\/\/blog.ultramsg.com\/whatsapp-api-by-ultramsg-faq\/\">\u0447\u0430\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c\u0438<\/a> \u0432\u043e\u043f\u0440\u043e\u0441\u0430\u043c\u0438. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0412 \u044d\u0442\u043e\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 API WhatsApp \u0441 &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"\u041a\u0430\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c WhatsApp API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python | \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442\" class=\"read-more button\" href=\"https:\/\/blog.ultramsg.com\/ru\/%d0%bf%d1%80%d0%be%d0%b3%d1%80%d0%b0%d0%bc%d0%bc%d0%b8%d1%80%d1%83%d0%b5%d0%bc%d1%8b%d0%b9-whatsapp-api-%d0%be%d0%b1%d0%bc%d0%b5%d0%bd-%d1%81%d0%be%d0%be%d0%b1%d1%89%d0%b5%d0%bd%d0%b8%d1%8f%d0%bc\/#more-1382\" aria-label=\"\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043e \u041a\u0430\u043a \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c WhatsApp API \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python | \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u0441\u0442\u0430\u0440\u0442\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":1221,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[132],"tags":[134,150,136],"class_list":["post-1382","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api-whatsapp-ru","tag-api-whatsapp-ru","tag-150","tag-136","infinite-scroll-item","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-25","no-featured-image-padding"],"_links":{"self":[{"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/posts\/1382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/comments?post=1382"}],"version-history":[{"count":1,"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/posts\/1382\/revisions"}],"predecessor-version":[{"id":1383,"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/posts\/1382\/revisions\/1383"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/media\/1221"}],"wp:attachment":[{"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/media?parent=1382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/categories?post=1382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ru\/wp-json\/wp\/v2\/tags?post=1382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}