Skip to content

support for send_invite #90

Open
Open
@treii28

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions