{"id":1284,"date":"2022-03-02T15:07:21","date_gmt":"2022-03-02T15:07:21","guid":{"rendered":"https:\/\/blog.ultramsg.com\/enviar-whatsapp-api-messages-usando-ocaml\/"},"modified":"2022-03-02T15:07:22","modified_gmt":"2022-03-02T15:07:22","slug":"enviar-whatsapp-api-messages-usando-ocaml","status":"publish","type":"post","link":"https:\/\/blog.ultramsg.com\/pt-br\/enviar-whatsapp-api-messages-usando-ocaml\/","title":{"rendered":"Como enviar uma API do WhatsApp com OCaml"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"introduction\">Introdu\u00e7\u00e3o<\/h2>\n\n<p>Neste tutorial, criaremos exemplos simples para enviar mensagens via API do WhatsApp usando OCaml.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"first-whatsapp-api-message-using-objective-c\">Primeira mensagem da API do WhatsApp usando OCaml<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/chat\" in\nlet body = Cohttp_lwt_body.of_string \"token=token_here&amp;to=966550883606&amp;body=WhatsApp API on UltraMsg.com works good&amp;priority=10&amp;referenceId=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-image\">Enviar imagem<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/image\" in\nlet body = Cohttp_lwt_body.of_string \"token=token_here&amp;to=966550883606&amp;image=https:\/\/file-example.s3-accelerate.amazonaws.com\/images\/test.jpg&amp;caption=image Caption&amp;referenceId=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-document\">Enviar documento<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/document\" in\nlet body = Cohttp_lwt_body.of_string \"token=token_here&amp;to=966550883606&amp;filename=hello.pdf&amp;document=https:\/\/file-example.s3-accelerate.amazonaws.com\/documents\/cv.pdf&amp;referenceId=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-audio\">Enviar \u00e1udio<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/audio\" in\nlet body = Cohttp_lwt_body.of_string \"token=token_here&amp;to=966550883606&amp;audio=https:\/\/file-example.s3-accelerate.amazonaws.com\/audio\/2.mp3&amp;referenceId=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-voice\">Enviar voz<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/voice\" in\nlet body = Cohttp_lwt_body.of_string \"token=token_here&amp;to=966550883606&amp;audio=https:\/\/file-example.s3-accelerate.amazonaws.com\/voice\/oog_example.ogg&amp;referenceId=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-video\">Enviar v\u00eddeo<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/video\" in\nlet body = Cohttp_lwt_body.of_string \"token=token_here&amp;to=966550883606&amp;video=https:\/\/file-example.s3-accelerate.amazonaws.com\/video\/test.mp4&amp;referenceId=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-link\">Enviar Link<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/link\" in\nlet body = Cohttp_lwt_body.of_string \"token=token_here&amp;to=966550883606&amp;link=https:\/\/en.wikipedia.org\/wiki\/COVID-19&amp;referenceId=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-contact\">Enviar contato<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/contact\" in\nlet body = Cohttp_lwt_body.of_string \"token=token_here&amp;to=966550883606&amp;contact=14000000001@c.us&amp;referenceId=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-location\">Enviar localiza\u00e7\u00e3o<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/location\" in\nlet body = Cohttp_lwt_body.of_string \"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=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-vcard\">Enviar Vcard<br\/><\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"c\" class=\"EnlighterJSRAW\">open Cohttp_lwt_unix\nopen Cohttp\nopen Lwt\n\nlet uri = Uri.of_string \"https:\/\/api.ultramsg.com\/instance1150\/messages\/vcard\" in\nlet body = Cohttp_lwt_body.of_string \"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=\" in\n\nClient.call ~body `POST uri\n&gt;&gt;= fun (res, body_stream) -&gt;\n  (* Do stuff with the result *)<\/code><\/code><\/pre>\n\n<p>finalmente, voc\u00ea pode ver <a href=\"https:\/\/docs.ultramsg.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">a documenta\u00e7\u00e3o completa da API do Whatsapp<\/a> e as <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\/\">perguntas frequentes<\/a> .<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introdu\u00e7\u00e3o Neste tutorial, criaremos exemplos simples para enviar mensagens via API do WhatsApp usando OCaml. &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Como enviar uma API do WhatsApp com OCaml\" class=\"read-more button\" href=\"https:\/\/blog.ultramsg.com\/pt-br\/enviar-whatsapp-api-messages-usando-ocaml\/#more-1284\" aria-label=\"Read more about Como enviar uma API do WhatsApp com OCaml\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":1258,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[111],"tags":[112,120],"class_list":["post-1284","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api-do-whatsapp","tag-api-do-whatsapp","tag-ocamlgenericname","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\/pt-br\/wp-json\/wp\/v2\/posts\/1284","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/comments?post=1284"}],"version-history":[{"count":1,"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/posts\/1284\/revisions"}],"predecessor-version":[{"id":1285,"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/posts\/1284\/revisions\/1285"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/media\/1258"}],"wp:attachment":[{"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/media?parent=1284"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/categories?post=1284"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/pt-br\/wp-json\/wp\/v2\/tags?post=1284"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}