Open
Description
I added a bare-bones definition in mine:
'SendInvite' => [
'httpMethod' => 'POST',
'uri' => 'admin/customers/{id}/send_invite.json',
'responseModel' => 'GenericModel',
'summary' => 'Send an account invite to a customer',
'data' => ['root_key' => 'customer_invite'],
'parameters' => [
'id' => [
'description' => 'Customer ID',
'location' => 'uri',
'type' => 'integer',
'required' => true,
],
],
'additionalParameters' => [
'location' => 'json',
],
],
With nothing but the id, it sends a standard invite. Otherwise you can include additional details to customize it:
// fed with an array similar to the return value of getCustomer
function send_invite($customer) {
global $shopifyClient;
$command = $shopifyClient->getCommand(
'SendInvite',
[
'id' => $customer['id'],
"to" => $customer['email'],
"from" => "[email protected]",
"subject" => "Some subject line",
"custom_message" => <<<EOT
<p>Hello Everyone,</p>
<p>Please join my website</p>
<p>other custom message stuffs</p>
EOT
]
);
try {
$results = $shopifyClient->execute($command);
return $results;
} catch (Exception $e) {
$message = $e->getMessage();
return $message;
}
}
Metadata
Assignees
Labels
No labels