{"id":154,"date":"2022-01-24T20:15:30","date_gmt":"2022-01-24T20:15:30","guid":{"rendered":"https:\/\/blog.ultramsg.com\/%d8%a5%d8%b1%d8%b3%d8%a7%d9%84-%d8%b1%d8%b3%d8%a7%d9%84%d8%a9-%d8%b9%d8%a8%d8%b1-whatsapp-api-%d8%a8%d8%a7%d8%b3%d8%aa%d8%ae%d8%af%d8%a7%d9%85-php\/"},"modified":"2022-10-08T07:00:18","modified_gmt":"2022-10-08T07:00:18","slug":"%d8%a3%d8%b1%d8%b3%d9%84-%d9%88%d8%a7%d8%aa%d8%b3-%d8%a7%d8%a8-%d8%b1%d8%b3%d8%a7%d9%84%d8%a9-%d8%b9%d9%86-%d8%b7%d8%b1%d9%8a%d9%82-%d9%88%d8%a7%d8%aa%d8%b3-%d8%a7%d8%a8-api-%d8%a8%d8%a7%d8%b3%d8%aa","status":"publish","type":"post","link":"https:\/\/blog.ultramsg.com\/ar\/%d8%a3%d8%b1%d8%b3%d9%84-%d9%88%d8%a7%d8%aa%d8%b3-%d8%a7%d8%a8-%d8%b1%d8%b3%d8%a7%d9%84%d8%a9-%d8%b9%d9%86-%d8%b7%d8%b1%d9%8a%d9%82-%d9%88%d8%a7%d8%aa%d8%b3-%d8%a7%d8%a8-api-%d8%a8%d8%a7%d8%b3%d8%aa\/","title":{"rendered":"\u0643\u064a\u0641\u064a\u0629 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629 \u0639\u0628\u0631 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 PHP \u0628\u0633\u0647\u0648\u0644\u0629"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"introduction\">\u0645\u0642\u062f\u0645\u0629<br\/><\/h2>\n\n<p>\u0641\u064a \u0647\u0630\u0627 \u0627\u0644\u0628\u0631\u0646\u0627\u0645\u062c \u0627\u0644\u062a\u0639\u0644\u064a\u0645\u064a \u060c \u0633\u0646\u0646\u0634\u0626 \u0635\u0641\u062d\u0629 \u0644\u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629 \u0639\u0628\u0631 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 PHP<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"installation\">Installation<\/h2>\n\n<p>Just download ultramsg.class.php or use Composer:<\/p>\n\n<pre class=\"wp-block-preformatted\"><code data-enlighter-language=\"powershell\" class=\"EnlighterJSRAW\">composer require ultramsg\/whatsapp-php-sdk\n<\/code><div class=\"open_grepper_editor\" title=\"Edit &amp; Save To Grepper\"><div class=\"open_grepper_editor\" title=\"Edit &amp; Save To Grepper\"><\/div><\/div><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"authentication\">Authentication<\/h2>\n\n<p><a href=\"https:\/\/user.ultramsg.com\/signup.php\" target=\"_blank\" rel=\"noreferrer noopener\">Sign up<\/a> and Go to your instance dashboard and copy your Instance ID and Token which will be used for authenticating.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"example-usage-for-whatsapp-api-using-php\">\u0645\u062b\u0627\u0644 \u0639\u0644\u0649 \u0627\u0633\u062a\u062e\u062f\u0627\u0645 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 PHP:<\/h2>\n\n<p>Send your first WhatsApp message<\/p>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">require_once ('vendor\/autoload.php'); \/\/ if you use Composer\n\/\/require_once('ultramsg.class.php'); \/\/ if you download ultramsg.class.php\n\t\n$token=\"tof7lsdJasdloaa57e\"; \/\/ Ultramsg.com token\n$instance_id=\"instance1150\"; \/\/ Ultramsg.com instance id\n$client = new UltraMsg\\WhatsAppApi($token,$instance_id);\n\t\n$to=\"put_your_mobile_number_here\"; \n$body=\"Hello world\"; \n$api=$client-&gt;sendChatMessage($to,$body);\nprint_r($api);<\/code><\/code><\/pre>\n\n<ul class=\"wp-block-list\"><li><strong>$ to:<\/strong> \u0631\u0642\u0645 WhatsApp \u0627\u0644\u062e\u0627\u0635 \u0628\u0627\u0644\u0645\u0633\u062a\u0644\u0645 \u0628\u0627\u0644\u062a\u0646\u0633\u064a\u0642 \u0627\u0644\u062f\u0648\u0644\u064a \u060c \u0639\u0644\u0649 \u0633\u0628\u064a\u0644 \u0627\u0644\u0645\u062b\u0627\u0644 \u060c +14155552671 \u0623\u0648 chatID \u0644\u062c\u0647\u0629 \u0627\u062a\u0635\u0627\u0644 \u0623\u0648 \u0645\u062c\u0645\u0648\u0639\u0629 \u060c \u0639\u0644\u0649 \u0633\u0628\u064a\u0644 \u0627\u0644\u0645\u062b\u0627\u0644 <a href=\"mailto:14155552671@c.us\">14155552671@c.us<\/a> \u0623\u0648 <a href=\"mailto:14155552671-441234567890@g.us\">14155552671-441234567890@g.us<\/a><\/li><li><strong>$body<\/strong> : Message text.<\/li><\/ul>\n\n<p><strong>Note:<\/strong> You can see <a href=\"https:\/\/blog.ultramsg.com\/whatsapp-api-group\/\">here<\/a> how to send WhatsApp messages to a group.<\/p>\n\n<h2 class=\"wp-block-heading\" id=\"send-image\">Send Image <\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$caption=\"image Caption\"; \n$image=\"https:\/\/file-example.s3-accelerate.amazonaws.com\/images\/test.jpg\"; \n$api=$client->sendImageMessage($to,$image,$caption);\nprint_r($api);<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-document\">Send Document <\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$filename=\"image Caption\"; \n$document=\"https:\/\/file-example.s3-accelerate.amazonaws.com\/documents\/cv.pdf\"; \n$api=$client-&gt;sendDocumentMessage($to,$filename,$document);\nprint_r($api);<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-audio\">Send Audio <\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$audio=\"https:\/\/file-example.s3-accelerate.amazonaws.com\/audio\/2.mp3\"; \n$api=$client-&gt;sendAudioMessage($to,$audio);\nprint_r($api);<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-voice\">Send Voice <\/h2>\n\n<p>\u064a\u0645\u0643\u0646\u0643 \u0625\u0631\u0633\u0627\u0644 \u062a\u0633\u062c\u064a\u0644 \u0635\u0648\u062a\u064a ppt \u0625\u0644\u0649 \u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062a\u0641 \u0623\u0648 \u0627\u0644\u0645\u062c\u0645\u0648\u0639\u0629 \u060c \u0644\u0643\u0646 WhatsApp \u062d\u0633\u0627\u0633 \u0644\u0647\u0630\u0627 \u0627\u0644\u0627\u0645\u062a\u062f\u0627\u062f \u060c \u064a\u062c\u0628 \u0623\u0646 \u062a\u0643\u0648\u0646 \u0628\u062a\u0646\u0633\u064a\u0642 OGG \u0648\u064a\u062c\u0628 \u0623\u0646 \u064a\u0643\u0648\u0646 <strong>codecs<\/strong> \u0647\u0648 <strong>opus<\/strong> \u060c \u0644\u0645\u0632\u064a\u062f \u0645\u0646 \u0627\u0644\u0645\u0639\u0644\u0648\u0645\u0627\u062a \u060c \u064a\u0645\u0643\u0646\u0643 \u0627\u0644\u0627\u0637\u0644\u0627\u0639 \u0639\u0644\u0649 \u0647\u0630\u0647 <a href=\"https:\/\/blog.ultramsg.com\/how-to-send-ogg-file-using-whatsapp-api\/\" data-type=\"URL\" data-id=\"https:\/\/blog.ultramsg.com\/how-to-send-ogg-file-using-whatsapp-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u0627\u0644\u0645\u0642\u0627\u0644\u0629<\/a> .<\/p>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$audio=\"https:\/\/file-example.s3-accelerate.amazonaws.com\/voice\/oog_example.ogg\"; \n$api=$client-&gt;sendVoiceMessage($to,$audio);\nprint_r($api);<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-video\">Send Video <\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$video=\"https:\/\/file-example.s3-accelerate.amazonaws.com\/video\/test.mp4\"; \n$api=$client-&gt;sendVideoMessage($to,$video);\nprint_r($api);<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-link\">Send Link <\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$link=\"https:\/\/ultramsg.com\"; <\/code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$api=$client-&gt;sendLinkMessage($to,$link);\nprint_r($api);<\/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<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$contact=\"14000000001@c.us\"; \n$api=$client-&gt;sendContactMessage($to,$contact);\nprint_r($api);<\/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<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$address=\"ABC company \\n Sixth floor , office 38\"; \n$lat=\"25.197197\"; \n$lng=\"55.2721877\"; \n$api=$client-&gt;sendLocationMessage($to,$address,$lat,$lng);\nprint_r($api);<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\" id=\"send-vcard\">\u0625\u0631\u0633\u0627\u0644 Vcard<\/h2>\n\n<pre class=\"wp-block-code\"><code><code data-enlighter-language=\"php\" class=\"EnlighterJSRAW\">$to=\"put_your_mobile_number_here\"; \n$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\";\n$vcard = preg_replace(\"\/&#91;\\n\\r]\/\", \"\\n\", $vcard);\n$api=$client-&gt;sendVcardMessage($to,$vcard);\nprint_r($api)<\/code><\/code><\/pre>\n\n<h2 class=\"wp-block-heading\"><\/h2>\n\n<p>\u064a\u0645\u0643\u0646\u0643 \u0645\u0634\u0627\u0647\u062f\u0629 \u0627\u0644\u062e\u0637\u0648\u0627\u062a \u0627\u0644\u0633\u0627\u0628\u0642\u0629 \u0641\u064a \u0647\u0630\u0627 <a href=\"https:\/\/www.youtube.com\/watch?v=OqDOKyMIp20\" data-type=\"URL\" target=\"_blank\" rel=\"noreferrer noopener\">\u0627\u0644\u0641\u064a\u062f\u064a\u0648<\/a> \u060c \u0648\u064a\u0645\u0643\u0646\u0643 \u0645\u0634\u0627\u0647\u062f\u0629 <a href=\"https:\/\/docs.ultramsg.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">\u0648\u062b\u0627\u0626\u0642 WhatsApp API<\/a> \u0627\u0644\u0643\u0627\u0645\u0644\u0629.<\/p>\n\n<p><em>\u0647\u0644 \u062a\u0633\u062a\u062e\u062f\u0645 Ultramsg <a href=\"https:\/\/github.com\/ultramsg\/whatsapp-php-sdk\" target=\"_blank\" rel=\"noopener\">WhatsApp API<\/a> PHP SDK<\/em> \u061f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0645\u0642\u062f\u0645\u0629 \u0641\u064a \u0647\u0630\u0627 \u0627\u0644\u0628\u0631\u0646\u0627\u0645\u062c \u0627\u0644\u062a\u0639\u0644\u064a\u0645\u064a \u060c \u0633\u0646\u0646\u0634\u0626 \u0635\u0641\u062d\u0629 \u0644\u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629 \u0639\u0628\u0631 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 PHP &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"\u0643\u064a\u0641\u064a\u0629 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629 \u0639\u0628\u0631 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 PHP \u0628\u0633\u0647\u0648\u0644\u0629\" class=\"read-more button\" href=\"https:\/\/blog.ultramsg.com\/ar\/%d8%a3%d8%b1%d8%b3%d9%84-%d9%88%d8%a7%d8%aa%d8%b3-%d8%a7%d8%a8-%d8%b1%d8%b3%d8%a7%d9%84%d8%a9-%d8%b9%d9%86-%d8%b7%d8%b1%d9%8a%d9%82-%d9%88%d8%a7%d8%aa%d8%b3-%d8%a7%d8%a8-api-%d8%a8%d8%a7%d8%b3%d8%aa\/#more-154\" aria-label=\"Read more about \u0643\u064a\u0641\u064a\u0629 \u0625\u0631\u0633\u0627\u0644 \u0631\u0633\u0627\u0644\u0629 \u0639\u0628\u0631 WhatsApp API \u0628\u0627\u0633\u062a\u062e\u062f\u0627\u0645 PHP \u0628\u0633\u0647\u0648\u0644\u0629\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":135,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[26,40],"class_list":["post-154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category---api","tag-php-ar","tag-40","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\/154","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=154"}],"version-history":[{"count":97,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":4610,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/posts\/154\/revisions\/4610"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/media\/135"}],"wp:attachment":[{"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ultramsg.com\/ar\/wp-json\/wp\/v2\/tags?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}