WebHook Prospect (V5.7)
Résumé
Manipulation de l'entité Prospect (Prospects) en lecture/écriture/suppression via un objet métier depuis une application externe.
Tables
Les tables utilisées sont :
sw_data_customer : Table des tiers
Les tables liées sont :
sw_data_customerextension : Table des indicateurs tiers
sw_data_customeruser : Table des utilisateurs liés aux tiers
Critères d'activation
WHK_Prospect est défini dans la gestion des webhooks du studio.
Règles métier
verb: PUT
Type de tiers
Le type de tiers est mis par défaut à ‘Prospect' (generictype_ID_customerType = ‘CTP’) si non fourni lors d’une création
Est un particulier
A la fin de la création/modification d’un prospetc si celui-ci est un particulier (sw_data_customer.isIndividual = 1), il y aura automatiquement :
création automatique d’un nouveau contact rattaché au prospect en tant que contact principal (avec sw_data_customercontact.mainContact mis à 1) s’il n’existe pas encore
modification automatique du contact principal s’il existe déjà (sw_data_customercontact.mainContact = 1)
Fonctionnement
settings parameters
"settings":
{
"getIndicators": "1" // pour le verb GET et LIST permet de retourner les informations des indicateurs prospects
}
verb: GET
resultType: simple
"prospect":{
"codeprospect":"P0000001",
"name":"CHEZ SOI",
"baseuser_ID":"TENARDIER",
"address1":"33 Avenue du Drapeau",
"address2":"",
"address3":"",
"postalCode":"21000",
"city":"DIJON",
"phoneNumber":"03 90 11 22 33",
"faxNumber":"03 90 11 22 44",
"mobilePhoneNumber":"06 90 11 22 33",
"email":"contact@guichard.com",
"generictype_ID_country":"FR",
"generictype_ID_province":"",
"generictype_ID_civility":"",
"baseculture_ID":"FR-FR",
"branchoffice_ID":"SXB"
}
verb: GET
resultType: extended
"prospect":{
"codeprospect":"P0000001",
"name":"CHEZ SOI",
"baseuser_ID":"TENARDIER",
"address1":"33 Avenue du Drapeau",
"address2":"",
"address3":"",
"postalCode":"21000",
"city":"DIJON",
"phoneNumber":"03 90 11 22 33",
"faxNumber":"03 90 11 22 44",
"mobilePhoneNumber":"06 90 11 22 33",
"email":"contact@guichard.com",
"generictype_ID_country":"FR",
"generictype_ID_province":"",
"generictype_ID_civility":"",
"baseculture_ID":"FR-FR",
"branchoffice_ID":"SXB",
"deliveryDays":"1A;1B;2A;2B;3A;3B;4A;4B;5A;5B",
"openingDays":"1A;1B;2A;2B;3A;3B;4A;4B;5A;5B",
"siretNumber":"",
"vatIntra":"",
"apeCode":"516K",
"comment":"",
"blocked":"0",
"blockedComment":"",
"message":"",
"vacationStart":"",
"vacationEnd":"",
"gpsLongitude":"5.04372",
"gpsLatitude":"47.33222",
"accountNumber":"P0000001",
"contactName":"",
"currency_ID":"",
"authorizedCredit":"0",
"risk":"1",
"language":"",
"underSurveillance":"",
"workforce":"25",
"prospect_ID_paying":"",
"pricecategory_ID":"",
"discountRate":"0",
"website":"https://www.guichard.com",
"legalStatus":"Société Anonyme avec Directoire",
"generictype_ID_brand":"",
"generictype_ID_deliveryMode":"",
"generictype_ID_paymentMean":"",
"generictype_ID_prospectFamily":"",
"generictype_ID_prospectType": "CTP",
"confirmationEmail":"contact@guichard.com",
"confirmationFax":"03 90 11 22 44",
"generictype_ID_taxCode":"",
"productdepot_ID":"",
"generictype_ID_accountingCategory":"",
"generictype_ID_prospectPotential":"B",
"skype":"contact@guichard.com",
"generictype_ID_role":"",
"unused":"0",
"prospectgroup_ID":"",
"generictype_ID_referencing":"2",
"generictype_ID_distribution":"SELF",
"generictype_ID_market":"BIG",
"area":"",
"baseuser_ID_favoriteTechnician":"TECH-01",
"emailFormat":"",
"isIndividual":"0",
"facebook":"https://www.facebook.com/guichard/",
"twitter":"https://twitter.com/guichard",>
"youtube":"https://www.youtube.com/watch?v=6jGbnEwQJ54",
"linkedin":"https://www.linkedin.com/company/guichard",
"activity":""
}
verb: GET
resultType: extendedRelated
en complément du résultat pour resultType: extended on aura le détail pour les tables generictype_prospectFamily, baseuser, generictype_country, generictype_province, productdepot, generictype_civility, baseculture, baseuser_favoriteTechnician, branchoffice et productdepot
"related":[
{
"generictype_prospectFamily":{
"codegenerictype":"CUSTOMER_FAMILY-Est",
"label":"Grand est",
"originalCode":"Est",
"dataType":"CUSTOMER_FAMILY",
"description":"",
"translationKey":"GenType_CUSTOMER_FAMILY-Est",
"generictype_ID_parent":"",
"tag":"",
"orderNumber":""
},
"baseuser":{
"codebaseuser":"25",
"lastName":"MOREL",
"firstName":"Vincent",
"initials":"MV",
"baseusertree_ID":"Région 2",
"productdepot_ID":"Dépôt Vincent MOREL",
"productdepot_ID_current":"",
"email":"vincent@morel.com",
"phoneNumber":"",
"faxNumber":"",
"address1":"",
"address2":"",
"postalCode":"",
"city":"",
"position":"Représentant",
"department":"Commercial",
"structureNav":"1",
"supervisor":"0",
"useMileageRate":"",
"account":"",
"analyticSection":"",
"lastGPSDate":"",
"gpsLongitude":"",
"gpsLatitude":"",
"gpsPrecision":"",
"gpsUpdateDate":"",
"gpsManual":"",
"generictype_ID_country":"",
"generictype_ID_province":"",
"baseculture_ID":"",
"branchoffice_ID":"",
"resourcetype_ID":"",
"teamtype_ID":""
},
"generictype_country": {
"codegenerictype": "COUNTRY-FR",
"label": "FRANCE",
"originalCode": "FR",
"dataType": "COUNTRY",
"description": "",
"translationKey": "GenType_COUNTRY-FR",
"generictype_ID_parent": "",
"tag": "",
"orderNumber": ""
},
"generictype_province": {
"codegenerictype": "",
"label": "",
"originalCode": "",
"dataType": "",
"description": "",
"translationKey": "",
"generictype_ID_parent": "",
"tag": "",
"orderNumber": ""
},
"baseculture": {
"codebaseculture": "FR-FR",
"label": "French - France",
"codelanguage": "FR"
},
"generictype_civility": {
"codegenerictype": "",
"label": "",
"originalCode": "",
"dataType": "",
"description": "",
"translationKey": "",
"generictype_ID_parent": "",
"tag": "",
"orderNumber": ""
},
"baseuser_favoriteTechnician": {
"codebaseuser": "TECH-01",
"lastName": "TECH-01",
"firstName": "Tango",
"initials": "",
"email": "tech01@test.fr",
"phoneNumber": "",
"faxNumber": "",
"address1": "2 Allée de Strasbourg",
"address2": "",
"postalCode": "91300",
"city": "Massy",
"position": "",
"department": "",
"generictype_ID_country": "",
"generictype_ID_province": "",
"baseculture_ID": "FR-FR",
"branchoffice_ID": "Agence-01",
"resourcetype_ID": "",
"supervisor": "",
"useMileageRate": "",
"account": "",
"analyticSection": "",
"productdepot_ID": "",
"lastGPSDate": "",
"gpsLongitude": "2.2922000000000353",
"gpsLatitude": "48.73596000000003",
"fullView": "",
"changeAuthorization": "",
"productdepot_ID_current": "",
"techSyncRule": "0",
"homePage": "",
"teamtype_ID": "",
"customer_ID_subcontractor": "",
"techIsSedentary": ""
},
"branchoffice": {
"codebranchoffice": "SXB",
"name": "Strasbourg",
"address1": "10 Rue de l'Outre",
"address2": "",
"postalCode": "67000",
"city": "Strasbourg",
"generictype_ID_country": "FR",
"phoneNumber": "0388123456",
"faxNumber": "0388123400",
"email": "noreply-weavysxb@divalto.com",
"website": "",
"bankholidayparamheader_ID": "FRANCE-ALSACE-MOSELLE",
"gpsLongitude": "7.7475",
"gpsLatitude": "48.58367",
"baseusergroup_ID": "#SXB-Strasbourg",
"interventionTeamLifetime": "4"
},
"productdepot": {
"codeproductdepot": "",
"label": "",
"vehicle": "",
"main": "",
"vehicleRegistration": "",
"vehicleBrand": "",
"vehicleModel": "",
"automaticReception": ""
}
}]
verb: GET
resultType: simple, extended, extendedRelated
getIndicators: 1
"prospect": {
...
},
"indicators": [{
"codeprospectextension": "30000000493",
"prospect_ID": "P0000001",
"dataQualityIndicator": "5", /* Indice qualité*/
"turnoverN": "", /* CA N*/
"turnoverN1": "", /* CA N-1*/
"turnoverN2": "", /* CA N-2*/
"lastOrder": "2019-05-17 08:47:47", /* Dernière commande*/
"lastIntervention": "2020-08-17 15:00:00", /* Dernière intervention*/
"openedContract": "0", /* Contrats en cours*/
"openedQuote": "26", /* Devis en cours*/
"openedOpportunity": "0", /* Opportunités en cours*/
"credit": "", /* Encours*/
"generictype_ID_prospectpotential": "B", /* Potentiel prospect*/
"lastVisit": "", /* Dernière visite*/
"companyTurnover": "22839140", /* Dernier chiffre d'affaire*/
"companyTurnoverDate": "2018-11-23 00:00:00", /* Date du dernier chiffre d'affaire*/
"generictype_ID_companyTurnoverSlice": "CA 20 à 50 M€", /* Tranche CA*/
"generictype_ID_companyWorkforceSlice": "Effectif 100 Ã 199", /* Tranche effectif*/
"companyWorkforce": "180", /* Dernier effectif*/
"companyWorkforceDate": "2018-03-30 00:00:00", /* Date du dernier effectif*/
"anonymizationDate": "", /* Date d'anonymisation*/
"openedTask": "0" /* Tâches en cours*/
}]
verb: PUT
{
"prospect": {
"codeprospect": "P0000001", /* Code globalement unique du prospect (Varchar (255))*/
"name": "CHEZ SOI", /* Nom du prospect (Varchar (255))*/
"address1": "33 Avenue du Drapeau", /* Adresse 1 (Varchar (255))*/
"address2": null, /* Adresse 2 (Varchar (255))*/
"address3": null, /* Adresse 3 (Varchar (255))*/
"postalCode": "21000", /* Code postal (Varchar (16))*/
"city": "DIJON", /* Ville (Varchar (64))*/
"phoneNumber": "03 90 11 22 33", /* N° de téléphone (Varchar (64))*/
"faxNumber": "03 90 11 22 44", /* N° de télécopie (Varchar (64))*/
"mobilePhoneNumber": "06 90 11 22 33", /* N° de portable (Varchar (64))*/
"email": "contact@guichard.com", /* Email (Varchar (255))*/
"website": "<https://www.guichard.com",> /* Site internet (Varchar (255))*/
"siretNumber": null, /* N° siret (Varchar (40))*/
"generictype_ID_prospectType": "CUSTOMER_TYPE-CTP", /* Code type de tiers. Mettre CUSTOMER_TYPE-CTP pour un prospect. (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = CUSTOMER_TYPE). Si non transmis, initialisé par défaut à CTP.*/
"generictype_ID_country": "COUNTRY-FR", /* Code pays (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = COUNTRY)*/
"baseuser_ID": "GRO-OUES", /* Code utilisateur (ForeignKey () - sw_data_baseuser.codebaseuser)*/
"deliveryDays": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5B;", /* Jours de livraison (Varchar (255))*/
"openingDays": "1A;1B;2A;2B;3A;3B;4A;4B;5A;5B;", /* Jours d'ouverture (Varchar (255))*/
"comment": "", /* Commentaires (Text (65535))*/
"blocked": "0", /* Prospect bloqué (Valeurs possibles : 0,1) (Bool ())*/
"blockedComment": "", /* Commentaires prospect bloqué (Text (65535))*/
"message": "", /* Message (Text (65535))*/
"vacationStart": "", /* Début des congés (Date ())*/
"vacationEnd": "", /* Fin des congés (Date ())*/
"underSurveillance": "0", /* Prospect sous surveillance (Valeurs possibles : 0,1) (Bool ())*/
"generictype_ID_prospectFamily": "CUSTOMER_FAMILY-GROSARTG", /* Code famille prospect (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = CUSTOMER_FAMILY)*/
"generictype_ID_paymentMean": "PAYMENT_MEAN-N30", /* Code mode de règlement (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = PAYMENT_MEAN)*/
"generictype_ID_deliveryMode": "DELIVERY_MODE-CHRO", /* Code mode de livraison (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DELIVERY_MODE)*/
"pricecategory_ID": "GR", /* Code catégorie tarifaire (ForeignKey () - sw_data_pricecategory.codepricecategory)*/
"discountRate": "0.00", /* Taux de remise (Double ())*/
"authorizedCredit": "0", /* Encours autorisé (Valeurs possibles : 0,1) (Bool ())*/
"apeCode": "516K", /* Code APE (Varchar (64))*/
"vatIntra": null, /* TVA intracommunautaire (Varchar (64))*/
"legalStatus": "Société Anonyme avec Directoire", /* Forme juridique (Varchar (64))*/
"workforce": "23", /* Effectif (Int ())*/
"prospect_ID_paying": null, /* Code prospect payeur (ForeignKey () - sw_data_customer.codecustomer)*/
"generictype_ID_taxCode": "TAX_CUSTOMER-0", /* Code TVA client (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = TAX_CUSTOMER)*/
"risk": "1", /* Risque (Varchar (64))*/
"language": "FR", /* Code langue (ForeignKey () - sw_sys_language.codelanguage)*/
"accountNumber": "P0000001", /* N° de compte principal (Varchar (64))*/
"currency_ID": "EUR", /* Code devise ForeignKey () - sw_data_currency.codecurrency)*/
"generictype_ID_province": null, /* Code province (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = PROVINCE)*/
"generictype_ID_civility": "CIVILITY-SA", /* Code civilité (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = CIVILITY)*/
"prospectgroup_ID": "", /* Code groupe prospect (ForeignKey () - sw_data_customergroup.codecustomergroup)*/
"confirmationFax": "03 90 11 22 44", /* N° de télécopie de confirmation (Varchar (64))*/
"confirmationEmail": "contact@guichard.com", /* Email de confirmation (Varchar (255))*/
"generictype_ID_accountingCategory": "", /* Code catégorie comptable (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = ACCOUNTING_CATEGORY)*/
"generictype_ID_customerPotential": "CUSTOMER_POTENTIAL-B", /* Code potentiel prospect (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = CUSTOMER_POTENTIAL)*/
"generictype_ID_role": "", /* Code rôle (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = ROLE)*/
"unused": "0", /* Prospect inactif (Valeurs possibles : 0,1) (Bool ())*/
"generictype_ID_referencing": "PRODUCT_REFERENCING-NOTSTRICT", /* Code mode de référencement articles (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = PRODUCT_REFERENCING)*/
"generictype_ID_distribution": "DISTRIBUTION-SELF", /* Code type de distribution (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = DISTRIBUTION)*/
"generictype_ID_market": "MARKET-BIG", /* Code type de magasin (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = MARKET)*/
"area": "", /* Superficie (Double ())*/
"baseculture_ID": "FR-FR", /* Code culture (ForeignKey () - sw_data_baseculture.codebaseculture)*/
"baseuser_ID_favoriteTechnician": "TECH-01", /* Code technicien préféré (ForeignKey () - sw_data_baseuser.codebaseuser)*/
"branchoffice_ID": "SXB", /* Code de l'agence de rattachement (ForeignKey () - sw_data_branchoffice.codebranchoffice)*/
"emailFormat": "", /* Format d'email (Varchar (255))*/
"isIndividual": "0", /* Client est un particulier (Valeurs possibles : 0,1) (Bool ())*/
"skype": "contact@guichard.com", /* Skype (Varchar (255))*/
"facebook": "https://www.facebook.com/guichard/", /* Facebook (Varchar (255))*/
"twitter": "https://twitter.com/guichard", /* Twitter (Varchar (255))*/
"youtube": "https://www.youtube.com/watch?v=6jGbnEwQJ54", /* YouTube (Varchar (255))*/
"linkedin": "https://www.linkedin.com/company/guichard", /* LinkedIn(Varchar (255))*/
"activity": "", /* Activité (Text (65535))*/
"internalcodeprospect": null, /* CodeProspect original de weavy s'il y a eu transcodage (Varchar (255)) */
/* Champs supplémentaires en surcharge DIVINF */
"divinf_t035_ID": "RG", /* Code remise (ForeignKey () - sw_data_divinf_t035.codedivinf_t035)*/
"divinf_t072_ID_promotacod": "", /* Code promotion (ForeignKey () - sw_data_divinf_t072.codedivinf_t072)*/
"divinf_t072_ID_promoremcod": "", /* Code remise promotion (ForeignKey () - sw_data_divinf_t072.codedivinf_t072)*/
"divinf_t001_ID_tafam": "GMS", /* Code famille de tarification (ForeignKey () - sw_data_divinf_t001.codedivinf_t001)*/
"divinf_t001_ID_tafamx": "", /* Code famille de tarification exceptionnelle (ForeignKey () - sw_data_divinf_t001.codedivinf_t001)*/
"divinf_t002_ID_refam": "", /* Code classe de remise (ForeignKey () - sw_data_divinf_t002.codedivinf_t002)*/
"divinf_t002_ID_refamx": "", /* Code classe de remise exceptionnelle (ForeignKey () - sw_data_divinf_t002.codedivinf_t002)*/
"divinf_rem1": "0.00", /* Remise 1 (Double ())*/
"divinf_rem2": "0.00", /* Remise 2 (Double ())*/
"divinf_rem3": "0.00", /* Remise 3 (Double ())*/
"divinf_remtyp1": "2", /* Type de remise 1 (Valeurs possibles : 1 (Cumulé), 2 (Succesif), 3 (Différé PB), 4 (Différé PN)) (Int ())*/
"divinf_remtyp2": "2", /* Type de remise 2 (Valeurs possibles : 1 (Cumulé), 2 (Succesif), 3 (Différé PB), 4 (Différé PN)) (Int ())*/
"divinf_remtyp3": "2", /* Type de remise 3 (Valeurs possibles : 1 (Cumulé), 2 (Succesif), 3 (Différé PB), 4 (Différé PN)) (Int ())*/
"divinf_pricecategory_ID_tarCod": "", /* Code tarif TTC (ForeignKey () - sw_data_pricecategory.codepricecategory)*/
"divinf_dev": "EUR", /* Code devise (Varchar (64))*/
"divinf_rftctrcod": "1", /* Tiers soumis au référencement (Valeurs possibles : 1 (Non), 2 (Oui)) (Int ())*/
},
"prospectuser": [
{
"codeprospectuser": "P0000001-95", /* Code gloabelement unique de l'utilisateur lié au prospect (Varchar (255))*/
"prospect_ID": "P0000001", /* Code prospect. Optionnel : reprendre le code prospect du bloc json "prospect", si non fourni reprend automatiquement le code prospect (ForeignKey () - sw_data_customer.codecustomer)*/
"baseuser_ID": "95", /* Code utilisateur (ForeignKey () - sw_data_baseuser.codebaseuser)*/
"generictype_ID_category": "CUSTOMERUSER_LINK-1" /* Code catégorie (ForeignKey () - sw_data_generictype.codegenerictype avec datatype = CUSTOMERUSER-LINK)*/
},
{
"codeprospectuser": "P0000001-TECH1",
"prospect_ID": "P0000001",
"baseuser_ID": "TECH1",
"generictype_ID_category": "CUSTOMERUSER_LINK-2"
}]
}
Exemple de recodification d’un suspect en prospect
J’ai un suspect ‘S0000001’ (type de tiers : CTSUS), que je veux recodifier en prospect ‘P0000001’ (type de tiers : CTP)
Ci-dessous les informations minimales à fournir en mode PUT :
{
"prospect": {
"codeprospect": "P0000001", // code destination
"name": "CHEZ SOI",
"generictype_ID_customerType": "CUSTOMER_TYPE-CTP",
"internalcodeprospect": "S0000001" // code origine
}
}
verb: LIST
resultType: simple, extended reprendre les définitions du GET
"filters:" {
"codeProspect": "value", filter is equal
"name": "value", filter is contains
"codeProspectFamily": "value", filter is equal
"codeCountry": "value", filter is equal
"codeBaseuser": "value", filter is equal
"codeBranchoffice": "value", filter is equal
"email": "value", filter is equal
"emailDomain": "value", filter is endswith (ie "emailDomain": "@domaine.extension")
"siretNumber": "value", filter is equal
"city": "value", filter is startsWith
"notClosedBefore": "value", filter is (closedDate is null OR closedDate > value)
},
"orderBy": "value"
Valeurs possibles pour le tri "orderBy" :
nameAsc : par nom ascendant
verb: DELETE
La suppression d'un prospect (sw_data_customer) va supprimer en cascade les éléments dans la table liée sw_data_customeruser.