|
| 1 | +import { DatagmaIcon } from '@/components/icons' |
| 2 | +import { AuthMode, type BlockConfig, type BlockMeta, IntegrationType } from '@/blocks/types' |
| 3 | +import type { DatagmaResponse } from '@/tools/datagma/types' |
| 4 | + |
| 5 | +export const DatagmaBlock: BlockConfig<DatagmaResponse> = { |
| 6 | + type: 'datagma', |
| 7 | + name: 'Datagma', |
| 8 | + description: 'Find verified B2B emails, mobile phones, and enrich person or company profiles', |
| 9 | + authMode: AuthMode.ApiKey, |
| 10 | + longDescription: |
| 11 | + 'Integrate Datagma to find verified work emails from a name and company, enrich person profiles via email or LinkedIn URL, enrich company data from a domain or name, look up mobile phone numbers from LinkedIn, and check your credit balance.', |
| 12 | + docsLink: 'https://docs.sim.ai/tools/datagma', |
| 13 | + category: 'tools', |
| 14 | + integrationType: IntegrationType.Sales, |
| 15 | + bgColor: '#FFFFFF', |
| 16 | + icon: DatagmaIcon, |
| 17 | + subBlocks: [ |
| 18 | + { |
| 19 | + id: 'operation', |
| 20 | + title: 'Operation', |
| 21 | + type: 'dropdown', |
| 22 | + options: [ |
| 23 | + { label: 'Find Email', id: 'datagma_find_email' }, |
| 24 | + { label: 'Enrich Person', id: 'datagma_enrich_person' }, |
| 25 | + { label: 'Enrich Company', id: 'datagma_enrich_company' }, |
| 26 | + { label: 'Find Phone', id: 'datagma_find_phone' }, |
| 27 | + { label: 'Get Remaining Credits', id: 'datagma_get_credits' }, |
| 28 | + ], |
| 29 | + value: () => 'datagma_find_email', |
| 30 | + }, |
| 31 | + |
| 32 | + // ------------------------------------------------------------------------- |
| 33 | + // Find Email |
| 34 | + // ------------------------------------------------------------------------- |
| 35 | + { |
| 36 | + id: 'fe_fullName', |
| 37 | + title: 'Full Name', |
| 38 | + type: 'short-input', |
| 39 | + required: true, |
| 40 | + placeholder: 'John Doe', |
| 41 | + condition: { field: 'operation', value: 'datagma_find_email' }, |
| 42 | + }, |
| 43 | + { |
| 44 | + id: 'fe_company', |
| 45 | + title: 'Company Name or Domain', |
| 46 | + type: 'short-input', |
| 47 | + required: true, |
| 48 | + placeholder: 'stripe.com', |
| 49 | + condition: { field: 'operation', value: 'datagma_find_email' }, |
| 50 | + }, |
| 51 | + { |
| 52 | + id: 'fe_linkedInSlug', |
| 53 | + title: 'LinkedIn Company Slug', |
| 54 | + type: 'short-input', |
| 55 | + placeholder: 'https://linkedin.com/company/stripe', |
| 56 | + condition: { field: 'operation', value: 'datagma_find_email' }, |
| 57 | + mode: 'advanced', |
| 58 | + }, |
| 59 | + |
| 60 | + // ------------------------------------------------------------------------- |
| 61 | + // Enrich Person |
| 62 | + // ------------------------------------------------------------------------- |
| 63 | + { |
| 64 | + id: 'ep_data', |
| 65 | + title: 'Email, LinkedIn URL, or Full Name', |
| 66 | + type: 'short-input', |
| 67 | + required: true, |
| 68 | + placeholder: 'john@stripe.com or https://linkedin.com/in/johndoe or John Doe', |
| 69 | + condition: { field: 'operation', value: 'datagma_enrich_person' }, |
| 70 | + }, |
| 71 | + { |
| 72 | + id: 'ep_companyKeyword', |
| 73 | + title: 'Company (when using full name)', |
| 74 | + type: 'short-input', |
| 75 | + placeholder: 'Stripe', |
| 76 | + condition: { field: 'operation', value: 'datagma_enrich_person' }, |
| 77 | + }, |
| 78 | + { |
| 79 | + id: 'ep_phoneFull', |
| 80 | + title: 'Find Phone Number', |
| 81 | + type: 'dropdown', |
| 82 | + options: [ |
| 83 | + { label: 'No', id: 'false' }, |
| 84 | + { label: 'Yes (costs 30 extra credits if found)', id: 'true' }, |
| 85 | + ], |
| 86 | + value: () => 'false', |
| 87 | + condition: { field: 'operation', value: 'datagma_enrich_person' }, |
| 88 | + }, |
| 89 | + { |
| 90 | + id: 'ep_countryCode', |
| 91 | + title: 'Country Code', |
| 92 | + type: 'short-input', |
| 93 | + placeholder: 'US', |
| 94 | + condition: { field: 'operation', value: 'datagma_enrich_person' }, |
| 95 | + mode: 'advanced', |
| 96 | + }, |
| 97 | + { |
| 98 | + id: 'ep_personFull', |
| 99 | + title: 'Include Full Profile', |
| 100 | + type: 'dropdown', |
| 101 | + options: [ |
| 102 | + { label: 'No', id: 'false' }, |
| 103 | + { label: 'Yes (education + work history)', id: 'true' }, |
| 104 | + ], |
| 105 | + value: () => 'false', |
| 106 | + condition: { field: 'operation', value: 'datagma_enrich_person' }, |
| 107 | + mode: 'advanced', |
| 108 | + }, |
| 109 | + |
| 110 | + // ------------------------------------------------------------------------- |
| 111 | + // Enrich Company |
| 112 | + // ------------------------------------------------------------------------- |
| 113 | + { |
| 114 | + id: 'ec_data', |
| 115 | + title: 'Company Domain, Name, or SIREN', |
| 116 | + type: 'short-input', |
| 117 | + required: true, |
| 118 | + placeholder: 'stripe.com', |
| 119 | + condition: { field: 'operation', value: 'datagma_enrich_company' }, |
| 120 | + }, |
| 121 | + { |
| 122 | + id: 'ec_companyPremium', |
| 123 | + title: 'Include LinkedIn Data', |
| 124 | + type: 'dropdown', |
| 125 | + options: [ |
| 126 | + { label: 'No', id: 'false' }, |
| 127 | + { label: 'Yes', id: 'true' }, |
| 128 | + ], |
| 129 | + value: () => 'false', |
| 130 | + condition: { field: 'operation', value: 'datagma_enrich_company' }, |
| 131 | + mode: 'advanced', |
| 132 | + }, |
| 133 | + { |
| 134 | + id: 'ec_companyFull', |
| 135 | + title: 'Include Financial Data', |
| 136 | + type: 'dropdown', |
| 137 | + options: [ |
| 138 | + { label: 'No', id: 'false' }, |
| 139 | + { label: 'Yes', id: 'true' }, |
| 140 | + ], |
| 141 | + value: () => 'false', |
| 142 | + condition: { field: 'operation', value: 'datagma_enrich_company' }, |
| 143 | + mode: 'advanced', |
| 144 | + }, |
| 145 | + |
| 146 | + // ------------------------------------------------------------------------- |
| 147 | + // Find Phone |
| 148 | + // ------------------------------------------------------------------------- |
| 149 | + { |
| 150 | + id: 'fp_username', |
| 151 | + title: 'LinkedIn URL', |
| 152 | + type: 'short-input', |
| 153 | + required: true, |
| 154 | + placeholder: 'https://linkedin.com/in/johndoe', |
| 155 | + condition: { field: 'operation', value: 'datagma_find_phone' }, |
| 156 | + }, |
| 157 | + { |
| 158 | + id: 'fp_email', |
| 159 | + title: 'Email (improves accuracy)', |
| 160 | + type: 'short-input', |
| 161 | + placeholder: 'john@stripe.com', |
| 162 | + condition: { field: 'operation', value: 'datagma_find_phone' }, |
| 163 | + }, |
| 164 | + |
| 165 | + // ------------------------------------------------------------------------- |
| 166 | + // API Key — hidden on hosted Sim for operations with hosted-key support |
| 167 | + // ------------------------------------------------------------------------- |
| 168 | + { |
| 169 | + id: 'apiKey', |
| 170 | + title: 'API Key', |
| 171 | + type: 'short-input', |
| 172 | + required: true, |
| 173 | + placeholder: 'Enter your Datagma API key', |
| 174 | + password: true, |
| 175 | + hideWhenHosted: true, |
| 176 | + condition: { field: 'operation', value: 'datagma_get_credits', not: true }, |
| 177 | + }, |
| 178 | + // API Key — always required for the credit-balance lookup (no hosted key) |
| 179 | + { |
| 180 | + id: 'apiKey', |
| 181 | + title: 'API Key', |
| 182 | + type: 'short-input', |
| 183 | + required: true, |
| 184 | + placeholder: 'Enter your Datagma API key', |
| 185 | + password: true, |
| 186 | + condition: { field: 'operation', value: 'datagma_get_credits' }, |
| 187 | + }, |
| 188 | + ], |
| 189 | + |
| 190 | + tools: { |
| 191 | + access: [ |
| 192 | + 'datagma_find_email', |
| 193 | + 'datagma_enrich_person', |
| 194 | + 'datagma_enrich_company', |
| 195 | + 'datagma_find_phone', |
| 196 | + 'datagma_get_credits', |
| 197 | + ], |
| 198 | + config: { |
| 199 | + tool: (params) => { |
| 200 | + switch (params.operation) { |
| 201 | + case 'datagma_find_email': |
| 202 | + case 'datagma_enrich_person': |
| 203 | + case 'datagma_enrich_company': |
| 204 | + case 'datagma_find_phone': |
| 205 | + case 'datagma_get_credits': |
| 206 | + return params.operation |
| 207 | + default: |
| 208 | + return 'datagma_find_email' |
| 209 | + } |
| 210 | + }, |
| 211 | + params: (params) => { |
| 212 | + const { operation: _operation, ...rest } = params |
| 213 | + |
| 214 | + // Map unique subBlock IDs back to tool param names |
| 215 | + const idToParam: Record<string, string> = { |
| 216 | + fe_fullName: 'fullName', |
| 217 | + fe_company: 'company', |
| 218 | + fe_linkedInSlug: 'linkedInSlug', |
| 219 | + ep_data: 'data', |
| 220 | + ep_companyKeyword: 'companyKeyword', |
| 221 | + ep_phoneFull: 'phoneFull', |
| 222 | + ep_countryCode: 'countryCode', |
| 223 | + ep_personFull: 'personFull', |
| 224 | + ec_data: 'data', |
| 225 | + ec_companyPremium: 'companyPremium', |
| 226 | + ec_companyFull: 'companyFull', |
| 227 | + fp_username: 'username', |
| 228 | + fp_email: 'email', |
| 229 | + } |
| 230 | + |
| 231 | + const result: Record<string, unknown> = {} |
| 232 | + for (const [key, value] of Object.entries(rest)) { |
| 233 | + if (value === undefined || value === null || value === '') continue |
| 234 | + const mappedKey = idToParam[key] ?? key |
| 235 | + |
| 236 | + // Coerce boolean-like dropdown values at execution time |
| 237 | + if ( |
| 238 | + mappedKey === 'phoneFull' || |
| 239 | + mappedKey === 'personFull' || |
| 240 | + mappedKey === 'companyPremium' || |
| 241 | + mappedKey === 'companyFull' |
| 242 | + ) { |
| 243 | + result[mappedKey] = value === true || value === 'true' |
| 244 | + } else { |
| 245 | + result[mappedKey] = value |
| 246 | + } |
| 247 | + } |
| 248 | + return result |
| 249 | + }, |
| 250 | + }, |
| 251 | + }, |
| 252 | + |
| 253 | + inputs: { |
| 254 | + operation: { type: 'string', description: 'Operation to perform' }, |
| 255 | + apiKey: { type: 'string', description: 'Datagma API key' }, |
| 256 | + // Find Email |
| 257 | + fe_fullName: { type: 'string', description: "Person's full name (find email)" }, |
| 258 | + fe_company: { type: 'string', description: 'Company name or domain (find email)' }, |
| 259 | + fe_linkedInSlug: { type: 'string', description: 'LinkedIn company slug (find email)' }, |
| 260 | + // Enrich Person |
| 261 | + ep_data: { |
| 262 | + type: 'string', |
| 263 | + description: 'Email, LinkedIn URL, or full name (enrich person)', |
| 264 | + }, |
| 265 | + ep_companyKeyword: { type: 'string', description: 'Company keyword (enrich person)' }, |
| 266 | + ep_phoneFull: { type: 'boolean', description: 'Find phone number (enrich person)' }, |
| 267 | + ep_countryCode: { type: 'string', description: 'Country code (enrich person)' }, |
| 268 | + ep_personFull: { type: 'boolean', description: 'Include full profile (enrich person)' }, |
| 269 | + // Enrich Company |
| 270 | + ec_data: { type: 'string', description: 'Company domain, name, or SIREN (enrich company)' }, |
| 271 | + ec_companyPremium: { type: 'boolean', description: 'Include LinkedIn data (enrich company)' }, |
| 272 | + ec_companyFull: { type: 'boolean', description: 'Include financial data (enrich company)' }, |
| 273 | + // Find Phone |
| 274 | + fp_username: { type: 'string', description: 'LinkedIn URL (find phone)' }, |
| 275 | + fp_email: { type: 'string', description: 'Email address (find phone)' }, |
| 276 | + }, |
| 277 | + |
| 278 | + outputs: { |
| 279 | + // Find Email |
| 280 | + email: { type: 'string', description: 'Verified work email address' }, |
| 281 | + emailStatus: { type: 'string', description: 'Email verification status' }, |
| 282 | + emailDomain: { type: 'string', description: 'Email domain' }, |
| 283 | + mxfound: { type: 'boolean', description: 'Whether MX records were found' }, |
| 284 | + smtpCheck: { type: 'boolean', description: 'Whether SMTP validation succeeded' }, |
| 285 | + catchAll: { type: 'boolean', description: 'Whether the domain is catch-all' }, |
| 286 | + // Enrich Person |
| 287 | + name: { type: 'string', description: 'Full name' }, |
| 288 | + firstName: { type: 'string', description: 'First name' }, |
| 289 | + lastName: { type: 'string', description: 'Last name' }, |
| 290 | + jobTitle: { type: 'string', description: 'Current job title' }, |
| 291 | + company: { type: 'string', description: 'Current company name' }, |
| 292 | + linkedInUrl: { type: 'string', description: 'LinkedIn profile URL' }, |
| 293 | + location: { type: 'string', description: 'Location string' }, |
| 294 | + country: { type: 'string', description: 'Country' }, |
| 295 | + region: { type: 'string', description: 'Region/state' }, |
| 296 | + city: { type: 'string', description: 'City' }, |
| 297 | + extractedRole: { type: 'string', description: 'Extracted role category' }, |
| 298 | + extractedSeniority: { type: 'string', description: 'Extracted seniority level' }, |
| 299 | + twitter: { type: 'string', description: 'Twitter handle' }, |
| 300 | + personConfidenceScore: { |
| 301 | + type: 'number', |
| 302 | + description: 'Confidence score for the person match', |
| 303 | + }, |
| 304 | + // Enrich Company |
| 305 | + website: { type: 'string', description: 'Company website' }, |
| 306 | + industries: { type: 'string', description: 'Industry classification' }, |
| 307 | + companySize: { type: 'string', description: 'Employee headcount range' }, |
| 308 | + type: { type: 'string', description: 'Company type (e.g., Private, Public)' }, |
| 309 | + founded: { type: 'string', description: 'Year founded' }, |
| 310 | + shortDescription: { type: 'string', description: 'Short company description' }, |
| 311 | + revenueRange: { type: 'string', description: 'Estimated annual revenue range' }, |
| 312 | + headquarters: { type: 'string', description: 'Headquarters location' }, |
| 313 | + // Find Phone |
| 314 | + phone: { type: 'string', description: 'Mobile phone number' }, |
| 315 | + countryCode: { type: 'string', description: 'Country code prefix' }, |
| 316 | + isWhatsapp: { type: 'boolean', description: 'Whether the number is linked to WhatsApp' }, |
| 317 | + // Get Credits |
| 318 | + credits: { type: 'number', description: 'Remaining Datagma credits' }, |
| 319 | + }, |
| 320 | +} |
| 321 | + |
| 322 | +export const DatagmaBlockMeta = { |
| 323 | + tags: ['enrichment', 'sales-engagement'], |
| 324 | + url: 'https://datagma.com', |
| 325 | +} as const satisfies BlockMeta |
0 commit comments