{"id":2654,"date":"2022-05-03T01:55:43","date_gmt":"2022-05-03T01:55:43","guid":{"rendered":"https:\/\/blog.ultramsg.com\/hantar-mesej-whatsapp-api-menggunakan-c-language\/"},"modified":"2022-05-03T01:55:45","modified_gmt":"2022-05-03T01:55:45","slug":"hantar-mesej-whatsapp-api-menggunakan-c-language","status":"publish","type":"post","link":"https:\/\/blog.ultramsg.com\/ms\/hantar-mesej-whatsapp-api-menggunakan-c-language\/","title":{"rendered":"API WhatsApp dengan bahasa pengaturcaraan C"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"introduction\">pengenalan<\/h2>\n\n<p>Dalam tutorial ini, kami akan mencipta contoh mudah untuk menghantar mesej melalui API WhatsApp menggunakan C.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"first-whatsapp-api-message-using-c\">Mesej API WhatsApp Pertama Menggunakan C<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/chat\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"token=token_here&amp;to=966550883606&amp;body=WhatsApp API on UltraMsg.com works good&amp;priority=10&amp;referenceId=\");\n\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-image\">Hantar Imej<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/image\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"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\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-document\">Hantar Dokumen<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/document\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"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\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-audio\">Hantar Audio<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/audio\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"token=token_here&amp;to=966550883606&amp;audio=https:\/\/file-example.s3-accelerate.amazonaws.com\/audio\/2.mp3&amp;referenceId=\");\n\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-voice\">Hantar Suara<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/voice\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"token=token_here&amp;to=966550883606&amp;audio=https:\/\/file-example.s3-accelerate.amazonaws.com\/voice\/oog_example.ogg&amp;referenceId=\");\n\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-video\">Hantar Video<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/video\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"token=token_here&amp;to=966550883606&amp;video=https:\/\/file-example.s3-accelerate.amazonaws.com\/video\/test.mp4&amp;referenceId=\");\n\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-link\">Hantar Pautan<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/link\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"token=token_here&amp;to=966550883606&amp;link=https:\/\/en.wikipedia.org\/wiki\/COVID-19&amp;referenceId=\");\n\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-contact\">Hantar Kenalan<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/contact\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"token=token_here&amp;to=966550883606&amp;contact=14000000001@c.us&amp;referenceId=\");\n\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-location\">Hantar Lokasi<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/location\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"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\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-vcard\">Hantar Vcard<\/h2>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">CURL *hnd = curl_easy_init();\n\ncurl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, \"POST\");\ncurl_easy_setopt(hnd, CURLOPT_URL, \"https:\/\/api.ultramsg.com\/instance1150\/messages\/vcard\");\n\nstruct curl_slist *headers = NULL;\nheaders = curl_slist_append(headers, \"content-type: application\/x-www-form-urlencoded\");\ncurl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);\n\ncurl_easy_setopt(hnd, CURLOPT_POSTFIELDS, \"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\nCURLcode ret = curl_easy_perform(hnd);<\/code><\/pre>\n\n<p>akhirnya, anda boleh melihat Dokumentasi dan <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\/\">Soalan Lazim<\/a> <a href=\"https:\/\/docs.ultramsg.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">API Whatsapp<\/a> Penuh .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>pengenalan Dalam tutorial ini, kami akan mencipta contoh mudah untuk menghantar mesej melalui API WhatsApp &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"API WhatsApp dengan bahasa pengaturcaraan C\" class=\"read-more button\" href=\"https:\/\/blog.ultramsg.com\/ms\/hantar-mesej-whatsapp-api-menggunakan-c-language\/#more-2654\" aria-label=\"Read more about API WhatsApp dengan bahasa pengaturcaraan C\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":2574,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[245],"tags":[249,263],"class_list":["post-2654","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api-whatsapp-ms","tag-api-whatsapp-ms","tag-c-ms-2","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\/ms\/wp-json\/wp\/v2\/posts\/2654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/comments?post=2654"}],"version-history":[{"count":3,"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/posts\/2654\/revisions"}],"predecessor-version":[{"id":2657,"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/posts\/2654\/revisions\/2657"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/media\/2574"}],"wp:attachment":[{"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/media?parent=2654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/categories?post=2654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ms\/wp-json\/wp\/v2\/tags?post=2654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}