{"id":860,"date":"2022-02-27T08:36:07","date_gmt":"2022-02-27T08:36:07","guid":{"rendered":"https:\/\/blog.ultramsg.com\/send-whatsapp-api-with-go-language\/"},"modified":"2022-05-28T11:45:01","modified_gmt":"2022-05-28T11:45:01","slug":"send-whatsapp-api-with-go-language","status":"publish","type":"post","link":"https:\/\/blog.ultramsg.com\/ar\/send-whatsapp-api-with-go-language\/","title":{"rendered":"\u0643\u064a\u0641\u064a\u0629 \u0625\u0631\u0633\u0627\u0644 \u0648\u0627\u062a\u0633 \u0627\u0628 API \u0645\u0639 Go"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"introduction\">\u0645\u0642\u062f\u0645\u0629<\/h2>\n\n<p>\u0641\u064a \u0647\u0630\u0647 \u0627\u0644\u0645\u0642\u0627\u0644\u0629 \u060c \u0633\u0646\u0646\u0634\u0626 \u0623\u0645\u062b\u0644\u0629 \u0628\u0633\u064a\u0637\u0629 \u0644\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0639\u0628\u0631 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 Go.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"first-whatsapp-api-message-using-go\">\u0623\u0648\u0644 \u0631\u0633\u0627\u0644\u0629 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 GO <\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/chat\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;body=WhatsApp API on UltraMsg.com works good&amp;priority=10&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-image\">\u0625\u0631\u0633\u0627\u0644 \u0635\u0648\u0631\u0629<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/image\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;image=https:\/\/file-example.s3-accelerate.amazonaws.com\/images\/test.jpg&amp;caption=image Caption&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-document\">\u0625\u0631\u0633\u0627\u0644 \u0645\u0644\u0641<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/document\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;filename=hello.pdf&amp;document=https:\/\/file-example.s3-accelerate.amazonaws.com\/documents\/cv.pdf&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-audio\">\u0625\u0631\u0633\u0644 \u0635\u0648\u062a<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/audio\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;audio=https:\/\/file-example.s3-accelerate.amazonaws.com\/audio\/2.mp3&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-voice\">\u0625\u0631\u0633\u0627\u0644 \u062a\u0633\u062c\u064a\u0644 \u0635\u0648\u062a\u064a<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/voice\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;audio=https:\/\/file-example.s3-accelerate.amazonaws.com\/voice\/oog_example.ogg&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-video\">\u0625\u0631\u0633\u0627\u0644 \u0641\u064a\u062f\u064a\u0648<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/video\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;video=https:\/\/file-example.s3-accelerate.amazonaws.com\/video\/test.mp4&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-link\">\u0625\u0631\u0633\u0627\u0644 \u0631\u0627\u0628\u0637<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/link\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;link=https:\/\/en.wikipedia.org\/wiki\/COVID-19&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-contact\">\u0625\u0631\u0633\u0627\u0644 \u062c\u0647\u0629 \u0627\u062a\u0635\u0627\u0644<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/contact\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;contact=14000000001@c.us&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-location\">\u0625\u0631\u0633\u0627\u0644 \u0645\u0648\u0642\u0639 \u062c\u063a\u0631\u0627\u0641\u064a<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/location\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&amp;address=ABC company \\n Sixth floor , office 38&amp;lat=25.197197&amp;lng=55.2721877&amp;referenceId=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-vcard\">\u0625\u0631\u0633\u0627\u0644 Vcard<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"golang\" class=\"EnlighterJSRAW\">package main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\t\"net\/http\"\n\t\"io\/ioutil\"\n)\n\nfunc main() {\n\n\turl := \"https:\/\/api.ultramsg.com\/instance1150\/messages\/vcard\"\n\n\tpayload := strings.NewReader(\"token=token_here&amp;to=966550883606&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=\")\n\n\treq, _ := http.NewRequest(\"POST\", url, payload)\n\n\treq.Header.Add(\"content-type\", \"application\/x-www-form-urlencoded\")\n\n\tres, _ := http.DefaultClient.Do(req)\n\n\tdefer res.Body.Close()\n\tbody, _ := ioutil.ReadAll(res.Body)\n\n\tfmt.Println(res)\n\tfmt.Println(string(body))\n\n}<\/code><\/code><\/pre>\n\n<p>\u0623\u062e\u064a\u0631\u0627 \u064a\u0645\u0643\u0646 \u0645\u0634\u0627\u0647\u062f\u0629 \u062f\u0644\u064a\u0644 \u0648\u062b\u0627\u0626\u0642 <a href=\"https:\/\/docs.ultramsg.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Whatsapp API Documentation.<\/a> \u0628\u0627\u0644\u0625\u0636\u0627\u0641\u0629 \u0644\u0644\u0623\u0633\u0626\u0644\u0629 \u0627\u0644\u0634\u0627\u0626\u0639\u0629 <a href=\"https:\/\/blog.ultramsg.com\/ar\/whatsapp-api-by-ultramsg-faq\/\" data-type=\"URL\" data-id=\"https:\/\/blog.ultramsg.com\/whatsapp-api-by-ultramsg-faq\/\">FAQ<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0645\u0642\u062f\u0645\u0629 \u0641\u064a \u0647\u0630\u0647 \u0627\u0644\u0645\u0642\u0627\u0644\u0629 \u060c \u0633\u0646\u0646\u0634\u0626 \u0623\u0645\u062b\u0644\u0629 \u0628\u0633\u064a\u0637\u0629 \u0644\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0639\u0628\u0631 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 Go. &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"\u0643\u064a\u0641\u064a\u0629 \u0625\u0631\u0633\u0627\u0644 \u0648\u0627\u062a\u0633 \u0627\u0628 API \u0645\u0639 Go\" class=\"read-more button\" href=\"https:\/\/blog.ultramsg.com\/ar\/send-whatsapp-api-with-go-language\/#more-860\" aria-label=\"Read more about \u0643\u064a\u0641\u064a\u0629 \u0625\u0631\u0633\u0627\u0644 \u0648\u0627\u062a\u0633 \u0627\u0628 API \u0645\u0639 Go\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":701,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[46,40,38],"class_list":["post-860","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category---api","tag-go-ar","tag-40","tag---api","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\/ar\/wp-json\/wp\/v2\/posts\/860","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/comments?post=860"}],"version-history":[{"count":3,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/posts\/860\/revisions"}],"predecessor-version":[{"id":3336,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/posts\/860\/revisions\/3336"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/media\/701"}],"wp:attachment":[{"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/media?parent=860"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/categories?post=860"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/tags?post=860"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}