AVADA Email Marketing API bindings for PHP to make it easier for developer to connect with AVADA Marketing Automation platform.
composer require avadaio/avadaio-php-client
Our API documentation is located at: AVADA API Documentation. You can see our API for more reference.
AvadaIoSdk uses curl extension for handling http calls. So you need to have the curl extension installed and enabled with PHP.
$avadaio = new AvadaIo\AvadaIoSdk([
'appId' => "[YOUR_APP_ID]",
"appKey" => "[YOUR_APP_KEY]"
]);
This module exports a constructor function which takes an associative array.
Creates a new AVADA
instance.
options
- Required - An associative array with two indexes
appId
- RequiredappKey
- Required
You can obtain your appId
and appKey
after creating an account with AVADA and go to the Manage Keys page
An AvadaIoSdk
instance.
Throws an SdkException
exception if the required options are missing.
Every resource is accessed via your $avadaio
instance:
$avadaio = new AvadaIo\AvadaIoSdk([
'appId' => "[YOUR_APP_ID]",
"appKey" => "[YOUR_APP_KEY]"
]);
// $avadaio-><resource_name>-><method_name>
Each method returns ApiResponse
object with 3 properties:
success
- booleandata
- any - optionalmessage
- string
$result = $avadaio->Contact->create([
"description" => "",
"email" => "[email protected]",
"firstName" => "John",
"isSubscriber" => true,
"lastName" => "Doe",
"phoneNumber" => "+123465789",
"phoneNumberCountry" => "US",
"source" => "magento",
"orderCount" => 0,
"totalSpent" => 0,
"country" => "US",
"city" => "",
"address" => "",
"tags" => "Email Marketing"
]);
The JSON return from the API is like this:
{"success": true, "message": "Hook create/update customers complete"}
This behavior is the same for all resources.
$result = $avadaio->Connection->test();
if ($result->success) {
echo 'Connection established';
}
More examples can be found in the tests
folder in the project source code.
- Connection
test()
Test the connection using yourappKey
andappId
- Form
list()
Get a list of inline forms to integrate AVADA Forms into your page builder
- Contact
create(data)
Create a new contact in your AVADA adminupdate(data)
Update an existing contact in your AVADA adminbulk(data)
Create new contacts in your AVADA admin in bulk
- Subscriber
add(data)
Add a new contact to your contact list as a subscriber. Trigger the New Subscriber automation event.
- Review
submit(data)
Trigger the submit of a new review on your store. Trigger On new review automation event.
- Checkout
create(data)
Trigger a new checkout event to AVADA, which will be used for the Abandoned Cart Automation.update(data)
Trigger an update to a checkout event to AVADA. For example, update checkout email so that the cart will be qualified for Abandoned Cart Email.remove(id)
Remove a checkout.
- Order
create(data)
Trigger a new order event to AVADA. Trigger New Order automation event.update(data)
Update an existing order.complete(data)
Complete an order. Trigger Cross-sell, Up-sell automation events.bulk(data)
Sync your orders to AVADA using bulk order inserts.refund(data)
Trigger a refund event to AVADAinvoice(data)
Trigger a fulfillment event to AVADAship(data)
Trigger a shipping event to AVADA
If you need any support, you can reach to us within our customer chat support inside your app