code: function () {
  
              const constraints = {
  
                  to: function (value, attributes, attributeName, options, constraints) {
                      if (validate.isEmpty(value)) {
                          return {
                              presence: {message: "is required"}
                          };
                      }
  
                      if (!validate.isArray(value) && !validate.isString(value)) {
                          return {
                              format: "must be a string or an array strings (phone numbers)"
                          };
                      }
  
                      if (validate.isString(value)) {
                          let isInvalid = !/^\+\d{1,3}\d{3,}$/.test(value);
                          if (isInvalid) {
                              return {
                                  format: "must be a valid phone number"
                              };
                          }
                      }
  
                      if (validate.isArray(value)) {
                          let foundInvalid = false;
                          value.forEach(function (phone) {
                              foundInvalid = !/^\+\d{1,3}\d{3,}$/.test(phone);
                          });
                          if (foundInvalid) {
                              return {
                                  format: "must NOT contain invalid phone number"
                              }
                          }
                      }
  
                      return null;
                  },
  
                  from: {
                      isString: true
                  },
                  message: {
                      presence: true
                  }
              };
  
              if (isBulk) {
                  constraints.enqueue = {
                      inclusion: [true]
                  };
              }
  
              if (isPremium) {
                  constraints.keyword = {
                      presence: true,
                      isString: true
                  };
                  constraints.linkId = {
                      presence: false,
                      isString: true
                  };
                  constraints.retryDurationInHours = {
                      numericality: true
                  }
              }
  
              const error = validate(params, constraints);
              if (error) {
                  let msg = "";
                  for (let k in error) {
                      msg += error[k] + "; ";
                  }
                  validationError = new Error(msg);
              }
          }
docs: Validate params