private function buildPayload( $type, $to, $templateId, array $personalisation, $reference ){

        $payload = [
            'template_id'=> $templateId
        ];

        if ( $type == 'sms' ) {
            $payload['phone_number'] = $to;
        } else if ( $type == 'email' ) {
            $payload['email_address'] = $to;
        }

        if ( count($personalisation) > 0 ) {
            $payload['personalisation'] = $personalisation;
        }

        if ( isset($reference) && $reference != '' ) {
            $payload['reference'] = $reference;
        }

        return $payload;

    }