PHP code example of wappico / wappi-php-client
1. Go to this page and download the library: Download wappico/wappi-php-client library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
wappico / wappi-php-client example snippets
$whatsapp = new \Wappi\Client\Strategies\Whatsapp(apiKey: '')
$whatsapp->phoneNumber("521782003377")->markAsOptIn();
$whatsapp = new \Wappi\Client\Strategies\Whatsapp(apiKey: '')
$whatsapp->phoneNumber("521782003377");
$whatsapp->request([
\Wappi\Client\Message\Message::create(["text" => "¡Hi there!"]),
\Wappi\Client\Message\Image::create(["url" => "https://wappi.co/image.png", "text" => "¡Hi there!"]),
]);
$whatsapp = new \Wappi\Client\Strategies\Whatsapp(apiKey: '',);
$optionA = \Wappi\Client\Message\InteractiveListSectionOption::create([
"id" => "optionA",
"title" => "title a",
"description" => "description a",
]);
$optionB = \Wappi\Client\Message\InteractiveListSectionOption::create([
"id" => 123,
"title" => "title b",
"description" => "description b",
]);
$optionC = \Wappi\Client\Message\InteractiveListSectionOption::create([
"id" => "optionA123",
"title" => "title c",
"description" => "description c",
]);
$sections = [
\Wappi\Client\Message\InteractiveListSection::create([
"title" => "First section",
"description" => "some a",
"options" => [
$optionA,
]
]),
\Wappi\Client\Message\InteractiveListSection::create([
"title" => "Second section",
"description" => "some b",
"options" => [
$optionB, $optionC,
]
])
];
\Wappi\Client\Message\InteractiveList::create([
"id" => 1111,
"title" => "demo",
"text" => "some description",
"buttonTitle" => "Menú",
"sections" => $sections
]);
$whatsapp = \Wappi\Client\Message\InteractiveText::create([
"id" => "",
"header" => "",
"text" => "",
"footer" => "",
"options" => [
\Wappi\Client\Message\InteractiveButton::create([
"id" => "foo",
"text" => "bar"
]),
\Wappi\Client\Message\InteractiveButton::create([
"id" => "foo2",
"text" => "bar2"
]),
\Wappi\Client\Message\InteractiveButton::create([
"id" => "foo3",
"text" => "bar3"
]),
],
]);
$whatsapp = \Wappi\Client\Message\Contact::create([
"name" => \Wappi\Client\Message\ContactName::create([
"firstName" => "Dev",
"lastName" => "Support",
"formattedName" => "Dev Support",
]),
"org" => [
\Wappi\Client\Message\ContactOrg::create([
"company" => "Meta Inc.",
])
],
"emails" => [
\Wappi\Client\Message\ContactEmail::create([
"email" => "[email protected] ",
"type" => "WORK",
])
],
"phones" => [
\Wappi\Client\Message\ContactPhone::create([
"phone" => "7738305433",
"type" => "Mobile",
])
],
"addresses" => [
\Wappi\Client\Message\ContactAddress::create([
"city" => "Menlo Park",
"country" => "United States",
"countryCode" => "us",
"state" => "CA",
"street" => "1 Hacker Way",
"type" => "HOME",
"zip" => "94025",
]),
\Wappi\Client\Message\ContactAddress::create([
"city" => "Menlo Park",
"country" => "United States",
"countryCode" => "us",
"state" => "CA",
"street" => "200 Jefferson Dr",
"type" => "WORK",
"zip" => "94025",
])
],
"urls" => [
\Wappi\Client\Message\ContactAddress::create([
"url" => "https://www.facebook.com",
"type" => "WORK",
])
],
]);
composer