All Collections
Integrations
Other Ecommerce Platforms
Queuing Review Invitations using PHP code
Queuing Review Invitations using PHP code
Tom Goodwin avatar
Written by Tom Goodwin
Updated over a week ago

If we don’t provide a plugin that suits your requirements then we have provided this starting point for anyone who wants to write custom PHP code to queue review invitations.

Requirements

This is an option that would be available on our Professional plan & above.

Navigation

To use this you would need to use the API Credentials.

  • Login to your REVIEWS.io Account

  • Select Integrations

  • Select API

PHP Code

<?php
$store = 'STORE-ID-GOES-HERE';
$apikey = 'API-KEY-GOES-HERE';
 
$headersRequest = array(
"store: ".$store,
"apikey: ".$apikey,
"Content-Type: application/json"
);
 
$bodyRequest = array(
"name" => "Demo Customer",
"email" => "demo-email@reviews.co.uk",
"order_id" => 12345,
"products" => array(
array(
"sku" => "123",
"name" => "Test Product",
"image" => "http://www.reviews.co.uk/test-image.jpg",
"pageUrl" => "https://www.reviews.co.uk/test-product"
)
)
);
 
// Queue Merchant Invitation
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.reviews.co.uk/merchant/invitation');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headersRequest);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($bodyRequest));
$response = curl_exec($ch);
print_r($response);
 
// Queue Product Invitation
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.reviews.co.uk/product/invitation');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headersRequest);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($bodyRequest));
$response = curl_exec($ch);
print_r($response);

Did this answer your question?