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;

    }
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;

    }
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 ; }
Generates the payload expected by the API.

@param string    $type
@param string    $to
@param string    $templateId
@param array     $personalisation
@param string    $reference

@return array
Generates the payload expected by the API .