All Downloads are FREE. Search and download functionalities are using the official Maven repository.

.crm-proto.0.0.10.source-code.crm.proto Maven / Gradle / Ivy

syntax = "proto3";

package crm;

import "google/protobuf/timestamp.proto";
import "google/protobuf/wrappers.proto";

option java_multiple_files = true;
option java_outer_classname = "CrmProto";
option java_package = "dev.crashteam.crm";

message UserContact {
  string email = 1;
  int64 phone = 2;
  optional string inn = 3;
}

message UserIdentity {
  string first_name = 1; // Ex: Vitaliy
}

message UserPhoneNumber {
  int64 phone_number = 1; // Ex: 79033048560
}

message CreateLeadRequest {
  oneof payload {
    CreateDemoLead create_demo_lead = 1;
    CreateFeedbackLead create_feedback_lead = 2;
    CreateServiceLead create_service_lead = 3;
  }
  UtmTag utm_tag = 4;

  message CreateDemoLead {
    UserIdentity user_identity = 1;
    UserPhoneNumber user_phone_number = 2;
    string user_email = 3;
    optional string telegram_username = 4;
  }

  message CreateFeedbackLead {
    UserIdentity user_identity = 1;
    UserPhoneNumber user_phone_number = 2;
    string user_email = 3;
    string feedback_message = 4;
    optional string telegram_username = 5;
  }

  message CreateServiceLead {
    UserIdentity user_identity = 1;
    UserPhoneNumber user_phone_number = 2;
    string user_email = 3;
    string service_name = 4;
    optional string telegram_username = 5;
  }

  message UtmTag {
    optional string utm_source = 1;
    optional string utm_medium = 2;
    optional string utm_campaign = 3;
    optional string utm_content = 4;
    optional string utm_term = 5;
  }
}

message SMSUserMessage {
  string sender_name = 1;
  repeated string receiver_phone_number = 2;
  string text = 3;
  optional google.protobuf.Timestamp send_at_time = 4;
}

message SMSUserAuthMessage {
  string receiver_phone_number = 1;
}

message CreateLeadResponse {
  oneof response {
    SuccessResponse success_response = 1;
    ErrorResponse error_response = 2;
  }

  message SuccessResponse {
  }

  message ErrorResponse {
    ErrorCode errorCode = 1;
    optional string description = 2;

    enum ErrorCode {
      ERROR_CODE_UNKNOWN = 0;
      ERROR_CODE_USER_LEAD_ALREADY_EXISTS = 1;
    }
  }
}

message UpdateUserContactInfoRequest {
  string user_id = 1;
  oneof payload {
    InitialUpdateContactInfoPayload initial_update_contact_info_payload = 10;
    ApproveUpdateContactInfoPayload approve_update_contact_info_payload = 11;
  }

  message InitialUpdateContactInfoPayload {
    string email = 1;
    int64 phone_number = 2;
    optional string inn = 3;
  }
  message ApproveUpdateContactInfoPayload {
    string approve_code = 1;
  }
}

enum UpdateUserContactInfoState {
  UPDATE_USER_CONTACT_INFO_STATE_UNKNOWN = 0;
  UPDATE_USER_CONTACT_INFO_STATE_NOT_VERIFIED = 1;
  UPDATE_USER_CONTACT_INFO_STATE_VERIFIED = 2;
}

message UpdateUserContactInfoResponse {
  oneof response {
    SuccessResponse success_response = 1;
    ErrorResponse error_response = 2;
  }

  message SuccessResponse {
    UserContact user_contact = 1;
    UpdateUserContactInfoState update_user_contact_info_state = 2;
  }

  message ErrorResponse {
    ErrorCode errorCode = 1;
    optional string description = 2;

    enum ErrorCode {
      ERROR_CODE_UNKNOWN = 0;
      ERROR_CODE_INVALID_APPROVAL_CODE = 1;
      ERROR_CODE_INVALID_SEQUENCE = 2;
    }
  }
}

message SendUserMessageRequest {
  string user_id = 1;
  oneof message {
    SMSUserMessage sms_user_message = 10;
  }
}

message SendUserMessageResponse {
  oneof response {
    SuccessResponse success_response = 1;
    ErrorResponse error_response = 2;
  }

  message SuccessResponse {
  }

  message ErrorResponse {
    ErrorCode errorCode = 1;
    optional string description = 2;

    enum ErrorCode {
      ERROR_CODE_UNKNOWN = 0;
      ERROR_CODE_BAD_PARAMS = 1;
    }
  }
}

message SendUserAuthCodeRequest {
  string user_id = 1;
  oneof auth_message {
    SMSUserAuthMessage sms_user_auth_message = 10;
  }
}

message SendUserAuthCodeResponse {
  oneof response {
    SuccessResponse success_response = 1;
    ErrorResponse error_response = 2;
  }

  message SuccessResponse {
  }

  message ErrorResponse {
    ErrorCode errorCode = 1;
    optional string description = 2;

    enum ErrorCode {
      ERROR_CODE_UNKNOWN = 0;
      ERROR_CODE_BAD_PARAMS = 1;
      ERROR_CODE_LIMIT_EXCEEDED = 2;
    }
  }
}

message CheckUserAuthCodeRequest {
  string user_id = 1;
  int32 auth_code = 2;
}

message CheckUserAuthCodeResponse {
  oneof response {
    SuccessResponse success_response = 1;
    ErrorResponse error_response = 2;
  }

  message SuccessResponse {
  }

  message ErrorResponse {
    ErrorCode errorCode = 1;
    optional string description = 2;

    enum ErrorCode {
      ERROR_CODE_UNKNOWN = 0;
      ERROR_CODE_INVALID_AUTH_CODE = 1;
    }
  }
}

message GetUserContactInfoRequest {
  string user_id = 1;
}

message GetUserContactInfoResponse {
  oneof response {
    SuccessResponse success_response = 1;
    ErrorResponse error_response = 2;
  }

  message SuccessResponse {
    UserContact user_contact = 1;
    UpdateUserContactInfoState user_contact_info_state = 2;
  }

  message ErrorResponse {
    ErrorCode errorCode = 1;
    optional string description = 2;

    enum ErrorCode {
      ERROR_CODE_UNKNOWN = 0;
      ERROR_CODE_USER_NOT_FOUND = 1;
    }
  }
}

service CrmService {
  rpc createLead(CreateLeadRequest) returns (CreateLeadResponse);
  rpc getUserContactInfo(GetUserContactInfoRequest) returns (GetUserContactInfoResponse);
  rpc updateUserContactInfo(UpdateUserContactInfoRequest) returns (UpdateUserContactInfoResponse);
  rpc sendUserMessage(SendUserMessageRequest) returns (SendUserMessageResponse);
  rpc sendUserAuthCode(SendUserAuthCodeRequest) returns (SendUserAuthCodeResponse);
  rpc checkUserAuthCode(CheckUserAuthCodeRequest) returns (CheckUserAuthCodeResponse);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy