{"id":3948,"date":"2022-06-25T21:37:05","date_gmt":"2022-06-25T21:37:05","guid":{"rendered":"https:\/\/blog.ultramsg.com\/ricevere-messaggi-whatsapp-con-c-webhook\/"},"modified":"2022-06-25T21:37:07","modified_gmt":"2022-06-25T21:37:07","slug":"ricevere-messaggi-whatsapp-con-c-webhook","status":"publish","type":"post","link":"https:\/\/blog.ultramsg.com\/it\/ricevere-messaggi-whatsapp-con-c-webhook\/","title":{"rendered":"Ricevi messaggi WhatsApp utilizzando C# e webhook"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">introduzione<\/h2>\n\n<p>In questo tutorial creeremo un semplice esempio per leggere i messaggi WhatsApp in arrivo usando c#.<\/p>\n\n<h2 class=\"wp-block-heading\">Scarica il progetto <\/h2>\n\n<p>Puoi scaricare i file di progetto da <a href=\"https:\/\/github.com\/ultramsg\/whatsapp-webhook-csharp\/archive\/refs\/heads\/main.zip\" target=\"_blank\" data-type=\"URL\" data-id=\"https:\/\/github.com\/ultramsg\/whatsapp-webhook-csharp\/archive\/refs\/heads\/main.zip\" rel=\"noreferrer noopener\">GitHub.<\/a><\/p>\n\n<h2 class=\"wp-block-heading\">Dipendenze<\/h2>\n\n<p>per scopi di sviluppo locale \u00e8 necessario un servizio di tunneling. Questo esempio usa ngrok, puoi scaricare Ngrok da <a href=\"https:\/\/ngrok.com\/download\" target=\"_blank\" rel=\"noopener\">qui<\/a> .<\/p>\n\n<h2 class=\"wp-block-heading\">eseguire il progetto<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"powershell\" class=\"EnlighterJSRAW\">dotnet watch<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">Inizia Ngrok<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"powershell\" class=\"EnlighterJSRAW\">ngrok http https:\/\/localhost:6000<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\">imposta l&#8217;URL del webhook<br\/><\/h2>\n\n<p>Vai al tuo account ultramsg per impostare l&#8217;URL Webhook dopo aver copiato l&#8217;URL Ngrok e aggiungi \/api\/ Route in questo modo:<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"655\" height=\"429\" src=\"https:\/\/blog.ultramsg.com\/wp-content\/uploads\/2022\/06\/image-8.png\" alt=\"\" class=\"wp-image-3893\" title=\"\" srcset=\"https:\/\/blog.ultramsg.com\/wp-content\/uploads\/2022\/06\/image-8.png 655w, https:\/\/blog.ultramsg.com\/wp-content\/uploads\/2022\/06\/image-8-300x196.png 300w\" sizes=\"auto, (max-width: 655px) 100vw, 655px\" \/><figcaption><strong>Webhook alla ricezione: VERO<\/strong><\/figcaption><\/figure><\/div>\n<h2 class=\"wp-block-heading\">ricevere messaggi WhatsApp<br\/><\/h2>\n\n<p>ora dovresti essere in grado di ricevere i webhook di WhatsApp.<\/p>\n\n<p><strong>Esempio di risposta json: <\/strong><\/p>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"json\" class=\"EnlighterJSRAW\">{\n  \"event_type\": \"message_received\",\n  \"instanceId\": \"1150\",\n  \"id\": \"\",\n  \"referenceId\": \"\",\n  \"data\": {\n    \"id\": \"false_10172127174@c.us_3EB02E5EB89CE03FB034\",\n    \"from\": \"10172127174@c.us\",\n    \"to\": \"10172127170@c.us\",\n    \"author\": \"\",\n    \"pushname\": \"E.St\",\n    \"ack\": \"\",\n    \"type\": \"chat\",\n    \"body\": \"Hi\",\n    \"media\": \"\",\n    \"fromMe\": false,\n    \"isForwarded\": false,\n    \"isMentioned\": false,\n    \"quotedMsg\": {},\n    \"mentionedIds\": &#91;],\n    \"time\": 1650002663\n  }\n}\n<\/code><\/code><\/pre>\n\n<p>Congratulazioni!<\/p>\n\n<p>Puoi visitare il progetto su <a href=\"https:\/\/github.com\/ultramsg\/whatsapp-webhook-csharp\" data-type=\"URL\" data-id=\"https:\/\/github.com\/ultramsg\/whatsapp-webhook-csharp\" target=\"_blank\" rel=\"noreferrer noopener\">GitHub<\/a> .<\/p>\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/ultramsg\/whatsapp-webhook-csharp\/blob\/main\/README.md#example-json-response\" target=\"_blank\" rel=\"noopener\"><\/a><\/h1>\n\n<h1 class=\"wp-block-heading\"><a href=\"https:\/\/github.com\/ultramsg\/whatsapp-webhook-csharp#run-project\" target=\"_blank\" rel=\"noopener\"><\/a><\/h1>\n","protected":false},"excerpt":{"rendered":"<p>introduzione In questo tutorial creeremo un semplice esempio per leggere i messaggi WhatsApp in arrivo &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Ricevi messaggi WhatsApp utilizzando C# e webhook\" class=\"read-more button\" href=\"https:\/\/blog.ultramsg.com\/it\/ricevere-messaggi-whatsapp-con-c-webhook\/#more-3948\" aria-label=\"Per saperne di pi\u00f9 su Ricevi messaggi WhatsApp utilizzando C# e webhook\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":3907,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[274],"tags":[284,277,278],"class_list":["post-3948","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-api-di-whatsapp","tag-c-it","tag-tutorial-it","tag-webhook-it","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\/it\/wp-json\/wp\/v2\/posts\/3948","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/comments?post=3948"}],"version-history":[{"count":3,"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/posts\/3948\/revisions"}],"predecessor-version":[{"id":3951,"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/posts\/3948\/revisions\/3951"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/media\/3907"}],"wp:attachment":[{"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/media?parent=3948"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/categories?post=3948"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/it\/wp-json\/wp\/v2\/tags?post=3948"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}