Skip to main content
Glama
adrielisa

MCP Server: Weather & Upnify Integration

by adrielisa

create-upnify-prospect

Add new prospects to Upnify CRM by inputting their name, email, and other details, facilitating streamlined CRM management within weather-integrated workflows.

Instructions

Create a new prospect in Upnify CRM

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
apellidosNoLast name of the prospect
calleNoStreet address
ciudadNoCity
codigoPostalNoPostal code
coloniaNoNeighborhood/Colony
comentariosNoAdditional comments about the prospect
correoYesEmail address of the prospect
empresaNoCompany name
idPaisNoCountry code (e.g., MX, US)MX
movilNoMobile phone number
nombreYesFirst name of the prospect
puestoNoJob position
sexoNoGender (H for male, M for female)
telefonoNoPhone number

Implementation Reference

  • Python implementation of the create-upnify-prospect tool handler. Validates input, prepares payload, authenticates, and sends POST request to Upnify API to create a prospect.
    async def create_prospect(self, data: Dict[str, Any]) -> Dict[str, Any]: """Create a new prospect in Upnify""" auth_info = await self.auth.get_token_and_user_info() token = auth_info["token"] # Validate required fields if not data.get("nombre") or not data.get("correo"): raise ValueError("Los campos 'nombre' y 'correo' son obligatorios") # Prepare prospect data prospect_data = { "nombre": data["nombre"], "apellidos": data.get("apellidos", ""), "correo": data["correo"], "telefono": data.get("telefono", ""), "movil": data.get("movil", ""), "sexo": data.get("sexo", "H"), "puesto": data.get("puesto", ""), "empresa": data.get("empresa", ""), "ciudad": data.get("ciudad", ""), "idPais": data.get("idPais", DEFAULTS["DEFAULT_COUNTRY"]), "calle": data.get("calle", ""), "colonia": data.get("colonia", ""), "codigoPostal": data.get("codigoPostal", ""), "comentarios": data.get("comentarios", "") } async with httpx.AsyncClient() as client: try: response = await client.post( f"{API_URLS['UPNIFY_BASE']}{ENDPOINTS['CREATE_PROSPECT']}", headers={ "token": token, "Content-Type": "application/json" }, json=prospect_data ) if not response.is_success: error_text = response.text raise Exception(f"Error al crear prospecto: {response.status_code} {response.reason_phrase}. {error_text}") result = response.json() return { "success": True, "message": "Prospecto creado exitosamente", "data": result } except Exception as error: return { "success": False, "error": f"Error al crear prospecto en Upnify: {str(error)}" }
  • TypeScript implementation of the create-upnify-prospect tool handler. Maps input data to Upnify payload, fetches prospect phases, authenticates, and sends POST request to create prospect.
    async createProspect(tkIntegracion: string, prospectData: ProspectData) { try { const { token, userInfo } = await this.auth.getTokenAndUserInfo(tkIntegracion); // Obtener el catálogo de fases para prospectos let tkFase = UPNIFY_DEFAULTS.TK_FASE; try { const phases = await this.auth.getProspectPhases(tkIntegracion); if (phases && phases.length > 0) { tkFase = phases[0].tkFase; } } catch (phaseError) { // Usar fallback si no se pueden obtener las fases console.error('No se pudieron obtener las fases, usando fallback:', phaseError); } const upnifyPayload = { choice_empresa: "", search_terms: "", empresa: prospectData.empresa || "", tkEmpresa: "", cp: { estatus: "", validador: "", division: "", tipo: "", gasto: "", periodo: "", tipoDeServicio: "", testFecha: "" }, nombre: prospectData.nombre || "", apellidos: prospectData.apellidos || "", titulo: "", sexo: prospectData.sexo || DEFAULTS.GENDER, correo: prospectData.correo || "", url: "", telefono2LadaPais: DEFAULTS.PHONE_PREFIX, telefono2: prospectData.telefono || "", movilLadaPais: DEFAULTS.PHONE_PREFIX, movil: prospectData.movil || "", puesto: prospectData.puesto || "", calle: prospectData.calle || "", colonia: prospectData.colonia || "", idPais: prospectData.idPais || DEFAULTS.COUNTRY, idEstado: "", idMunicipio: "", ciudad: prospectData.ciudad || "", codigoPostal: prospectData.codigoPostal || "", tkFase: tkFase, tkOrigen: "", facebook: "", twitter: "", skype: "", linkedIn: "", googlePlus: "", etiquetas: "", tkEtiquetas: "" }; const response = await fetch(`${API_URLS.UPNIFY_BASE}${ENDPOINTS.PROSPECTS}`, { method: 'POST', headers: { 'token': token, 'Content-Type': 'application/json', }, body: JSON.stringify(upnifyPayload) }); if (!response.ok) { const errorText = await response.text(); console.error('Payload enviado:', JSON.stringify(upnifyPayload, null, 2)); console.error('Token usado:', token); console.error('Respuesta del servidor:', errorText); throw new Error(`Error al crear prospecto: ${response.status} ${response.statusText}. ${errorText}`); } const result = await response.text(); return { success: true, message: 'Prospecto creado exitosamente', response: result, tkEmpresa: userInfo.tkEmpresa }; } catch (error) { throw new Error(`Error al crear prospecto en Upnify: ${error instanceof Error ? error.message : error}`); } }
  • Input schema definition for the create-upnify-prospect tool in Python MCP server.
    Tool( name="create-upnify-prospect", description="Create a new prospect in Upnify CRM", inputSchema={ "type": "object", "properties": { "nombre": {"type": "string", "description": "First name of the prospect"}, "apellidos": {"type": "string", "description": "Last name of the prospect"}, "correo": {"type": "string", "description": "Email address of the prospect"}, "telefono": {"type": "string", "description": "Phone number"}, "movil": {"type": "string", "description": "Mobile phone number"}, "sexo": {"type": "string", "description": "Gender (H for male, M for female)", "enum": ["H", "M"]}, "puesto": {"type": "string", "description": "Job position"}, "empresa": {"type": "string", "description": "Company name"}, "ciudad": {"type": "string", "description": "City"}, "idPais": {"type": "string", "description": "Country code (e.g., MX, US)", "default": "MX"}, "calle": {"type": "string", "description": "Street address"}, "colonia": {"type": "string", "description": "Neighborhood/Colony"}, "codigoPostal": {"type": "string", "description": "Postal code"}, "comentarios": {"type": "string", "description": "Additional comments about the prospect"} }, "required": ["nombre", "correo"] } ),
  • Input schema definition for the create-upnify-prospect tool in TypeScript MCP server.
    name: 'create-upnify-prospect', description: 'Create a new prospect in Upnify CRM', inputSchema: { type: 'object', properties: { nombre: { type: 'string', description: 'First name of the prospect' }, apellidos: { type: 'string', description: 'Last name of the prospect' }, correo: { type: 'string', description: 'Email address of the prospect' }, telefono: { type: 'string', description: 'Phone number' }, movil: { type: 'string', description: 'Mobile phone number' }, sexo: { type: 'string', description: 'Gender (H for male, M for female)', enum: ['H', 'M'] }, puesto: { type: 'string', description: 'Job position' }, empresa: { type: 'string', description: 'Company name' }, ciudad: { type: 'string', description: 'City' }, idPais: { type: 'string', description: 'Country code (e.g., MX, US)', default: 'MX' }, calle: { type: 'string', description: 'Street address' }, colonia: { type: 'string', description: 'Neighborhood/Colony' }, codigoPostal: { type: 'string', description: 'Postal code' }, comentarios: { type: 'string', description: 'Additional comments about the prospect' } }, required: ['nombre', 'correo'] } },
  • Tool dispatch/registration in Python MCP server's call_tool handler.
    if name == "create-upnify-prospect": result = await prospects_handler.create_prospect(arguments) return [TextContent(type="text", text=str(result))]

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/adrielisa/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server