{"id":2320,"date":"2022-05-03T01:38:03","date_gmt":"2022-05-03T01:38:03","guid":{"rendered":"https:\/\/blog.ultramsg.com\/%e0%a4%aa%e0%a5%8d%e0%a4%b0%e0%a4%be%e0%a4%aa%e0%a5%8d%e0%a4%a4-%e0%a4%b5%e0%a5%8d%e0%a4%b9%e0%a4%be%e0%a4%9f%e0%a5%8d%e0%a4%b8%e0%a4%8f%e0%a4%aa-%e0%a4%b8%e0%a4%82%e0%a4%a6%e0%a5%87%e0%a4%b6\/"},"modified":"2022-05-03T01:39:40","modified_gmt":"2022-05-03T01:39:40","slug":"%e0%a4%aa%e0%a5%8d%e0%a4%b0%e0%a4%be%e0%a4%aa%e0%a5%8d%e0%a4%a4-%e0%a4%b5%e0%a5%8d%e0%a4%b9%e0%a4%be%e0%a4%9f%e0%a5%8d%e0%a4%b8%e0%a4%8f%e0%a4%aa-%e0%a4%b8%e0%a4%82%e0%a4%a6%e0%a5%87%e0%a4%b6","status":"publish","type":"post","link":"https:\/\/blog.ultramsg.com\/hi\/%e0%a4%aa%e0%a5%8d%e0%a4%b0%e0%a4%be%e0%a4%aa%e0%a5%8d%e0%a4%a4-%e0%a4%b5%e0%a5%8d%e0%a4%b9%e0%a4%be%e0%a4%9f%e0%a5%8d%e0%a4%b8%e0%a4%8f%e0%a4%aa-%e0%a4%b8%e0%a4%82%e0%a4%a6%e0%a5%87%e0%a4%b6\/","title":{"rendered":"PHP \u0914\u0930 \u0935\u0947\u092c\u0939\u0941\u0915 \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0915\u0947 WhatsApp \u0938\u0902\u0926\u0947\u0936 \u092a\u094d\u0930\u093e\u092a\u094d\u0924 \u0915\u0930\u0947\u0902"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"introduction\">\u092a\u0930\u093f\u091a\u092f<\/h2>\n\n<p>\u0907\u0938 \u091f\u094d\u092f\u0942\u091f\u094b\u0930\u093f\u092f\u0932 \u092e\u0947\u0902, \u0939\u092e PHP \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0915\u0947 \u0906\u0928\u0947 \u0935\u093e\u0932\u0947 \u0935\u094d\u0939\u093e\u091f\u094d\u0938\u090f\u092a \u092e\u0948\u0938\u0947\u091c \u0915\u094b \u0939\u0948\u0902\u0921\u0932 \u0915\u0930\u0928\u0947 \u0915\u0947 \u0932\u093f\u090f \u090f\u0915 \u092a\u0947\u091c \u092c\u0928\u093e\u090f\u0902\u0917\u0947\u0964<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"dependencies\">\u0928\u093f\u0930\u094d\u092d\u0930\u0924\u093e<\/h2>\n\n<p>\u0938\u094d\u0925\u093e\u0928\u0940\u092f \u0935\u093f\u0915\u093e\u0938 \u0909\u0926\u094d\u0926\u0947\u0936\u094d\u092f\u094b\u0902 \u0915\u0947 \u0932\u093f\u090f, \u090f\u0915 \u0938\u0941\u0930\u0902\u0917 \u0938\u0947\u0935\u093e \u0915\u0940 \u0906\u0935\u0936\u094d\u092f\u0915\u0924\u093e \u0939\u0948\u0964 \u092f\u0939 \u0909\u0926\u093e\u0939\u0930\u0923 <a href=\"https:\/\/ngrok.com\/\" rel=\"nofollow noopener\" target=\"_blank\">ngrok<\/a> \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0924\u093e \u0939\u0948, \u0906\u092a <a href=\"https:\/\/ngrok.com\/download\" data-type=\"URL\" data-id=\"https:\/\/ngrok.com\/download\" rel=\"nofollow noopener\" target=\"_blank\">\u092f\u0939\u093e\u0902<\/a> \u0938\u0947 ngrok \u0921\u093e\u0909\u0928\u0932\u094b\u0921 \u0915\u0930 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"example\">\u0909\u0926\u093e\u0939\u0930\u0923<\/h2>\n\n<p>\u092f\u0939 \u090f\u0915 \u092c\u0939\u0941\u0924 \u0939\u0940 \u0938\u0930\u0932 \u0909\u0926\u093e\u0939\u0930\u0923 \u0939\u0948, \u091c\u093f\u0938\u092e\u0947\u0902 \u0938\u0930\u094d\u0935\u0930 \u0905\u0928\u0941\u0930\u094b\u0927 \u0938\u0947 log.txt \u092b\u093c\u093e\u0907\u0932 \u092e\u0947\u0902 \u092e\u0941\u0916\u094d\u092f \u092d\u093e\u0917 \u0915\u094b \u0932\u0949\u0917 \u0915\u0930\u0924\u093e \u0939\u0948\u0964<\/p>\n\n<p>\u092c\u0949\u0921\u0940 \u092e\u0947\u0902 Ultramsg API WhatsApp \u0907\u0902\u0938\u094d\u091f\u0947\u0902\u0938 \u0938\u0947 \u092d\u0947\u091c\u0940 \u0917\u0908 \u092a\u0942\u0930\u0940 \u0935\u0947\u092c\u0939\u0941\u0915 \u091c\u093e\u0928\u0915\u093e\u0930\u0940 \u0939\u0948\u0964<\/p>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$data = file_get_contents(\"php:\/\/input\");\n$event = json_decode($data, true);\nif(isset($event)){\n\t\/\/Here, you now have event and can process them how you like e.g Add to the database or generate a response\n\t$file = 'log.txt';  \n\t$data =json_encode($event).\"\\n\";  \n\tfile_put_contents($file, $data, FILE_APPEND | LOCK_EX);\n<\/code>}<\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"on-server-usage\">\u0938\u0930\u094d\u0935\u0930 \u0909\u092a\u092f\u094b\u0917 \u092a\u0930<\/h2>\n\n<p>\u0909\u092a\u0930\u094b\u0915\u094d\u0924 \u0909\u0926\u093e\u0939\u0930\u0923 \u092b\u093c\u093e\u0907\u0932 \u0915\u094b test.php \u0915\u0947 \u0930\u0942\u092a \u092e\u0947\u0902 \u0938\u0939\u0947\u091c\u0947\u0902 \u0914\u0930 \u0907\u0938\u0947 \u0905\u092a\u0928\u0947 \u0938\u0930\u094d\u0935\u0930 \u092a\u0930 \u0905\u092a\u0932\u094b\u0921 \u0915\u0930\u0947\u0902 Webhook URL \u0939\u094b\u0917\u093e:<\/p>\n\n<pre class=\"wp-block-code\"><code><a href=\"http:\/\/your-server\/webhook.php\"><code data-enlighter-language=\"powershell\" class=\"EnlighterJSRAW\">http:\/\/your-server\/test.php<\/code><\/a><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"on-local-usage-with-ngrok\">\u0938\u094d\u0925\u093e\u0928\u0940\u092f \u0909\u092a\u092f\u094b\u0917 \u092a\u0930 ngrok . \u0915\u0947 \u0938\u093e\u0925<\/h2>\n\n<p>\u0909\u092a\u0930\u094b\u0915\u094d\u0924 \u0909\u0926\u093e\u0939\u0930\u0923 \u092b\u093c\u093e\u0907\u0932 \u0915\u094b \u0905\u092a\u0928\u0947 \u0932\u094b\u0915\u0932\u0939\u094b\u0938\u094d\u091f \u092e\u0947\u0902 test.php \u0915\u0947 \u0930\u0942\u092a \u092e\u0947\u0902 \u0938\u0939\u0947\u091c\u0947\u0902 \u0914\u0930 URL \u0939\u094b\u0917\u093e:<\/p>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"powershell\" class=\"EnlighterJSRAW\">http:\/\/localhost\/test.php<\/code><\/code><\/pre>\n\n<p>\u090f\u0928\u0917\u094d\u0930\u094b\u0915 \u0936\u0941\u0930\u0942 \u0915\u0930\u0947\u0902:<\/p>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"powershell\" class=\"EnlighterJSRAW\">ngrok http 80<\/code><\/code><\/pre>\n\n<p>\u0907\u0938\u0915\u0947 \u092c\u093e\u0926 \u0906\u092a\u0915\u094b \u090f\u0915 \u0926\u0947\u0916\u0928\u093e \u091a\u093e\u0939\u093f\u090f<br\/>*.ngrok.io \u092f\u0942\u0906\u0930\u090f\u0932\u0964<br\/>\u0909\u0926\u093e\u0939\u0930\u0923 \u0915\u0947 \u0932\u093f\u090f :<br\/>https:\/\/7647-115-83-121-164.ngrok.io<br\/>\u0932\u094b\u0915\u0932\u0939\u094b\u0938\u094d\u091f \u0915\u094b \u092c\u0926\u0932\u0947\u0902<br\/>ngrok.io \u092f\u0942\u0906\u0930\u090f\u0932<br\/>\u092f\u0942\u0906\u0930\u090f\u0932 \u0939\u094b\u0917\u093e:<br\/>https:\/\/7647-115-83-121-164.ngrok.io\/webhook.php<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"what-s-next\">\u0906\u0917\u0947 \u0915\u094d\u092f\u093e \u0939\u094b\u0917\u093e?<\/h2>\n\n<p>\u0907\u0902\u0938\u094d\u091f\u0947\u0902\u0938 \u0938\u0947\u091f\u093f\u0902\u0917 \u092e\u0947\u0902 \u0905\u092a\u0928\u093e \u092f\u0942\u0906\u0930\u090f\u0932 \u092a\u0947\u0938\u094d\u091f \u0915\u0930\u0947\u0902\u0964<br\/>\u0906\u092a\u0915\u094b \u0905\u092d\u0940 \u0935\u0947\u092c\u0939\u0941\u0915 \u092a\u094d\u0930\u093e\u092a\u094d\u0924 \u0915\u0930\u0928\u0947 \u092e\u0947\u0902 \u0938\u0915\u094d\u0937\u092e \u0939\u094b\u0928\u093e \u091a\u093e\u0939\u093f\u090f \u0914\u0930 \u0906\u092a \u0909\u0928\u094d\u0939\u0947\u0902 log.txt \u092b\u093c\u093e\u0907\u0932 \u092e\u0947\u0902 \u0926\u0947\u0916 \u0938\u0915\u0924\u0947 \u0939\u0948\u0902\u0964<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"example-json-response\">\u0909\u0926\u093e\u0939\u0930\u0923 JSON \u092a\u094d\u0930\u0924\u093f\u0915\u094d\u0930\u093f\u092f\u093e <\/h2>\n\n<pre class=\"wp-block-code\"><code>{\n  \"event_type\": \"message_received\",\n  \"instanceId\": \"90\",\n  \"data\": {\n    \"id\": \"false_10172127174@c.us_7ECAED9EB68D3474BE591443134C2E3F\",\n    \"from\": \"10172127174@c.us\",\n    \"to\": \"10172127175@c.us\",\n    \"ack\": \"pending\",\n    \"type\": \"chat\",\n    \"body\": \"I can't send a message using php code\\nCan you help me\",\n    \"fromMe\": false,\n    \"isForwarded\": false,\n    \"time\": 1643311467\n  }\n}<\/code><\/pre>\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Receive WhatsApp messages using PHP | WhatsApp api Webhook\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/TfQOclLMIng?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n<h2 class=\"wp-block-heading\" id=\"useful-links\">\u0909\u092a\u092f\u094b\u0917\u0940 \u0915\u0921\u093c\u093f\u092f\u093e\u0902<\/h2>\n\n<ul class=\"wp-block-list\"><li><span style=\"font-family: -apple-system, system-ui, BlinkMacSystemFont, \" segoe=\"\" ui=\"\" helvetica=\"\" arial=\"\" sans-serif=\"\" color=\"\" emoji=\"\" symbol=\"\">\u092a\u0942\u0930\u094d\u0923<\/span> <a style=\"font-family: -apple-system, system-ui, BlinkMacSystemFont, \" segoe=\"\" ui=\"\" helvetica=\"\" arial=\"\" sans-serif=\"\" color=\"\" emoji=\"\" symbol=\"\" href=\"https:\/\/docs.ultramsg.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u0935\u094d\u0939\u093e\u091f\u094d\u0938\u090f\u092a \u090f\u092a\u0940\u0906\u0908 \u092a\u094d\u0930\u0932\u0947\u0916\u0928<\/a> <span style=\"font-family: -apple-system, system-ui, BlinkMacSystemFont, \" segoe=\"\" ui=\"\" helvetica=\"\" arial=\"\" sans-serif=\"\" color=\"\" emoji=\"\" symbol=\"\">\u0964<\/span><\/li><li>PHP \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0915\u0947 <a href=\"https:\/\/blog.ultramsg.com\/hi\/%e0%a4%ad%e0%a5%87%e0%a4%9c%e0%a5%87%e0%a4%82-%e0%a4%b5%e0%a5%8d%e0%a4%b9%e0%a4%be%e0%a4%9f%e0%a5%8d%e0%a4%b8%e0%a4%8f%e0%a4%aa-%e0%a4%b8%e0%a4%82%e0%a4%a6%e0%a5%87%e0%a4%b6-%e0%a4%a6%e0%a4%b0-2\/\">WhatsApp API<\/a> \u0938\u0902\u0926\u0947\u0936 \u092d\u0947\u091c\u0947\u0902\u0964<\/li><\/ul>\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u092a\u0930\u093f\u091a\u092f \u0907\u0938 \u091f\u094d\u092f\u0942\u091f\u094b\u0930\u093f\u092f\u0932 \u092e\u0947\u0902, \u0939\u092e PHP \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0915\u0947 \u0906\u0928\u0947 \u0935\u093e\u0932\u0947 \u0935\u094d\u0939\u093e\u091f\u094d\u0938\u090f\u092a \u092e\u0948\u0938\u0947\u091c \u0915\u094b \u0939\u0948\u0902\u0921\u0932 &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"PHP \u0914\u0930 \u0935\u0947\u092c\u0939\u0941\u0915 \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0915\u0947 WhatsApp \u0938\u0902\u0926\u0947\u0936 \u092a\u094d\u0930\u093e\u092a\u094d\u0924 \u0915\u0930\u0947\u0902\" class=\"read-more button\" href=\"https:\/\/blog.ultramsg.com\/hi\/%e0%a4%aa%e0%a5%8d%e0%a4%b0%e0%a4%be%e0%a4%aa%e0%a5%8d%e0%a4%a4-%e0%a4%b5%e0%a5%8d%e0%a4%b9%e0%a4%be%e0%a4%9f%e0%a5%8d%e0%a4%b8%e0%a4%8f%e0%a4%aa-%e0%a4%b8%e0%a4%82%e0%a4%a6%e0%a5%87%e0%a4%b6\/#more-2320\" aria-label=\"Read more about PHP \u0914\u0930 \u0935\u0947\u092c\u0939\u0941\u0915 \u0915\u093e \u0909\u092a\u092f\u094b\u0917 \u0915\u0930\u0915\u0947 WhatsApp \u0938\u0902\u0926\u0947\u0936 \u092a\u094d\u0930\u093e\u092a\u094d\u0924 \u0915\u0930\u0947\u0902\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":2200,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[186],"tags":[193,187,188],"class_list":["post-2320","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-186","tag-webhook-hi","tag-187","tag-188","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\/hi\/wp-json\/wp\/v2\/posts\/2320","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/comments?post=2320"}],"version-history":[{"count":7,"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/posts\/2320\/revisions"}],"predecessor-version":[{"id":2335,"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/posts\/2320\/revisions\/2335"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/media\/2200"}],"wp:attachment":[{"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/media?parent=2320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/categories?post=2320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/hi\/wp-json\/wp\/v2\/tags?post=2320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}