diff --git a/samples/blueprints/approva/RealtorAppHome.json b/samples/blueprints/approva/RealtorAppHome.json deleted file mode 100644 index 7e2acbd8..00000000 --- a/samples/blueprints/approva/RealtorAppHome.json +++ /dev/null @@ -1,278 +0,0 @@ -{ - "name": "RealtorAppHome", - "description": "Fluxo de home do aplicativo do corretor", - "blueprint_spec": { - "lanes": [ - { - "id": "L", - "name": "LoggedUser", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('useApp')" - } - }, - { - "id": "U", - "name": "Usuario Final", - "rule": { - "$js": "({bag, actor_data}) => bag.actor_id === actor_data.actor_id" - } - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start home workflow ", - "next": "SB1", - "type": "Start", - "lane_id": "L", - "parameters": { - "type": "object", - "input_schema": { - "required": [ - "offset", - "limit" - ], - "properties": { - "limit": { - "type": "integer" - }, - "offset": { - "type": "integer" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "SB1", - "name": "Set ActorId To Bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "ST1", - "name": "Get realtor profile", - "next": "SB2", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?actor_id=eq.{{actor_data.actor_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB2", - "name": "Set profile to Bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST2", - "name": "Get requests", - "next": "U1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/get_by_realtor/{{bag.profile.id}}?page={{bag.offset}}&page_size={{bag.limit}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U1", - "name": "User action with home", - "next": "SB3", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "requests": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "requestId": { - "type": "string" - } - }, - "additionalProperties": false - }, - "realtor_profile": { - "$ref": "bag.profile" - } - }, - "action": "REQUESTS_LIST" - } - }, - { - "id": "SB3", - "name": "Set profile to Bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "action": { - "$ref": "result.activities[0].data.action" - }, - "requestId": { - "$ref": "result.activities[0].data.requestId" - } - } - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "exit": "E", - "default": "SB4", - "refresh": "ST2", - "NEGOTIATION_DETAIL": "ST3" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "bag.action" - } - } - } - }, - { - "id": "SB4", - "name": "Set offset to bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "offset": { - "$js": "({bag}) => bag.offset + 1" - } - } - } - }, - { - "id": "ST3", - "name": "Get requests", - "next": "U2", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/{{bag.requestId}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U2", - "name": "User action with home", - "next": "SB3", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "request": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - } - }, - "additionalProperties": false - }, - "realtor_profile": { - "$ref": "bag.profile" - } - }, - "action": "NEGOTIATION_DETAIL" - } - }, - { - "id": "E", - "name": "Finish Home", - "next": null, - "type": "Finish", - "lane_id": "U" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/analyseDocumentation.json b/samples/blueprints/approva/analyseDocumentation.json deleted file mode 100644 index 95c0f9b3..00000000 --- a/samples/blueprints/approva/analyseDocumentation.json +++ /dev/null @@ -1,222 +0,0 @@ -{ - "name": "analyseDocumentation", - "description": "Fluxo único para análise dos documentos do usuário", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "analyseDocuments" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start workflow to analyse documents", - "next": "ST1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST1", - "name": "Get all proofs waiting analysis", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/proofs?status=eq.WAITING_ANALYSIS" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U1", - "name": "User selects proof to refut or aproove", - "next": "F1", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "proofs": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "properties": { - "option": { - "type": "string" - }, - "approved": { - "type": "boolean" - }, - "proof_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "PROOFS_LIST" - } - }, - { - "id": "F1", - "name": "Default Flow", - "next": { - "finish": "E", - "default": "F2" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "F2", - "name": "Default Flow", - "next": { - "true": "ST2", - "default": "ST3" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.approved" - } - } - } - }, - { - "id": "ST2", - "name": "Approve proof", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "proof_id": { - "$ref": "result.activities[0].data.proof_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/documents/approve" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST3", - "name": "Approve proof", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "proof_id": { - "$ref": "result.activities[0].data.proof_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/documents/refut" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "E", - "name": "Término de análise de documentos", - "next": null, - "type": "Finish", - "lane_id": "B" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/appAccessAprova.json b/samples/blueprints/approva/appAccessAprova.json deleted file mode 100644 index 3d5b8fc2..00000000 --- a/samples/blueprints/approva/appAccessAprova.json +++ /dev/null @@ -1,873 +0,0 @@ -{ - "name": "appAccessAprova", - "description": "Fluxo único de entrada no app", - "blueprint_spec": { - "lanes": [ - { - "id": "A", - "name": "Anonymous", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('anonymous')" - } - }, - { - "id": "L", - "name": "LoggedUser", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('useApp')" - } - } - ], - "nodes": [ - { - "id": "SA-1", - "name": "Start as Logged User", - "next": "ST10", - "type": "Start", - "lane_id": "L", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST10", - "name": "Get profile", - "next": "SB5", - "type": "SystemTask", - "lane_id": "L", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?actor_id=eq.{{actor_data.actor_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB5", - "name": "Set profile to bag", - "next": "F4-L", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "F4-L", - "name": "Check user documentation", - "next": { - "default": "ST8-L", - "VERIFIED": "ST7-L" - }, - "type": "Flow", - "lane_id": "L", - "parameters": { - "input": { - "key": { - "$ref": "bag.profile.documents_review_status" - } - } - } - }, - { - "id": "ST7-L", - "name": "Start home workflow ", - "next": "U7-L", - "type": "SystemTask", - "lane_id": "L", - "category": "startProcess", - "parameters": { - "input": { - "limit": 10, - "offset": 0 - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "home" - } - }, - { - "id": "U7-L", - "name": "Notify Change Process Focus", - "next": "E", - "type": "UserTask", - "lane_id": "L", - "parameters": { - "input": { - "new_process_id": { - "$ref": "result" - } - }, - "action": "CHANGE_PROCESS_FOCUS", - "timeout": 60 - } - }, - { - "id": "ST8-L", - "name": "Get user documentation information", - "next": "SB4-L", - "type": "SystemTask", - "lane_id": "L", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/documents/status" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "SB4-L", - "name": "Set documentation information to bag", - "next": "ST9-L", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "documentation": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST9-L", - "name": "Get Onboarding images", - "next": "U5-L", - "type": "SystemTask", - "lane_id": "L", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/onboarding_images" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U5-L", - "name": "Show User Documentation status", - "next": "F5-L", - "type": "UserTask", - "lane_id": "L", - "parameters": { - "input": { - "documentation": { - "$ref": "bag.documentation" - }, - "primaryButton": "Ir para atendimento", - "activity_schema": { - "type": "object", - "required": [ - "ack" - ], - "properties": { - "ack": { - "type": "boolean" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - }, - "secondaryButton": "Verficar Status novamente", - "onboarding_images": { - "$ref": "result.data" - } - }, - "action": "DOCUMENTATION_INFORMATION" - } - }, - { - "id": "F5-L", - "name": "Check user option", - "next": { - "exit": "E", - "default": "ST10" - }, - "type": "Flow", - "lane_id": "L", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "SA", - "name": "Start Anonymous", - "next": "ST4", - "type": "Start", - "lane_id": "A", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST4", - "name": "Get account settings", - "next": "SB2", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB2", - "name": "Save default claims to bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "account_id": { - "$ref": "result.data[0].id" - }, - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "U1", - "name": "Get Login Information", - "next": "SB1", - "type": "UserTask", - "lane_id": "A", - "parameters": { - "input": { - "text": "Para continuar insira o seu celular e confirme o código de confirmação", - "title": "Acesso", - "phoneInputIcon": "phone-outline", - "activity_schema": { - "type": "object", - "required": [ - "mobile_phone" - ], - "properties": { - "mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - }, - "phoneInputLabel": "Celular", - "loginButtonLabel": "Entrar", - "phoneInputPlaceholder": "(00) 0000-0000" - }, - "action": "LOGIN" - } - }, - { - "id": "SB1", - "name": "Saves phone generate Token and Set To Bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "token": { - "$js": "() => `${Math.floor(1000 + Math.random() * 9000)}`" - }, - "mobile_phone": { - "$ref": "result.activities[0].data.mobile_phone" - } - } - } - }, - { - "id": "ST1", - "name": "Send token sms", - "next": "U2", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "phone": { - "$ref": "bag.mobile_phone" - }, - "message": { - "$mustache": "Aprova App, utilize o token {{ bag.token }} para realizar seu acesso" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/token/send" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200 - ] - } - }, - { - "id": "U2", - "name": "Get Verification Information", - "next": "F1", - "type": "UserTask", - "lane_id": "A", - "parameters": { - "input": { - "text": "Insira o código que foi enviado para o seu telefone:", - "error": "", - "phone": { - "$ref": "bag.mobile_phone" - }, - "title": "Verificação", - "codeInputLabel": "Insira o código", - "expirationTime": 120, - "phoneInputIcon": "phone-outline", - "activity_schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - }, - "retryButtonLabel": "Gerar novo código", - "confirmButtonLabel": "Confirmar", - "codeInputPlaceholder": "0000" - }, - "action": "VERIFICATION" - } - }, - { - "id": "F1", - "name": "Default Flow", - "next": { - "cancel": "E", - "return": "U1", - "default": "F2", - "new_token": "ST1" - }, - "type": "Flow", - "lane_id": "A", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "F2", - "name": "Check token?", - "next": { - "default": "U4", - "token_ok": "ST2", - "token_error": "U4" - }, - "type": "Flow", - "lane_id": "A", - "parameters": { - "input": { - "key": { - "$js": "({bag, result}) => (result.activities[0].data.token === bag.token) ? 'token_ok' : 'token_error'" - } - } - } - }, - { - "id": "ST2", - "name": "Get User information", - "next": "F3", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?mobile_phone=eq.{{ bag.mobile_phone }}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F3", - "name": "User aleready exists?", - "next": { - "true": "ST6", - "default": "ST3" - }, - "type": "Flow", - "lane_id": "A", - "parameters": { - "input": { - "key": { - "$js": "({result}) => (result.data.length > 0) ? true : false" - } - } - } - }, - { - "id": "ST3", - "name": "Create actor", - "next": "ST5", - "type": "SystemTask", - "lane_id": "A", - "category": "CreateActorTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.mobile_phone" - }, - "claims": { - "$ref": "bag.default_claims" - }, - "account_id": { - "$ref": "bag.account_id" - } - } - } - }, - { - "id": "ST5", - "name": "Create profile", - "next": "ST6", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "actor_id": { - "$ref": "result.actor.id" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/create" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST6", - "name": "Login", - "next": "SB3", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/login" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "SB3", - "name": "Set profile and login to bag", - "next": "U6", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "login": { - "$ref": "result.data.login" - }, - "profile": { - "$ref": "result.data.profile" - } - } - } - }, - { - "id": "U6", - "name": "Recivie login Info", - "next": "F4", - "type": "UserTask", - "lane_id": "L", - "parameters": { - "input": { - "login": { - "$ref": "bag.login" - }, - "activity_schema": { - "type": "object", - "required": [ - "ack" - ], - "properties": { - "ack": { - "type": "boolean" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "RECEIVE_LOGIN_INFO" - } - }, - { - "id": "F4", - "name": "Check user documentation", - "next": { - "default": "ST8", - "VERIFIED": "ST7" - }, - "type": "Flow", - "lane_id": "L", - "parameters": { - "input": { - "key": { - "$ref": "bag.profile.documents_review_status" - } - } - } - }, - { - "id": "ST7", - "name": "Start home workflow ", - "next": "U7", - "type": "SystemTask", - "lane_id": "L", - "category": "startProcess", - "parameters": { - "input": { - "limit": 10, - "offset": 0 - }, - "actor_data": { - "claims": { - "$ref": "bag.login.claims" - }, - "actor_id": { - "$ref": "bag.login.actor_id" - }, - "account_id": { - "$ref": "bag.login.account_id" - } - }, - "workflow_name": "home" - } - }, - { - "id": "U7", - "name": "Notify Change Process Focus", - "next": "E", - "type": "UserTask", - "lane_id": "L", - "parameters": { - "input": { - "new_process_id": { - "$ref": "result" - } - }, - "action": "CHANGE_PROCESS_FOCUS", - "timeout": 60 - } - }, - { - "id": "ST8", - "name": "Get user documentation information", - "next": "SB4", - "type": "SystemTask", - "lane_id": "L", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/documents/status" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "SB4", - "name": "Set documentation information to bag", - "next": "ST9", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "documentation": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST9", - "name": "Get Onboarding images", - "next": "U5", - "type": "SystemTask", - "lane_id": "L", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/onboarding_images" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U5", - "name": "Show User Documentation status", - "next": "ST6-1", - "type": "UserTask", - "lane_id": "L", - "parameters": { - "input": { - "documentation": { - "$ref": "bag.documentation" - }, - "primaryButton": "Ir para atendimento", - "activity_schema": { - "type": "object", - "required": [ - "ack" - ], - "properties": { - "ack": { - "type": "boolean" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - }, - "secondaryButton": "Verficar Status novamente", - "onboarding_images": { - "$ref": "result.data" - } - }, - "action": "DOCUMENTATION_INFORMATION" - } - }, - { - "id": "ST6-1", - "name": "Login", - "next": "SB3-1", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/login" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "SB3-1", - "name": "Set profile and login to bag", - "next": "F4", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "login": { - "$ref": "result.data.login" - }, - "profile": { - "$ref": "result.data.profile" - } - } - } - }, - { - "id": "U4", - "name": "Get Verification Information Again", - "next": "F1", - "type": "UserTask", - "lane_id": "A", - "parameters": { - "input": { - "text": "Insira o código que foi enviado para o seu telefone:", - "error": "Código inserido está incorreto!", - "phone": { - "$ref": "bag.mobile_phone" - }, - "title": "Verificação", - "codeInputLabel": "Insira o código", - "expirationTime": 120, - "phoneInputIcon": "phone-outline", - "activity_schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - }, - "retryButtonLabel": "Gerar novo código", - "confirmButtonLabel": "Confirmar", - "codeInputPlaceholder": "0000" - }, - "action": "VERIFICATION" - } - }, - { - "id": "E", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "L" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/appAccessAprovaRealtor.json b/samples/blueprints/approva/appAccessAprovaRealtor.json deleted file mode 100644 index 36009b25..00000000 --- a/samples/blueprints/approva/appAccessAprovaRealtor.json +++ /dev/null @@ -1,668 +0,0 @@ -{ - "name": "appAccessAprovaRealtor", - "description": "Fluxo único de entrada no app pelo Corretor", - "blueprint_spec": { - "lanes": [ - { - "id": "A", - "name": "Anonymous", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('anonymous')" - } - }, - { - "id": "L", - "name": "LoggedUser", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('useApp')" - } - }, - { - "id": "L-LATCHED", - "name": "LoggedUser Latched", - "rule": { - "$js": "({bag, actor_data}) => bag.actor_id === actor_data.actor_id && actor_data.claims.includes('useApp')" - } - }, - { - "id": "A-LATCHED", - "name": "Anonymous Latched", - "rule": { - "$js": "({bag, actor_data}) => bag.session_id === actor_data.session_id && actor_data.claims.includes('anonymous')" - } - } - ], - "nodes": [ - { - "id": "SA-1", - "name": "Start as Logged User", - "next": "ST10", - "type": "Start", - "lane_id": "L", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST10", - "name": "Get profile", - "next": "SB5", - "type": "SystemTask", - "lane_id": "L", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?actor_id=eq.{{actor_data.actor_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB5", - "name": "Set profile to bag", - "next": "ST7-L", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "ST7-L", - "name": "Start home workflow ", - "next": "U7-L", - "type": "SystemTask", - "lane_id": "L-LATCHED", - "category": "startProcess", - "parameters": { - "input": { - "limit": 10, - "offset": 0 - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "home" - } - }, - { - "id": "U7-L", - "name": "Notify Change Process Focus", - "next": "E", - "type": "UserTask", - "lane_id": "L-LATCHED", - "parameters": { - "input": { - "new_process_id": { - "$ref": "result" - } - }, - "action": "CHANGE_PROCESS_FOCUS", - "timeout": 60 - } - }, - { - "id": "SA", - "name": "Start Anonymous", - "next": "ST4", - "type": "Start", - "lane_id": "A", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST4", - "name": "Get account settings", - "next": "SB2", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB2", - "name": "Save default claims to bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "account_id": { - "$ref": "result.data[0].id" - }, - "session_id": { - "$ref": "actor_data.session_id" - }, - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "U1", - "name": "Get Login Information", - "next": "SB1", - "type": "UserTask", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "text": "Para continuar insira o seu celular e confirme o código de confirmação", - "title": "Acesso", - "phoneInputIcon": "phone-outline", - "activity_schema": { - "type": "object", - "required": [ - "mobile_phone" - ], - "properties": { - "mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - }, - "phoneInputLabel": "Celular", - "loginButtonLabel": "Entrar", - "phoneInputPlaceholder": "(00) 0000-0000" - }, - "action": "LOGIN" - } - }, - { - "id": "SB1", - "name": "Saves phone generate Token and Set To Bag", - "next": "SB1-1", - "type": "SystemTask", - "lane_id": "A-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "token": { - "$js": "() => `${Math.floor(1000 + Math.random() * 9000)}`" - }, - "mobile_phone": { - "$ref": "result.activities[0].data.mobile_phone" - } - } - } - }, - { - "id": "SB1-1", - "name": "Verify profile as active", - "next": "SB1-2", - "type": "SystemTask", - "lane_id": "A-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/{{bag.mobile_phone}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1-2", - "name": "realtor is active", - "next": { - "REALTOR": "ST1", - "default": "U3" - }, - "type": "Flow", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.data.role" - } - } - } - }, - { - "id": "U3", - "name": "send message if realtor is inactive", - "next": "SB1-3", - "type": "UserTask", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "text": "O numero informado esta desabilitado na base", - "title": "Corretor Indisponivel", - "buttonLabel": "Ok", - "activity_schema": { - "type": "object", - "required": [ - "confirm" - ], - "properties": { - "confirm": { - "type": "boolean" - } - }, - "additionalProperties": false - } - }, - "action": "REALTOR_INACTIVE" - } - }, - { - "id": "SB1-3", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "A-LATCHED" - }, - { - "id": "ST1", - "name": "Send token sms", - "next": "U2", - "type": "SystemTask", - "lane_id": "A-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "phone": { - "$ref": "bag.mobile_phone" - }, - "message": { - "$mustache": "Aprova App, utilize o token {{ bag.token }} para realizar seu acesso" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/token/send" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200 - ] - } - }, - { - "id": "U2", - "name": "Get Verification Information", - "next": "F1", - "type": "UserTask", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "text": "Insira o código que foi enviado para o seu telefone:", - "error": "", - "phone": { - "$ref": "bag.mobile_phone" - }, - "title": "Verificação", - "codeInputLabel": "Insira o código", - "expirationTime": 120, - "phoneInputIcon": "phone-outline", - "activity_schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - }, - "retryButtonLabel": "Gerar novo código", - "confirmButtonLabel": "Confirmar", - "codeInputPlaceholder": "0000" - }, - "action": "VERIFICATION" - } - }, - { - "id": "F1", - "name": "Default Flow", - "next": { - "cancel": "E", - "return": "U1", - "default": "F2", - "new_token": "ST1" - }, - "type": "Flow", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "F2", - "name": "Check token?", - "next": { - "default": "U4", - "token_ok": "ST2", - "token_error": "U4" - }, - "type": "Flow", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "key": { - "$js": "({bag, result}) => (result.activities[0].data.token === bag.token) ? 'token_ok' : 'token_error'" - } - } - } - }, - { - "id": "ST2", - "name": "Get User information", - "next": "F3", - "type": "SystemTask", - "lane_id": "A-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?mobile_phone=eq.{{ bag.mobile_phone }}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F3", - "name": "User aleready exists?", - "next": { - "true": "ST6", - "default": "U5" - }, - "type": "Flow", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "key": { - "$js": "({result}) => (result.data.length > 0) ? true : false" - } - } - } - }, - { - "id": "U5", - "name": "Notify user does not exist", - "next": "F4", - "type": "UserTask", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "text": "Corretor não cadastrado no sistema!", - "activity_schema": { - "type": "object", - "required": [ - "option" - ], - "properties": { - "option": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "NOTIFY_REALTOR_DOESNT_EXIST" - } - }, - { - "id": "F4", - "name": "Check Ack action", - "next": { - "return": "U1", - "default": "E" - }, - "type": "Flow", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "ST6", - "name": "Login", - "next": "SB3", - "type": "SystemTask", - "lane_id": "A-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/login" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "SB3", - "name": "Set profile and login to bag", - "next": "U6", - "type": "SystemTask", - "lane_id": "A-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "login": { - "$ref": "result.data.login" - }, - "profile": { - "$ref": "result.data.profile" - }, - "actor_id": { - "$ref": "result.data.login.actor_id" - } - } - } - }, - { - "id": "U6", - "name": "Receive login Info", - "next": "ST7", - "type": "UserTask", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "login": { - "$ref": "bag.login" - }, - "activity_schema": { - "type": "object", - "required": [ - "ack" - ], - "properties": { - "ack": { - "type": "boolean" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "RECEIVE_LOGIN_INFO" - } - }, - { - "id": "ST7", - "name": "Start home workflow ", - "next": "U7", - "type": "SystemTask", - "lane_id": "L-LATCHED", - "category": "startProcess", - "parameters": { - "input": { - "limit": 10, - "offset": 0 - }, - "actor_data": { - "claims": { - "$ref": "bag.login.claims" - }, - "actor_id": { - "$ref": "bag.login.actor_id" - }, - "account_id": { - "$ref": "bag.login.account_id" - } - }, - "workflow_name": "RealtorAppHome" - } - }, - { - "id": "U7", - "name": "Notify Change Process Focus", - "next": "E", - "type": "UserTask", - "lane_id": "L-LATCHED", - "parameters": { - "input": { - "new_process_id": { - "$ref": "result" - } - }, - "action": "CHANGE_PROCESS_FOCUS", - "timeout": 60 - } - }, - { - "id": "U4", - "name": "Get Verification Information Again", - "next": "F1", - "type": "UserTask", - "lane_id": "A-LATCHED", - "parameters": { - "input": { - "text": "Insira o código que foi enviado para o seu telefone:", - "error": "Código inserido está incorreto!", - "phone": { - "$ref": "bag.mobile_phone" - }, - "title": "Verificação", - "codeInputLabel": "Insira o código", - "expirationTime": 120, - "phoneInputIcon": "phone-outline", - "activity_schema": { - "type": "object", - "required": [ - "token" - ], - "properties": { - "token": { - "type": "string" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - }, - "retryButtonLabel": "Gerar novo código", - "confirmButtonLabel": "Confirmar", - "codeInputPlaceholder": "0000" - }, - "action": "VERIFICATION" - } - }, - { - "id": "E", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "L-LATCHED" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/botMessage.json b/samples/blueprints/approva/botMessage.json deleted file mode 100644 index 4c9c0f2d..00000000 --- a/samples/blueprints/approva/botMessage.json +++ /dev/null @@ -1,327 +0,0 @@ -{ - "name": "botMessage", - "description": "Workflow para mensagens do bot", - "blueprint_spec": { - "lanes": [ - { - "id": "BACKOFFICE", - "name": "Backoffice", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('backoffice')" - } - }, - { - "id": "BACKOFFICE-LATCHED", - "name": "Backoffice Latched", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('backoffice') && actor_data.actor_id === bag.actor_id" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "VERIFY-INPUT", - "type": "Start", - "lane_id": "BACKOFFICE", - "parameters": { - "timeout": 7200, - "input_schema": {} - } - }, - { - "id": "SB1", - "name": "Set ActorId To Bag", - "next": "VERIFY-INPUT", - "type": "SystemTask", - "lane_id": "BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "VERIFY-INPUT", - "name": "Verify input to create message", - "next": { - "true": "GET-MESSAGE-TO-UPDATE", - "default": "GET-MESSAGE" - }, - "type": "Flow", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "GET-MESSAGE", - "name": "Get messages", - "next": "LIST-MESSAGE", - "type": "SystemTask", - "lane_id": "BACKOFFICE-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/dev_contracts?select=id,key&order=key.asc&schema=not.is.null" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "LIST-MESSAGE", - "name": "List messages", - "next": "VERIFY-TIMEOUT", - "type": "UserTask", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "message": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CHOOSE_MESSAGE_BOT", - "activity_manager": "commit" - } - }, - { - "id": "VERIFY-TIMEOUT", - "name": "Check if timeout is expired", - "next": { - "true": "TIMEOUT-EXIT", - "default": "GET-MESSAGE-TO-UPDATE" - }, - "type": "Flow", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "key": { - "$js": "({result}) => result.is_continuous === true" - } - } - } - }, - { - "id": "GET-MESSAGE-TO-UPDATE", - "name": "Get messages to update", - "next": "USER-SUBMIT-MESSAGE-TO-CREATE", - "type": "SystemTask", - "lane_id": "BACKOFFICE-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/dev_contracts?id=eq.{{result.activities.0.data.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "USER-SUBMIT-MESSAGE-TO-CREATE", - "name": "User submit message info to create", - "next": "VERIFY-ACTION", - "type": "UserTask", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "id": { - "$ref": "result.data[0].id" - }, - "value": { - "$ref": "result.data[0].value" - }, - "ui_schema": { - "$ref": "result.data[0].value.ui_schema" - }, - "activity_schema": { - "type": "object", - "required": [ - "id", - "value" - ], - "properties": { - "id": { - "type": "string" - }, - "value": { - "$ref": "result.data[0].schema" - } - }, - "additionalProperties": false - } - }, - "action": "SUBMIT_MESSAGE_BOT", - "activity_manager": "commit" - } - }, - { - "id": "VERIFY-ACTION", - "name": "Check user", - "next": { - "default": "REQUEST-TO-SUBMIT-MESSAGE", - "RETURN_LIST": "GET-MESSAGE" - }, - "type": "Flow", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "REQUEST-TO-SUBMIT-MESSAGE", - "name": "Request to submit message", - "next": "VERIFY-REQUEST", - "type": "SystemTask", - "lane_id": "BACKOFFICE-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - }, - "value": { - "$ref": "result.activities[0].data.value" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/dev_contracts?id=eq.{{result.activities.0.data.id}}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "VERIFY-REQUEST", - "name": "Check request status", - "next": { - "204": "CONFIRM-REQUEST", - "default": "ERROR-MESSAGE" - }, - "type": "Flow", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "key": { - "$js": "({result}) => result.status" - } - } - } - }, - { - "id": "TIMEOUT-EXIT", - "name": "Notify timeout", - "next": "FINISH", - "type": "UserTask", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "message": "Tempo expirado!", - "toggleModal": true - }, - "action": "NOTIFY_TIMEOUT" - } - }, - { - "id": "ERROR-MESSAGE", - "name": "Notify error", - "next": "FINISH", - "type": "UserTask", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "message": "Erro!", - "toggleModal": true - }, - "action": "NOTIFY_ERROR_MESSAGE_BOT", - "timeout": 1 - } - }, - { - "id": "CONFIRM-REQUEST", - "name": "Notify success", - "next": "FINISH", - "type": "UserTask", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "message": "Requisicao realizada com sucesso!", - "toggleModal": true - }, - "action": "NOTIFY_SUCCESS_MESSAGE_BOT", - "timeout": 1 - } - }, - { - "id": "FINISH", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "BACKOFFICE-LATCHED" - } - ], - "prepare": [], - "environment": { - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/chatMetaCRUD.json b/samples/blueprints/approva/chatMetaCRUD.json deleted file mode 100644 index 68486ef6..00000000 --- a/samples/blueprints/approva/chatMetaCRUD.json +++ /dev/null @@ -1,825 +0,0 @@ -{ - "name": "chatMetaCRUD", - "description": "Fluxo para cadastro genérico no repositorio de chat", - "blueprint_spec": { - "lanes": [ - { - "id": "GENERAL", - "name": "General access", - "rule": { - "$js": "({actor_data, bag}) => ((actor_data.claims).includes('admin') || (actor_data.claims).includes('create') || (actor_data.claims).includes('list') || (actor_data.claims).includes('read') || (actor_data.claims).includes('update') || (actor_data.claims).includes('delete'))" - } - }, - { - "id": "LIST", - "name": "List", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('list')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "CREATE", - "name": "Create", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('create')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "READ", - "name": "Read", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('read')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "UPDATE", - "name": "Update", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('update')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "DELETE", - "name": "Delete", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('delete')) && actor_data.actor_id == bag.actor_id)" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start meta CRUD", - "next": "GET-DEV-CONTRACTS", - "type": "Start", - "lane_id": "GENERAL", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "intent", - "key" - ], - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "intent": { - "type": "string" - }, - "env_api": { - "type": "string" - }, - "filters": { - "type": "object" - } - } - } - } - }, - { - "id": "GET-DEV-CONTRACTS", - "name": "Get dev_contracts", - "next": "SET-DEV-CONTRACTS-TO-BAG", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.{{bag.key}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-DEV-CONTRACTS-TO-BAG", - "name": "Set dev_contracts object to bag", - "next": "VALIDATE-INPUT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "data": { - "$js": "({bag}) => bag.data ? bag.data : {}" - }, - "schema": { - "$ref": "result.data[0].value" - }, - "filters": { - "$js": "({bag}) => bag.filters ? bag.filters : {}" - }, - "key_url": { - "$js": "({bag}) => {return (bag.key).substring(9,(bag.key.length))}" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "VALIDATE-INPUT", - "name": "Validate input", - "next": "CHECK-INPUT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "data": { - "$ref": "bag.data" - }, - "intent": { - "$ref": "bag.intent" - }, - "filters": { - "$ref": "bag.filters" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/validate/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CHECK-INPUT", - "name": "Check input", - "next": { - "VALID": "SET-QUERYS-TO-BAG", - "default": "FINISH-DEV-CONTRACTS" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "SET-QUERYS-TO-BAG", - "name": "Set url to bag", - "next": "CHECK-QUERYS", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "query_id": { - "key": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'construction_companies' : bag.key_url == 'typologies' ? 'properties_projects' : bag.key_url == 'simulators_params' ? 'properties_projects' : bag.key_url == 'proposals' ? 'units' : null" - } - }, - "query_column": { - "key": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'company_name' : bag.key_url == 'typologies' ? 'title' : bag.key_url == 'simulators_params' ? 'title' : bag.key_url == 'proposals' ? 'unit_code' : null" - } - } - } - } - }, - { - "id": "CHECK-QUERYS", - "name": "Check query_id and column", - "next": { - "true": "GET-IDS", - "default": "CHECK-INTENT" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !!bag.query_id.key && !!bag.query_column.key" - } - } - } - }, - { - "id": "GET-IDS", - "name": "Get ids", - "next": "SET-IDS-TO-BAG", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/{{bag.query_id.key}}?select=id,{{bag.query_column.key}}&order=created_at.asc" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-IDS-TO-BAG", - "name": "Set ids to bag", - "next": "CHECK-INTENT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "type": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'string' : bag.key_url == 'typologies' ? 'string' : bag.key_url == 'simulators_params' ? 'string' : bag.key_url == 'proposals' ? 'string' : null" - }, - "title": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'Nome do Incorporador' : bag.key_url == 'typologies' ? 'Código do Empreendimento' : bag.key_url == 'simulators_params' ? 'Código do Empreendimento' : bag.key_url == 'proposals' ? 'Código da Unidade' : null" - }, - "query_id": { - "$js": "({bag, result}) => { const d = {...bag.query_id, ids: (result.data).map(obj => obj.id)}; d.ids.push(''); return d; }" - }, - "object_name": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'construction_company_id' : bag.key_url == 'typologies' ? 'properties_projects_id' : bag.key_url == 'simulators_params' ? 'properties_projects_id' : bag.key_url == 'proposals' ? 'unit_id' : null" - }, - "query_column": { - "$js": "({bag,result}) => { const d = {...bag.query_column, column_data: (result.data).map(obj => obj[bag.query_column.key])}; d.column_data.push(''); return d; }" - } - } - } - }, - { - "id": "CHECK-INTENT", - "name": "Check intent", - "next": { - "LIST": "GET-DATA-TO-LIST", - "READ": "READ", - "CREATE": "CREATE", - "DELETE": "DELETE", - "UPDATE": "GET-DATA-TO-UPDATE", - "default": "NOTIFY-INTENT-NOT-FOUND" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$ref": "bag.intent" - } - } - } - }, - { - "id": "GET-DATA-TO-LIST", - "name": "List", - "next": "SHOW-DATA-TO-LIST", - "type": "SystemTask", - "lane_id": "LIST", - "category": "HTTP", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - }, - "filters": { - "$ref": "bag.filters" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SHOW-DATA-TO-LIST", - "name": "Send data to list", - "next": "CHECK-TIMEOUT-LIST", - "type": "UserTask", - "lane_id": "LIST", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "list": { - "$js": "({result}) => result.data?.result ? result.data.result : []" - }, - "limit": { - "$ref": "bag.filters.limit" - }, - "intent": { - "$ref": "bag.intent" - }, - "offset": { - "$ref": "bag.filters.offset" - }, - "total_items": { - "$js": "({result}) => result.data?.count ? result.data.count : 0" - }, - "activity_schema": { - "$ref": "bag.schema.LIST" - } - }, - "action": "LIST", - "timeout": 3600 - } - }, - { - "id": "CHECK-TIMEOUT-LIST", - "name": "Check timeout", - "next": { - "true": "FINISH-LIST", - "default": "SET-OFFSET-LIMIT-TO-BAG" - }, - "type": "Flow", - "lane_id": "LIST", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "SET-OFFSET-LIMIT-TO-BAG", - "name": "Set value offset and limit to bag", - "next": "GET-DATA-TO-LIST", - "type": "SystemTask", - "lane_id": "LIST", - "category": "SetToBag", - "parameters": { - "input": { - "filters": { - "$js": "({result}) => result.activities[0]?.data?.filters ? result.activities[0].data.filters : {}" - } - } - } - }, - { - "id": "CREATE", - "name": "Create", - "next": "SUBMIT-CREATE", - "type": "UserTask", - "lane_id": "CREATE", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - }, - "form_data": { - "$ref": "bag.schema.CREATE.form_data" - }, - "ui_schema": { - "$ref": "bag.schema.CREATE.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => (bag.object_name ? {...bag.schema?.CREATE?.activity_schema, properties: {...bag.schema?.CREATE?.activity_schema?.properties, [bag.object_name]: {enum: bag.query_id.ids, enumNames: bag.query_column.column_data, title: bag.title, type: bag.type}}} : bag.schema?.CREATE?.activity_schema)" - } - }, - "action": "CREATE", - "timeout": 3600 - } - }, - { - "id": "SUBMIT-CREATE", - "name": "Create", - "next": "NOTIFY-CREATE", - "type": "SystemTask", - "lane_id": "CREATE", - "category": "HTTP", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "data": { - "$ref": "result.activities[0].data.form_data" - }, - "intent": { - "$ref": "bag.intent" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-CREATE", - "name": "Notify create", - "next": "FINISH-CREATE", - "type": "UserTask", - "lane_id": "CREATE", - "parameters": { - "input": { - "message": "{{bag.key_url}} created.", - "toggleModal": true - }, - "action": "NOTIFY_CREATE", - "timeout": 1 - } - }, - { - "id": "READ", - "name": "Read", - "next": "SEND-DATA-TO-READ", - "type": "SystemTask", - "lane_id": "READ", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SEND-DATA-TO-READ", - "name": "Send data to read", - "next": "FINISH-READ", - "type": "UserTask", - "lane_id": "READ", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - }, - "form_data": { - "$ref": "result.data" - }, - "ui_schema": { - "$ref": "bag.schema.READ.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => (bag.object_name ? {...bag.schema?.READ?.activity_schema, properties: {...bag.schema?.READ?.activity_schema.properties, [bag.object_name]: {enum: bag.query_id.ids, enumNames: bag.query_column.column_data, title: bag.title, type: bag.type}}} : bag.schema?.READ?.activity_schema)" - } - }, - "action": "READ", - "timeout": 3600 - } - }, - { - "id": "GET-DATA-TO-UPDATE", - "name": "Get data to update", - "next": "SEND-DATA-TO-UPDATE", - "type": "SystemTask", - "lane_id": "UPDATE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_POSTGREST}}}/{{bag.key_url}}?id=eq.{{bag.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SEND-DATA-TO-UPDATE", - "name": "Send data to update", - "next": "CHECK-TIMEOUT-UPDATE", - "type": "UserTask", - "lane_id": "UPDATE", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - }, - "form_data": { - "$ref": "result.data[0]" - }, - "ui_schema": { - "$ref": "bag.schema.UPDATE.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => (bag.object_name ? {...bag.schema?.UPDATE?.activity_schema, properties: {...bag.schema?.UPDATE?.activity_schema?.properties, [bag.object_name]: {enum: bag.query_id.ids, enumNames: bag.query_column.column_data, title: bag.title, type: bag.type}}} : bag.schema?.UPDATE?.activity_schema)" - } - }, - "action": "UPDATE", - "timeout": 3600 - } - }, - { - "id": "CHECK-TIMEOUT-UPDATE", - "name": "Check timeout", - "next": { - "true": "FINISH-UPDATE", - "default": "UPDATE" - }, - "type": "Flow", - "lane_id": "UPDATE", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "UPDATE", - "name": "Update", - "next": "NOTIFY-UPDATE", - "type": "SystemTask", - "lane_id": "UPDATE", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "data": { - "$ref": "result.activities[0].data.form_data" - }, - "intent": { - "$ref": "bag.intent" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-UPDATE", - "name": "Notify update", - "next": "FINISH-UPDATE", - "type": "UserTask", - "lane_id": "UPDATE", - "parameters": { - "input": { - "message": "{{bag.key_url}} updated.", - "toggleModal": true - }, - "action": "NOTIFY_UPDATE", - "timeout": 1 - } - }, - { - "id": "DELETE", - "name": "Delete", - "next": "NOTIFY-DELETE", - "type": "SystemTask", - "lane_id": "DELETE", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-DELETE", - "name": "Notify delete", - "next": "FINISH-DELETE", - "type": "UserTask", - "lane_id": "DELETE", - "parameters": { - "input": { - "message": { - "$ref": "{{bag.key_url}} deleted." - }, - "toggleModal": true - }, - "action": "NOTIFY_DELETE", - "timeout": 1 - } - }, - { - "id": "NOTIFY-INTENT-NOT-FOUND", - "name": "Notify intent not found", - "next": "FINISH-INTENT-NOT-FOUND", - "type": "UserTask", - "lane_id": "GENERAL", - "parameters": { - "input": { - "message": "{{bag.key_url}} intent not found.", - "toggleModal": true - }, - "action": "NOTIFY-INTENT-NOT-FOUND", - "timeout": 1 - } - }, - { - "id": "FINISH-LIST", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "LIST" - }, - { - "id": "FINISH-CREATE", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "CREATE" - }, - { - "id": "FINISH-UPDATE", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "UPDATE" - }, - { - "id": "FINISH-NO-LOCK", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "UPDATE" - }, - { - "id": "FINISH-DELETE", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "DELETE" - }, - { - "id": "FINISH-READ", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "READ" - }, - { - "id": "FINISH-DEV-CONTRACTS", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "GENERAL" - }, - { - "id": "FINISH-INTENT-NOT-FOUND", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "GENERAL" - } - ], - "prepare": [], - "environment": { - "CHAT_API": "CHAT_API", - "POSTGREST": "POSTGREST", - "CHAT_POSTGREST": "CHAT_POSTGREST" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/clientCRUD.json b/samples/blueprints/approva/clientCRUD.json deleted file mode 100644 index a2f81211..00000000 --- a/samples/blueprints/approva/clientCRUD.json +++ /dev/null @@ -1,402 +0,0 @@ -{ - "name": "clientCRUD", - "description": "Workflow para CRUD de Clientes", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('adminClient')" - } - }, - { - "id": "B-LATCHED", - "name": "Backoffice Latched", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('adminClient') && bag.actor_id === actor_data.actor_id" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "ST1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST1", - "name": "Get clients", - "next": "SB1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/list/client" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set activity information to bag", - "next": "GET-ACCOUNT-DATA", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "clients": { - "$ref": "result.data" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "GET-ACCOUNT-DATA", - "name": "Get account settings", - "next": "SET-DEFAULT-USER-CLAIMS-TO-BAG", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SET-DEFAULT-USER-CLAIMS-TO-BAG", - "name": "Save default claims to bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "U1", - "name": "List Clients", - "next": "SB2", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "clients": { - "$ref": "bag.clients" - }, - "activity_schema": { - "type": "object", - "required": [ - "option" - ], - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "option": { - "type": "string" - }, - "mobile_phone": { - "type": "string" - }, - "documents_review_status": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_CLIENTS_CRUD", - "activity_manager": "commit" - } - }, - { - "id": "SB2", - "name": "Set activity information to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - }, - "name": { - "$ref": "result.activities[0].data.name" - }, - "actor": { - "$ref": "result.activities[0].data.mobile_phone" - }, - "email": { - "$ref": "result.activities[0].data.email" - }, - "option": { - "$ref": "result.activities[0].data.option" - }, - "mobile_phone": { - "$ref": "result.activities[0].data.mobile_phone" - }, - "documents_review_status": { - "$ref": "result.activities[0].data.documents_review_status" - } - } - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "UPDATE": "ST2", - "default": "E", - "UPDATE_NEW_PHONE": "ST3", - "VERIFICATION_NUMBER_PHONE": "ST1" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "ST2", - "name": "Update Client", - "next": "ST4", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "email": { - "$ref": "bag.email" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - }, - "documents_review_status": { - "$ref": "bag.documents_review_status" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/{{bag.id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "ST4", - "name": "Update Actor", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.actor" - }, - "claims": { - "$ref": "bag.default_claims" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.WORKFLOW_API}}}/actor/update/{{result.data.actor_id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "ST3", - "name": "Verification number phone", - "next": "F5", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/verify/{{bag.mobile_phone}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "F5", - "name": "Check number phone verification", - "next": { - "true": "ST2", - "default": "U2" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U2", - "name": "Open cellular number duplication modal", - "next": "F1", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "clients": { - "$ref": "bag.clients" - }, - "toggleModal": true, - "activity_schema": { - "type": "object", - "required": [ - "option" - ], - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "option": { - "type": "string" - }, - "mobile_phone": { - "type": "string" - }, - "documents_review_status": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_CLIENTS_VERIFICATION_PHONE" - } - }, - { - "id": "CONFIRMATION-MESSAGE", - "name": "Request made message", - "next": "F1", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "action": { - "$ref": "bag.option" - }, - "confirm_message": true - }, - "action": "CONFIRMATION_MESSAGE_TO_USER_ON_CLIENT_CRUD", - "activity_schema": { - "type": "object", - "properties": { - "ack": { - "type": "boolean" - }, - "option": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B-LATCHED" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API", - "WORKFLOW_API": "WORKFLOW_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/conversionManagement.json b/samples/blueprints/approva/conversionManagement.json deleted file mode 100644 index 3ca8f5cf..00000000 --- a/samples/blueprints/approva/conversionManagement.json +++ /dev/null @@ -1,648 +0,0 @@ -{ - "name": "conversionManagement", - "description": "Fluxo para gestão de conversão", - "blueprint_spec": { - "lanes": [ - { - "id": "GENERAL", - "name": "General access", - "rule": { - "$js": "({actor_data, bag}) => (actor_data.claims).includes('conversionManagement')" - } - }, - { - "id": "LIST-READ", - "name": "List and read claims", - "rule": { - "$js": "({actor_data, bag}) => ((actor_data.claims).includes('conversionManagement') && actor_data.actor_id == bag.actor_id)" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start unit CRUD", - "next": "GET-DEV-CONTRACTS", - "type": "Start", - "lane_id": "GENERAL", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "intent", - "key" - ], - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "intent": { - "type": "string" - }, - "filters": { - "type": "object" - } - } - } - } - }, - { - "id": "GET-DEV-CONTRACTS", - "name": "Get dev contracts", - "next": "SET-DEV-CONTRACTS-TO-BAG", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.{{bag.key}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203 - ] - } - }, - { - "id": "SET-DEV-CONTRACTS-TO-BAG", - "name": "Set task settings to bag", - "next": "VALIDATE-INPUT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "data": { - "$js": "({bag}) => bag.data ? bag.data : {}" - }, - "schema": { - "$ref": "result.data[0].value" - }, - "filters": { - "$js": "({bag}) => bag.filters ? bag.filters : {}" - }, - "is_team": { - "$js": "({bag}) => bag.is_team ? bag.is_team : false" - }, - "key_url": { - "$js": "({bag}) => {return (bag.key).substring(7,(bag.key.length))}" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "VALIDATE-INPUT", - "name": "Validate input", - "next": "CHECK-INPUT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "data": { - "$ref": "bag.data" - }, - "intent": { - "$ref": "bag.intent" - }, - "filters": { - "$ref": "bag.filters" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/validate/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203 - ] - } - }, - { - "id": "CHECK-INPUT", - "name": "Check input", - "next": { - "VALID": "VERIFY-INTENT", - "default": "FINISH-DEV-CONTRACTS", - "undefined": "FINISH-DEV-CONTRACTS" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "VERIFY-INTENT", - "name": "Verify user intent", - "next": { - "LIST": "LIST-REQUESTS-FOR-KANBAN", - "READ": "GET-REQUEST", - "default": "NOTIFY-INTENT-NOT-FOUND", - "undefined": "NOTIFY-INTENT-NOT-FOUND" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$ref": "bag.intent" - } - } - } - }, - { - "id": "NOTIFY-INTENT-NOT-FOUND", - "name": "Notify intent not found", - "next": "FINISH-INTENT-NOT-FOUND", - "type": "UserTask", - "lane_id": "GENERAL", - "parameters": { - "input": { - "message": { - "$ref": "{{bag.key_url}} intent not found." - }, - "toggleModal": true - }, - "action": "NOTIFY-INTENT-NOT-FOUND", - "timeout": 1 - } - }, - { - "id": "LIST-REQUESTS-FOR-KANBAN", - "name": "List requests for kanban", - "next": "SET-REQUEST-LIST-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": { - "limit": { - "$ref": "bag.filters.limit" - }, - "offset": { - "$ref": "bag.filters.offset" - }, - "is_team": { - "$ref": "bag.is_team" - }, - "actor_id": { - "$ref": "bag.actor_id" - }, - "allowedStatus": { - "$ref": "bag.filters.allowedStatus" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests_management/list-requests-for-kanban" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203 - ] - } - }, - { - "id": "SET-REQUEST-LIST-TO-BAG", - "name": "Set request list to bag", - "next": "GET-INTERACTION-INFORMATION-BY-REQUEST", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "requests": { - "$ref": "result.data" - } - } - } - }, - { - "id": "GET-INTERACTION-INFORMATION-BY-REQUEST", - "name": "Get interaction information by request", - "next": "LIST", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": { - "requests": { - "$js": "({bag}) => (bag.requests).map(r => ({id: r.id}))" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/message/get-interaction-information-by-request" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "LIST", - "name": "Show units to user", - "next": "CHECK-TIMEOUT-LIST", - "type": "UserTask", - "lane_id": "LIST-READ", - "parameters": { - "input": { - "list": { - "$ref": "bag.requests" - }, - "limit": { - "$ref": "bag.filters.limit" - }, - "offset": { - "$ref": "bag.filters.offset" - }, - "list_chat": { - "$ref": "result.data" - }, - "activity_schema": { - "$ref": "bag.schema.LIST" - } - }, - "action": "LIST", - "timeout": 3600 - } - }, - { - "id": "CHECK-TIMEOUT-LIST", - "name": "Check timeout", - "next": { - "true": "FINISH-LIST", - "default": "SET-NEW-FILTERS-TO-BAG", - "undefined": "SET-NEW-FILTERS-TO-BAG" - }, - "type": "Flow", - "lane_id": "LIST-READ", - "parameters": { - "input": { - "key": { - "$ref": "result.is_continue" - } - } - } - }, - { - "id": "SET-NEW-FILTERS-TO-BAG", - "name": "Set new filters to bag", - "next": "LIST-REQUESTS-FOR-KANBAN", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "filters": { - "$ref": "result.activities[0].data.filters" - } - } - } - }, - { - "id": "GET-REQUEST", - "name": "Get request", - "next": "SET-REQUEST-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{bag.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203 - ] - } - }, - { - "id": "SET-REQUEST-TO-BAG", - "name": "Set request to bag", - "next": "GET-PROFILE-CLIENT", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "GET-PROFILE-CLIENT", - "name": "Get profile", - "next": "SET-PROFILE-CLIENT-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{bag.request.buyer_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203 - ] - } - }, - { - "id": "SET-PROFILE-CLIENT-TO-BAG", - "name": "Set profile to bag", - "next": "GET-PROFILE-REALTOR", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "GET-PROFILE-REALTOR", - "name": "Get profile", - "next": "SET-PROFILE-REALTOR-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{bag.request.realtor}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203 - ] - } - }, - { - "id": "SET-PROFILE-REALTOR-TO-BAG", - "name": "Set profile to bag", - "next": "GET-PROOFS", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "realtor": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "GET-PROOFS", - "name": "Get proofs", - "next": "SET-PROOFS-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/{{bag.request.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203 - ] - } - }, - { - "id": "SET-PROOFS-TO-BAG", - "name": "Set proofs to bag", - "next": "GET-STANDARD-MESSAGES", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "proofs": { - "$ref": "result.data.proofs" - } - } - } - }, - { - "id": "GET-STANDARD-MESSAGES", - "name": "Get standard messages", - "next": "SET-STANDARD-MESSAGES-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_POSTGREST}}}/standard_message?twilio_status=eq.APPROVED" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203 - ] - } - }, - { - "id": "SET-STANDARD-MESSAGES-TO-BAG", - "name": "Set proofs to bag", - "next": "SEND-DATA-TO-READ", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "standard_messages": { - "$ref": "result.data" - } - } - } - }, - { - "id": "SEND-DATA-TO-READ", - "name": "Send data to read", - "next": "FINISH-READ", - "type": "UserTask", - "lane_id": "LIST-READ", - "parameters": { - "input": { - "proofs": { - "$ref": "bag.proofs" - }, - "realtor": { - "$ref": "bag.realtor" - }, - "request": { - "$ref": "bag.request" - }, - "profiles": { - "main": { - "$js": "({ bag }) => { const title = { name: bag?.request?.metadata?.profiles?.main?.name?.value, email: bag?.request?.metadata?.profiles?.main?.email?.value, phone: bag?.party_number }; return { ...bag?.request?.metadata?.profiles?.main, title }; };" - }, - "second": { - "$js": "({ bag }) => { const title = { name: bag?.request?.metadata?.profiles?.second?.name?.value, email: bag?.request?.metadata?.profiles.second?.email?.value }; return { ...bag?.request?.metadata?.profiles?.second, title }; };" - } - }, - "card_data": { - "date": { - "$ref": "bag.profile.created_at" - }, - "name": { - "$ref": "bag.profile.name" - }, - "phone": { - "$ref": "bag.profile.mobile_phone" - } - }, - "ui_schema": { - "$ref": "bag.schema.READ.ui_schema" - }, - "activity_schema": { - "$ref": "bag.schema.READ.activity_schema" - }, - "standard_messages": { - "$ref": "bag.standard_messages" - }, - "additionalProperties": false - }, - "action": "READ", - "timeout": 3600 - } - }, - { - "id": "FINISH-LIST", - "name": "Finish conversionManagement", - "next": null, - "type": "Finish", - "lane_id": "LIST-READ" - }, - { - "id": "FINISH-READ", - "name": "Finish conversionManagement", - "next": null, - "type": "Finish", - "lane_id": "LIST-READ" - }, - { - "id": "FINISH-DEV-CONTRACTS", - "name": "Finish conversionManagement", - "next": null, - "type": "Finish", - "lane_id": "GENERAL" - }, - { - "id": "FINISH-INTENT-NOT-FOUND", - "name": "Finish conversionManagement", - "next": null, - "type": "Finish", - "lane_id": "GENERAL" - } - ], - "prepare": [], - "environment": { - "XPTO": "BOTAUTHOR", - "JWT_KEY": "JWT_KEY_BP", - "CHAT_API": "CHAT_API", - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API", - "CHAT_POSTGREST": "CHAT_POSTGREST" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/createRealtors.json b/samples/blueprints/approva/createRealtors.json deleted file mode 100644 index ea85b88c..00000000 --- a/samples/blueprints/approva/createRealtors.json +++ /dev/null @@ -1,221 +0,0 @@ -{ - "name": "createRealtors", - "description": "Fluxo único para criação dos perfis de corretores", - "blueprint_spec": { - "lanes": [ - { - "id": "A", - "name": "Anonymous", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "anonymous" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start workflow to create Realtor", - "next": "ST1", - "type": "Start", - "lane_id": "A", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST1", - "name": "Get account settings", - "next": "SB1", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Save default claims to bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "account_id": { - "$ref": "result.data[0].id" - }, - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "U1", - "name": "User inserts information to create Realtor", - "next": "SB2", - "type": "UserTask", - "lane_id": "A", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "SUBMIT_REALTOR_MOBILE_PHONE" - } - }, - { - "id": "SB2", - "name": "Set actor_number to bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "name": { - "$ref": "result.activities[0].data.name" - }, - "mobile_phone": { - "$ref": "result.activities[0].data.mobile_phone" - } - } - } - }, - { - "id": "ST2", - "name": "Create actor", - "next": "ST3", - "type": "SystemTask", - "lane_id": "A", - "category": "CreateActorTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.mobile_phone" - }, - "claims": { - "$ref": "bag.default_claims" - }, - "account_id": { - "$ref": "bag.account_id" - } - } - } - }, - { - "id": "ST3", - "name": "Create profile", - "next": "E", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "role": "REALTOR", - "actor_id": { - "$ref": "result.actor.id" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/create" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "E", - "name": "Finish workflow to create realtor", - "next": null, - "type": "Finish", - "lane_id": "A" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/documentReview.json b/samples/blueprints/approva/documentReview.json deleted file mode 100644 index 6c5d345e..00000000 --- a/samples/blueprints/approva/documentReview.json +++ /dev/null @@ -1,654 +0,0 @@ -{ - "name": "documentReview", - "description": "Sub process to send new documents to newRequest when review is requested.", - "blueprint_spec": { - "lanes": [ - { - "id": "BOT_X_BACKOFFICE", - "name": "BOT_X_BACKOFFICE", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "or", - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "or", - [ - "=", - "v", - [ - "`", - "adminRequests" - ] - ], - [ - "=", - "v", - [ - "`", - "botGeneral" - ] - ], - [ - "=", - "v", - [ - "`", - "botRealtor" - ] - ], - [ - "=", - "v", - [ - "`", - "botLead" - ] - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "START", - "name": "Start node", - "next": "REQUEST-1", - "type": "Start", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "request_id", - "party_number", - "bot_phone_number", - "buyer_profile_id", - "chat_id", - "chat_participant_id" - ], - "properties": { - "chat_id": { - "type": "string" - }, - "request_id": { - "type": "string" - }, - "party_number": { - "type": "string" - }, - "bot_phone_number": { - "type": "string" - }, - "buyer_profile_id": { - "type": "string" - }, - "chat_participant_id": { - "type": "string" - } - }, - "additionalProperties": true - } - } - }, - { - "id": "REQUEST-1", - "name": "Get request details", - "next": "REQUEST-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/{{bag.request_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "REQUEST-2", - "name": "Set request details to bag", - "next": "DOCUMENT-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "documents_map": [ - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* da frente da sua *CNH*.", - "document": "CNH_FRONT", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente da sua *CNH*, por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do verso da sua *CNH*.", - "document": "CNH_BACK", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do verso da *CNH*, por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* da frente do seu *RG*.", - "document": "RG_FRONT", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do seu *RG*, por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do verso do seu *RG*.", - "document": "RG_BACK", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do verso do seu *RG*, por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do *Comprovante de Residência*.\nOBS: Verifique se está dentro do prazo de 60 dias.\n(pode ser fatura de cartão, gás, água, conta de telefone ou celular, etc).", - "document": "DOCUMENT_RESIDENCE_PROOF", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Comprovante de Residência*, por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda vigente* (da pessoa que irá compor renda com você).", - "document": "PROLABORE", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda vigente* (da pessoa que irá compor renda com você), por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do seu *Contracheque*.", - "document": "FORMAL", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do seu *Contracheque*, por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do seu *Extrato Bancário*.", - "document": "INFORMAL", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do seu *Extrato Bancário*, por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do seu *Contrato Social*.", - "document": "EMPRESARIO(A)", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do seu *Contrato Social*, por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* da frente da *CNH* (da pessoa que irá compor renda com você).", - "document": "SECOND_CNH_FRONT", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente da *CNH* (da pessoa que irá compor renda com você), por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do verso da *CNH* (da pessoa que irá compor renda com você).", - "document": "SECOND_CNH_BACK", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do verso da *CNH* (da pessoa que irá compor renda com você), por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* da frente do *RG* (da pessoa que irá compor renda com você).", - "document": "SECOND_RG_FRONT", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do *RG* (da pessoa que irá compor renda com você), por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do verso do *RG* (da pessoa que irá compor renda com você).", - "document": "SECOND_RG_BACK", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do verso do *RG* (da pessoa que irá compor renda com você), por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do *Comprovante de Residência* (da pessoa que irá compor renda com você).\nOBS: Verifique se está dentro do prazo de 60 dias.\n(pode ser fatura de cartão, gás, água, conta de telefone ou celular, etc).", - "document": "SECOND_DOCUMENT_RESIDENCE_PROOF", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Comprovante de Residência* (da pessoa que irá compor renda com você), por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda vigente* (da pessoa que irá compor renda com você).", - "document": "SECOND_PROLABORE", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda vigente*, por favor (da pessoa que irá compor renda com você)." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do *Contracheque* (da pessoa que irá compor renda com você).", - "document": "SECOND_FORMAL", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do *Contracheque* (da pessoa que irá compor renda com você), por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do *Extrato Bancário* (da pessoa que irá compor renda com você).", - "document": "SECOND_INFORMAL", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do *Extrato Bancário* (da pessoa que irá compor renda com você), por favor." - }, - { - "message": "Bela: Por favor, me envie uma *foto* ou *PDF* do *Contrato Social* (da pessoa que irá compor renda com você).", - "document": "SECOND_EMPRESARIO(A)", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do *Contrato Social* (da pessoa que irá compor renda com você), por favor." - } - ], - "request_details": { - "$ref": "result.data" - }, - "documents_length": { - "$ref": "result.data.proofs.length" - }, - "documents_position": 0 - } - } - }, - { - "id": "DOCUMENT-1", - "name": "Check document analyze position", - "next": { - "true": "DOCUMENT-2", - "default": "EXIT" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.documents_position <= (bag.documents_length - 1)" - } - } - } - }, - { - "id": "DOCUMENT-2", - "name": "Check id document was rejected", - "next": { - "true": "DOCUMENT-2-A-1", - "default": "NEXT-DOCUMENT" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.request_details.proofs[bag.documents_position].proof_status === 'REJECTED'" - } - } - } - }, - { - "id": "NEXT-DOCUMENT", - "name": "Set request details to bag", - "next": "DOCUMENT-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "documents_position": { - "$js": "({bag}) => bag.documents_position + 1" - } - } - } - }, - { - "id": "DOCUMENT-2-A-1", - "name": "User uploading documents", - "next": "DOCUMENT-3", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.documents_map.filter((document) => document.document === bag.request_details.proofs[bag.documents_position].type)[0].message" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "external_id" - ], - "properties": { - "message": { - "type": "string" - }, - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "DOCUMENT-2-B-1", - "name": "User uploading documents", - "next": "DOCUMENT-3", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.documents_map.filter((document) => document.document === bag.request_details.proofs[bag.documents_position].type)[0].error_message" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "external_id" - ], - "properties": { - "message": { - "type": "string" - }, - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "DOCUMENT-3", - "name": "Set external_id and message received to bag", - "next": "DOCUMENT-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "external_id": { - "$ref": "result.activities[0].data.external_id" - } - } - } - }, - { - "id": "DOCUMENT-4", - "name": "Check if any media file was received from customer.", - "next": { - "true": "DOCUMENT-4-A-1", - "default": "DOCUMENT-2-B-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => (!!bag.external_id)" - } - } - } - }, - { - "id": "DOCUMENT-4-A-1", - "name": "Save BOT message on entity message from USER_UPLOADING_DOCUMENTS", - "next": "DOCUMENT-4-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.documents_map.filter((document) => document.document === bag.request_details.proofs[bag.documents_position].type)[0].message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-4-A-2", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-4-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-4-A-3", - "name": "Save messages history to bag.", - "next": "DOCUMENT-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-5", - "name": "Create Proofs and Attachments", - "next": "DOCUMENT-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "document": { - "$js": "({bag}) => bag.documents_map.filter((document) => document.document === bag.request_details.proofs[bag.documents_position].type)[0].document" - }, - "profile_id": { - "$ref": "bag.buyer_profile_id" - }, - "request_id": { - "$ref": "bag.request_id" - }, - "external_id": { - "$ref": "bag.external_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/proofs" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-6", - "name": "Save on table message the media file received.", - "next": "DOCUMENT-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.message ? bag.message : null" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-7", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-8", - "name": "Save messages history to bag.", - "next": "DOCUMENT-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "attachment_id": { - "$js": "({bag}) => bag.request_details.proofs[bag.documents_position].attachment_id" - }, - "documents_position": { - "$js": "({bag}) => bag.documents_position + 1" - } - } - } - }, - { - "id": "DOCUMENT-9", - "name": "Delete old proof from request.", - "next": "DOCUMENT-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/proofs/delete/{{bag.attachment_id}}" - }, - "verb": "DELETE", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "EXIT", - "name": "Finish review documents.", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/echoBot.json b/samples/blueprints/approva/echoBot.json deleted file mode 100644 index 88bb446c..00000000 --- a/samples/blueprints/approva/echoBot.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "echoBot", - "description": "Subprocess to get client info", - "blueprint_spec": { - "lanes": [ - { - "id": "1", - "name": "the_only_lane", - "rule": [ - "fn", - [ - "&", - "args" - ], - true - ] - } - ], - "nodes": [ - { - "id": "START", - "name": "Start node", - "next": "CAPTURE", - "type": "Start", - "lane_id": "1", - "parameters": { - "input_schema": {} - } - }, - { - "id": "CAPTURE", - "name": "User Task", - "next": "FLOW", - "type": "UserTask", - "lane_id": "1", - "parameters": { - "input": { - "chat_id": { - "$js": "({result}) => result.activities ? result.activities[0].data.message.chat_id : null" - }, - "messages": [ - { - "$js": "({result}) => result.activities ? result.activities[0].data.message.content : ({text: 'Primeira mensagem'})" - } - ], - "author_id": "c7e8da38-b926-4a6a-bf9f-82bd90604920" - }, - "action": "SUBMIT_USING_DEFAULT_HANDLER" - } - }, - { - "id": "FLOW", - "name": "Flow node", - "next": { - "true": "FINISH", - "default": "CAPTURE" - }, - "type": "Flow", - "lane_id": "1", - "parameters": { - "input": { - "keyword": { - "$js": "({result}) => result.activities ? result.activities[0].data.message.content.text === '#end#' : false" - } - } - } - }, - { - "id": "FINISH", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "1" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core", - "test_workflow_package" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/editProfile.json b/samples/blueprints/approva/editProfile.json deleted file mode 100644 index d6a3759e..00000000 --- a/samples/blueprints/approva/editProfile.json +++ /dev/null @@ -1,236 +0,0 @@ -{ - "name": "editProfile", - "description": "Fluxo único para alteração de perfil do usuário", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "adminProfiles" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start workflow to change profile", - "next": "ST1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST1", - "name": "Get all profiles", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U1", - "name": "User inserts information to change profile or back navigation", - "next": "F1", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "profiles": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "option": { - "type": "string" - }, - "status": { - "type": "string" - }, - "credit_limit": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "PROFILES_LIST" - } - }, - { - "id": "F1", - "name": "Check if user wants to back", - "next": { - "return": "E", - "default": "SB1" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "SB1", - "name": "Set profile changes to Bag", - "next": "U2", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - }, - "new_data": { - "$ref": "result.activities[0].data" - } - } - } - }, - { - "id": "U2", - "name": "Confirm if user wanna update profile", - "next": "F2", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "ack": { - "type": "boolean" - } - }, - "additionalProperties": false - } - }, - "action": "ACK_MODAL" - } - }, - { - "id": "F2", - "name": "Check if user wanna confirm the change", - "next": { - "false": "U1", - "default": "ST3" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.ack" - } - } - } - }, - { - "id": "ST3", - "name": "Make a request to UPDATE profile information", - "next": "E", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "data": { - "$ref": "bag.new_data" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/{{ bag.id }}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "E", - "name": "Finish workflow to change profile", - "next": null, - "type": "Finish", - "lane_id": "B" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/favourites.json b/samples/blueprints/approva/favourites.json deleted file mode 100644 index 4cf03375..00000000 --- a/samples/blueprints/approva/favourites.json +++ /dev/null @@ -1,315 +0,0 @@ -{ - "name": "favourites", - "description": "Fluxo de favoritos do usuário", - "blueprint_spec": { - "lanes": [ - { - "id": "L", - "name": "LoggedUser", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('useApp')" - } - }, - { - "id": "U", - "name": "Usuario Final", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('useApp') && actor_data.actor_id === bag.actor_id" - } - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start home workflow ", - "next": "SB5", - "type": "Start", - "lane_id": "L", - "parameters": { - "type": "object", - "input_schema": { - "required": [ - "offset", - "limit" - ], - "properties": { - "limit": { - "type": "integer" - }, - "offset": { - "type": "integer" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "SB5", - "name": "Set ActorId To Bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "ST1", - "name": "Get user profile", - "next": "SB1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?actor_id=eq.{{actor_data.actor_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set profile to Bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST2", - "name": "Get user favourites properties", - "next": "SB3", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects?list_type=favourites&limit={{bag.limit}}&offset={{bag.offset}}&profile_id={{bag.profile.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB3", - "name": "Set properties_projects to Bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "properties_projects": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U1", - "name": "User action with home", - "next": "F1", - "type": "UserTask", - "title": "Meus Favoritos", - "lane_id": "U", - "parameters": { - "input": { - "profile": { - "$ref": "bag.profile" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "property_project_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "FAVOURITES_PROPERTIES_PROJECTS_LIST" - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "exit": "E", - "like": "SB4", - "return": "ST2", - "default": "SB2", - "details": "U3" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "U3", - "name": "Get Propertie Project details", - "next": "F3", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "profile": { - "$ref": "bag.profile" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "property_project_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "PROPERTY_PROJECT_DETAIL" - } - }, - { - "id": "F3", - "name": "Check action", - "next": { - "like": "SB4", - "return": "ST2", - "default": "E" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "SB4", - "name": "Set properties_project id to Bag", - "next": "ST3", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "liked_propertie_project": { - "$ref": "result.activities[0].data.property_project_id" - } - } - } - }, - { - "id": "ST3", - "name": "Like propertie_project", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - }, - "properties_projects_id": { - "$ref": "bag.liked_propertie_project" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/like" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "SB2", - "name": "Set offset to bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "offset": { - "$js": "({bag}) => bag.offset + bag.limit" - } - } - } - }, - { - "id": "E", - "name": "Finish Favourites", - "next": null, - "type": "Finish", - "lane_id": "U" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/getInfo.json b/samples/blueprints/approva/getInfo.json deleted file mode 100644 index b885182a..00000000 --- a/samples/blueprints/approva/getInfo.json +++ /dev/null @@ -1,1343 +0,0 @@ -{ - "name": "getInfo", - "description": "Subprocess to get client info", - "blueprint_spec": { - "lanes": [ - { - "id": "REQUESTBOT", - "name": "Buyer", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('requestBot')" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start getInfo", - "next": "START-UPDATE-PRE", - "type": "Start", - "lane_id": "REQUESTBOT", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "key", - "mobile_phone", - "profile", - "profile_type", - "chat_id" - ], - "properties": { - "key": { - "type": "string" - }, - "chat_id": { - "type": "string" - }, - "profile": { - "type": "object" - }, - "request_id": { - "type": "string" - }, - "mobile_phone": { - "type": "string" - }, - "profile_type": { - "type": "string" - }, - "parent_process_data": { - "type": "object" - }, - "confirmation_required": { - "type": "boolean" - } - } - } - } - }, - { - "id": "START-UPDATE-PRE", - "name": "Start process to update request", - "next": "CONFIG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "profile": { - "$ref": "bag.profile" - }, - "request_id": { - "$ref": "bag.request_id" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "updateRequestV3" - } - }, - { - "id": "CONFIG", - "name": "Set basic parameters", - "next": "VERIFY-VALUE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "baseURL": "{{SERVICE_API}}", - "author_id": { - "$ref": "environment.XPTO" - } - } - } - }, - { - "id": "VERIFY-VALUE", - "name": "Verify inputs", - "next": { - "true": "EARLY-RETURN", - "default": "MOCK" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !!bag.profile[bag.key] && bag.profile[bag.key].valid" - } - } - } - }, - { - "id": "MOCK", - "name": "use mock", - "next": { - "true": "MOCK-DEV-CONTRACT", - "default": "DEV-CONTRACT" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !!bag.mock" - } - } - } - }, - { - "id": "DEV-CONTRACT", - "name": "Fetch settings for running it", - "next": "DEV-CONTRACT-RESPONSE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.{{bag.profile_type}}_{{bag.key}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - }, - "max_content_length": 50000 - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DEV-CONTRACT-RESPONSE", - "name": "use mock", - "next": { - "0": "EXIT-NO-MESSAGE", - "default": "DEV-CONTRACT-BAG" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.length" - } - } - } - }, - { - "id": "MOCK-DEV-CONTRACT", - "name": "Set task settings to bag", - "next": "MOCK-DEV-CONTRACT-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "mockData": { - "validators": [ - { - "url": "https://616db49fa83a850017caa6b4.mockapi.io/aprova/validator/", - "error": { - "BALROG": "you could not pass", - "FRIEND": "you can enter" - } - }, - { - "url": "https://616db49fa83a850017caa6b4.mockapi.io/aprova/otherValidator/", - "error": { - "BALROG": "you could not pass", - "FRIEND": "you can enter" - } - }, - { - "url": "https://616db49fa83a850017caa6b4.mockapi.io/aprova/thirdIsACharm/", - "error": { - "BALROG": "you shall not pass", - "FRIEND": "you can enter" - } - } - ], - "response_type": "TEXT", - "check_messages": [ - { - "message": "Check message 1", - "external_id": "c1" - }, - { - "message": "Check message 2", - "external_id": "c2" - } - ], - "success_messages": [ - { - "message": "Success message 1", - "external_id": "cp1" - }, - { - "message": "Sucesss message 2", - "external_id": "cp2" - }, - { - "message": "Sucesss message 3", - "external_id": "cp3" - } - ], - "acquisition_messages": [ - { - "message": "Acquision Msg 0", - "external_id": "0" - }, - { - "message": "Acquision Msg 1", - "external_id": "1" - }, - { - "message": "Acquision Msg 2", - "external_id": "2" - }, - { - "message": "Acquision Msg 3", - "external_id": "3" - }, - { - "message": "Acquision Msg 4", - "external_id": "4" - }, - { - "message": "Acquision Msg 5", - "external_id": "5" - } - ], - "check_timeout_policy": 10, - "instruction_messages": [ - { - "message": "I1", - "external_id": "123" - }, - { - "message": "I2", - "external_id": "234" - } - ], - "check_timeout_messages": [ - { - "message": "Check proceed message 1", - "external_id": "cp1" - }, - { - "message": "Check proceed message 2", - "external_id": "cp2" - }, - { - "message": "Check proceed message 3", - "external_id": "cp3" - } - ], - "acquisition_timeout_policy": 30, - "acquisition_proceed_messages": [ - { - "message": "Acq Proceed Msg 1", - "external_id": "12" - }, - { - "message": "Acq Proceed Msg 2", - "external_id": "23" - }, - { - "message": "Acq Proceed Msg 3", - "external_id": "34" - }, - { - "message": "Acq Proceed Msg 4", - "external_id": "45" - }, - { - "message": "Acq Proceed Msg 5", - "external_id": "56" - } - ], - "check_timeout_timeout_policy": 10, - "acquisition_proceed_timeout_policy": 8 - } - } - } - }, - { - "id": "MOCK-DEV-CONTRACT-BAG", - "name": "Set task settings to bag", - "next": "HAS-INSTRUCTIONS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "settings": { - "values": { - "$ref": "bag.mockData" - } - }, - "check_len": { - "$js": "({bag}) => bag.mockData.check_messages.length || 0" - }, - "check_counter": 0, - "acquisition_len": { - "$js": "({bag}) => bag.mockData.acquisition_messages.length || 0" - }, - "default_timeout": 10, - "check_timeout_len": { - "$js": "({bag}) => bag.mockData.check_timeout_messages.length || 0" - }, - "acquisition_counter": 0, - "remaining_validators": { - "$ref": "bag.mockData.validators" - }, - "check_timeout_counter": 0, - "acquisition_proceed_len": { - "$js": "({bag}) => bag.mockData.acquisition_proceed_messages.length || 0" - }, - "acquisition_proceed_counter": 0 - } - } - }, - { - "id": "DEV-CONTRACT-BAG", - "name": "Set task settings to bag", - "next": "HAS-INSTRUCTIONS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "key_name": { - "$ref": "result.data.[0].value.key_name" - }, - "settings": { - "values": { - "$ref": "result.data[0].value" - } - }, - "check_len": { - "$js": "({result}) => result.data[0].value.check_messages?.length || 0" - }, - "check_counter": 0, - "acquisition_len": { - "$js": "({result}) => result.data[0].value.acquisition_messages?.length || 0" - }, - "default_timeout": 10, - "check_timeout_len": { - "$js": "({result}) => result.data[0].value.check_timeout_messages?.length || 0" - }, - "acquisition_counter": 0, - "remaining_validators": { - "$ref": "result.data.[0].value.validators" - }, - "check_timeout_counter": 0, - "acquisition_proceed_len": { - "$js": "({result}) => result.data[0].value.acquisition_timeout?.length || 0" - }, - "acquisition_proceed_counter": 0 - } - } - }, - { - "id": "HAS-INSTRUCTIONS", - "name": "verify if it has instruction messages", - "next": { - "0": "ACQUISITION", - "default": "NOTIFY-INSTRUCTIONS", - "undefined": "ACQUISITION" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.settings.values.instruction_messages.length" - } - } - } - }, - { - "id": "NOTIFY-INSTRUCTIONS", - "name": "Sends the instructions messages to the user", - "next": "ACQUISITION", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": { - "$ref": "bag.settings.values.instruction_messages" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.mobile_phone" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "ACQUISITION", - "name": "User uploading documents", - "next": "ACQ-TIMEOUT", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "$js": "({bag}) => bag.settings.values.acquisition_messages[bag.acquisition_counter]" - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.mobile_phone" - }, - "profile_type": { - "$ref": "bag.profile_type" - }, - "activity_schema": { - "type": "object", - "properties": { - "message": { - "type": "string" - }, - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SEND_INFORMATION", - "timeout": 10800 - } - }, - { - "id": "CLIENT-WANNA-RETURN-RESET-NEXT", - "name": "Client wants to restart", - "next": { - "NEXT": "EXIT-NEXT", - "RESET": "EXIT-RESET", - "FINISH": "EXIT-FINISH", - "RETURN": "EXIT-RETURN", - "default": "ACQ-BAG" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => (result.activities[0].data.message.content.text === 'RECOMEÇAR') ? 'RESET' : (result.activities[0].data.message.content.text === 'VOLTAR') ? 'RETURN' : (result.activities[0].data.message.content.text === 'PULAR') ? 'NEXT' : (result.activities[0].data.message.content.text === 'FINALIZAR') ? 'FINISH' : result.activities[0].data.message.content.text " - } - } - } - }, - { - "id": "ACQ-BAG", - "name": "set info to bag and zero counter", - "next": "VALIDATORS-LENGTH", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "value": { - "$js": "({bag, result}) => (bag.settings.values.response_type === 'ATTACHMENT') ? result.activities[0].data.message.content.attachment_id : result.activities[0].data.message.content.text" - } - } - } - }, - { - "id": "ACQ-TIMEOUT", - "name": "Verify if timeout expired", - "next": { - "true": "ACQ-COUNTER", - "default": "CLIENT-WANNA-RETURN-RESET-NEXT" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "ACQ-COUNTER", - "name": "Verify count", - "next": { - "true": "ACQ-PROCEED-COUNTER", - "default": "ACQ-COUNTER-INCREASE" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.acquisition_counter >= (bag.acquisition_len - 1)" - } - } - } - }, - { - "id": "ACQ-COUNTER-INCREASE", - "name": "increase acquisition counter", - "next": "ACQUISITION", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "acquisition_counter": { - "$js": "({bag}) => bag.acquisition_counter + 1" - } - } - } - }, - { - "id": "ACQ-PROCEED-COUNTER-INCREASE", - "name": "increase acquisition counter", - "next": "ACQUISITION-PROCEED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "acquisition_proceed_counter": { - "$js": "({bag}) => bag.acquisition_proceed_counter + 1" - } - } - } - }, - { - "id": "CHECK-COUNTER-INCREASE", - "name": "increase acquisition counter", - "next": "CHECK", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "check_counter": { - "$js": "({bag}) => bag.check_counter + 1" - } - } - } - }, - { - "id": "CHECK-PROCEED-COUNTER-INCREASE", - "name": "increase acquisition counter", - "next": "CHECK-PROCEED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "check_timeout_counter": { - "$js": "({bag}) => bag.check_timeout_counter + 1" - } - } - } - }, - { - "id": "ACQUISITION-PROCEED", - "name": "Ask if user want to proceed with uploading process", - "next": "ACQ-PROCEED-TIMEOUT", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "$js": "({bag}) => bag.settings.values.acquisition_proceed_messages[bag.acquisition_proceed_counter]" - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.mobile_phone" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SEND_INFORMATION", - "timeout": 3600 - } - }, - { - "id": "ACQ-PROCEED-TIMEOUT", - "name": "Verify if timeout expired for acquisition proceed", - "next": { - "true": "ACQ-PROCEED-COUNTER", - "default": "ACQ-PROCEED-RESPONSE" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "ACQ-PROCEED-COUNTER", - "name": "Verify count", - "next": { - "true": "EXIT-INACTIVE", - "default": "ACQ-PROCEED-COUNTER-INCREASE" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.acquisition_proceed_counter >= (bag.acquisition_proceed_len)" - } - } - } - }, - { - "id": "ACQ-PROCEED-RESPONSE", - "name": "Verify if user will proceed with uploading process", - "next": { - "1": "ACQ-COUNTERS-RESET", - "2": "EXIT-USER-DECISION", - "default": "ACQ-PROCEED-COUNTER-RESET" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.payload.message.content.text" - } - } - } - }, - { - "id": "ACQ-COUNTERS-RESET", - "name": "zero acq counters", - "next": "ACQUISITION", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "acquisition_counter": 0, - "acquisition_proceed_counter": 0 - } - } - }, - { - "id": "ALL-COUNTERS-RESET", - "name": "zero ALL counters", - "next": "ACQUISITION", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "check_counter": 0, - "acquisition_counter": 0, - "check_timeout_counter": 0, - "acquisition_proceed_counter": 0 - } - } - }, - { - "id": "CHECK-COUNTERS-RESET", - "name": "zero check counters", - "next": "CHECK", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "check_counter": 0, - "check_timeout_counter": 0 - } - } - }, - { - "id": "ACQ-PROCEED-COUNTER-RESET", - "name": "zero acq counters", - "next": "ACQUISITION-PROCEED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "acquisition_proceed_counter": 0 - } - } - }, - { - "id": "VALIDATORS-LENGTH", - "name": "Verify if there is a check url to call", - "next": { - "true": "VALIDATORS-TAKE-FIRST", - "default": "VALIDATOR-ERRORS" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !bag.bypass_validator && bag.remaining_validators.length > 0" - } - } - } - }, - { - "id": "CONFIRMATION-REQUIRED", - "name": "Verify if a check url is provided", - "next": { - "true": "CHECK", - "default": "NOTIFY-SUCCESS" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !bag.bypass_check && bag.check_len > 0" - } - } - } - }, - { - "id": "VALIDATORS-TAKE-FIRST", - "name": "bag first validator", - "next": "VALIDATOR", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "setToBag", - "parameters": { - "input": { - "current_validator": { - "$js": "({bag}) => bag.remaining_validators.shift()" - }, - "remaining_validators": { - "$js": "({bag}) => { let result = bag.remaining_validators; result.shift(); return result; }" - } - } - } - }, - { - "id": "VALIDATOR", - "name": "Validate user info", - "next": "VALIDATOR-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "value": { - "$ref": "bag.value" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/{{{bag.current_validator.url}}}" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "VALIDATOR-BAG", - "name": "bag response", - "next": "VALIDATORS-LENGTH", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "setToBag", - "parameters": { - "input": { - "validator_error_messages": { - "$js": "({ bag, result }) => { let errors = bag.validator_error_messages || []; if (result.data.error_list) { errors.push(...result.data.error_list.flatMap((error) => bag.current_validator.error[error] || { 'text': error })); } return errors; };" - } - } - } - }, - { - "id": "VALIDATOR-ERRORS", - "name": "Notify validate message", - "next": { - "0": "CONFIRMATION-REQUIRED", - "default": "NOTIFY-VALIDATOR-ERROR", - "undefined": "CONFIRMATION-REQUIRED" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.validator_error_messages.length" - } - } - } - }, - { - "id": "NOTIFY-VALIDATOR-ERROR", - "name": "Notify user data received is invalid", - "next": "VALIDATOR-ERRORS-RESET", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": { - "$ref": "bag.validator_error_messages" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.mobile_phone" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "VALIDATOR-ERRORS-RESET", - "name": "zero errors and reset validators", - "next": "ACQUISITION", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "current_validator": null, - "remaining_validators": { - "$ref": "bag.settings.values.validators" - }, - "validator_error_messages": [] - } - } - }, - { - "id": "CHECK", - "name": "Get user consent to verify if document is correct", - "next": "CHECK-TIMEOUT", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "$js": "({bag}) => bag.settings.values.check_messages[bag.check_counter]" - }, - { - "text": { - "$mustache": "{{bag.key_name}}: {{bag.value}}" - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.mobile_phone" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SELECT_OPTION", - "timeout": 3600 - } - }, - { - "id": "CHECK-TIMEOUT", - "name": "Check if CHECK has expired", - "next": { - "true": "CHECK-COUNTER", - "default": "CHECK-RESPONSE" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "CHECK-COUNTER", - "name": "Verify count", - "next": { - "true": "CHECK-PROCEED-LENGTH", - "default": "CHECK-COUNTER-INCREASE" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.check_counter >= (bag.check_len - 1)" - } - } - } - }, - { - "id": "CHECK-RESPONSE", - "name": "Verify user consent", - "next": { - "1": "NOTIFY-SUCCESS", - "2": "ALL-COUNTERS-RESET", - "default": "CHECK" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.message.content.text" - } - } - } - }, - { - "id": "CHECK-PROCEED-LENGTH", - "name": "Verify if a check proceed message exists", - "next": { - "0": "EXIT-INACTIVE", - "default": "CHECK-PROCEED" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.check_timeout_len" - } - } - } - }, - { - "id": "CHECK-PROCEED", - "name": "If user did not respond, check if he wants to continue", - "next": "CHECK-PROCEED-TIMEOUT", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "$js": "({bag}) => bag.settings.values.check_timeout_messages[bag.check_timeout_counter]" - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.mobile_phone" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SELECT_OPTION", - "timeout": 3600 - } - }, - { - "id": "CHECK-PROCEED-TIMEOUT", - "name": "Verify user consent", - "next": { - "true": "CHECK-PROCEED-COUNTER", - "default": "CHECK-PROCEED-RESPONSE" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "CHECK-PROCEED-COUNTER", - "name": "Verify count", - "next": { - "true": "EXIT-INACTIVE", - "default": "CHECK-PROCEED-COUNTER-INCREASE" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.check_timeout_counter >= (bag.check_timeout_len - 1)" - } - } - } - }, - { - "id": "CHECK-PROCEED-RESPONSE", - "name": "Verify user consent", - "next": { - "1": "NOTIFY-SUCCESS", - "2": "EXIT-USER-DECISION", - "default": "CHECK-COUNTERS-RESET" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.payload.message.content.text" - } - } - } - }, - { - "id": "NOTIFY-SUCCESS", - "name": "Notify success", - "next": "UPDATE-PROFILE", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": { - "$ref": "bag.settings.values.success_messages" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.mobile_phone" - } - }, - "action": "NOTIFY_SUCCESS", - "timeout": 1 - } - }, - { - "id": "UPDATE-PROFILE", - "name": "Add key to profile", - "next": "START-UPDATE-POS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$js": "({bag}) => ({ ...bag.profile, [[bag.key]]: { value: bag.value, valid: false }})" - } - } - } - }, - { - "id": "START-UPDATE-POS", - "name": "Start process to update request", - "next": "RETURN", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "profile": { - "$ref": "bag.profile" - }, - "request_id": { - "$ref": "bag.request_id" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "updateRequestV3" - } - }, - { - "id": "EARLY-RETURN", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "SUCCESS-NOOP", - "profile": { - "$ref": "bag.profile" - } - } - } - }, - { - "id": "RETURN", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "SUCCESS", - "profile": { - "$ref": "bag.profile" - } - } - } - }, - { - "id": "EXIT-INACTIVE", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "FAIL-TIMEOUT", - "profile": { - "$ref": "bag.profile" - } - } - } - }, - { - "id": "EXIT-USER-DECISION", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "FAIL-QUIT", - "profile": { - "$ref": "bag.profile" - } - } - } - }, - { - "id": "EXIT-NO-MESSAGE", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "FAIL-SETTINGS", - "profile": { - "$ref": "bag.profile" - } - } - } - }, - { - "id": "EXIT-RESET", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "RESET-CLIENT", - "profile": { - "$ref": "bag.profile" - } - } - } - }, - { - "id": "EXIT-RETURN", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "RETURN-CLIENT", - "profile": { - "$ref": "bag.profile" - } - } - } - }, - { - "id": "EXIT-NEXT", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "NEXT-QUESTION", - "profile": { - "$ref": "bag.profile" - } - } - } - }, - { - "id": "EXIT-FINISH", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "FINISH-PROCESS", - "profile": { - "$ref": "bag.profile" - } - } - } - } - ], - "prepare": [], - "environment": { - "XPTO": "BOTAUTHOR", - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/history.json b/samples/blueprints/approva/history.json deleted file mode 100644 index 0e8b7691..00000000 --- a/samples/blueprints/approva/history.json +++ /dev/null @@ -1,394 +0,0 @@ -{ - "name": "history", - "description": "Fluxo de visualização do histórico", - "blueprint_spec": { - "lanes": [ - { - "id": "L", - "name": "LoggedUser", - "rule": { - "$js": "({actor_data} => actor_data.claims.includes('useApp'))" - } - }, - { - "id": "U", - "name": "Usuario Final", - "rule": { - "$js": "({actor_data, bag} => actor_data.claims.includes('useApp') && actor_data.actor_id === bag.actor_id" - } - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start home workflow ", - "next": "SB5", - "type": "Start", - "lane_id": "L", - "parameters": { - "type": "object", - "input_schema": { - "required": [ - "offset", - "limit" - ], - "properties": { - "limit": { - "type": "integer" - }, - "offset": { - "type": "integer" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "SB5", - "name": "Set ActorId To Bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "ST1", - "name": "Get user profile", - "next": "SB1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?actor_id=eq.{{actor_data.actor_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set profile to Bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST2", - "name": "Get user history properties", - "next": "SB3", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects?list_type=history&limit={{bag.limit}}&offset={{bag.offset}}&profile_id={{bag.profile.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB3", - "name": "Set properties_projects to Bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "properties_projects": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U1", - "name": "User action with home", - "next": "F1", - "type": "UserTask", - "title": "Histórico de vizualização", - "lane_id": "U", - "parameters": { - "input": { - "profile": { - "$ref": "bag.profile" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "property_project_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "HISTORY_PROPERTIES_PROJECTS_LIST" - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "exit": "E", - "like": "SB4", - "return": "ST2", - "default": "SB2", - "details": "U3" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "U3", - "name": "Get Propertie Project details", - "next": "F3", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "profile": { - "$ref": "bag.profile" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "property_project_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "PROPERTY_PROJECT_DETAIL" - } - }, - { - "id": "F3", - "name": "Check action", - "next": { - "like": "SB4", - "return": "ST2", - "default": "E" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "SB4", - "name": "Set properties_project id to Bag", - "next": "ST3", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "liked_propertie_project": { - "$ref": "result.activities[0].data.property_project_id" - } - } - } - }, - { - "id": "ST3", - "name": "Like propertie_project", - "next": "ST4", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - }, - "properties_projects_id": { - "$ref": "bag.liked_propertie_project" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/like" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "ST4", - "name": "User has a match?", - "next": "F2", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - }, - "property_project_id": { - "$ref": "bag.liked_propertie_project" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/match" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F2", - "name": "Check match result", - "next": { - "true": "U2", - "default": "U1" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U2", - "name": "Get Match Information", - "next": "U1", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "image": "PeopleCelebrating", - "title": "Deu match!", - "subtitle": "Seu corretor recomenda", - "paragraph": "este empreendimento que você gostou!!", - "goBackLabel": "Ver mais empreendimentos", - "goNextLabel": "Falar com o corretor", - "activity_schema": { - "type": "object", - "required": [ - "ack" - ], - "properties": { - "ack": { - "type": "boolean" - } - }, - "additionalProperties": false - } - }, - "action": "MATCH" - } - }, - { - "id": "SB2", - "name": "Set offset to bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "offset": { - "$js": "({bag}) => bag.offset + bag.limit" - } - } - } - }, - { - "id": "E", - "name": "Finish History", - "next": null, - "type": "Finish", - "lane_id": "U" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/home.json b/samples/blueprints/approva/home.json deleted file mode 100644 index eb020d45..00000000 --- a/samples/blueprints/approva/home.json +++ /dev/null @@ -1,886 +0,0 @@ -{ - "name": "home", - "description": "Fluxo de home do usuário", - "blueprint_spec": { - "lanes": [ - { - "id": "L", - "name": "LoggedUser", - "rule": { - "$js": "({actor_data})=> actor_data.claims.includes('useApp')" - } - }, - { - "id": "U", - "name": "Usuario Final", - "rule": { - "$js": "({actor_data, bag})=> bag.actor_id === actor_data.actor_id" - } - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start home workflow ", - "next": "SB5", - "type": "Start", - "lane_id": "L", - "parameters": { - "type": "object", - "input_schema": { - "required": [ - "offset", - "limit" - ], - "properties": { - "limit": { - "type": "integer" - }, - "offset": { - "type": "integer" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "SB5", - "name": "Set ActorId To Bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "ST1", - "name": "Get user profile", - "next": "SB1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?actor_id=eq.{{actor_data.actor_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set profile to Bag", - "next": "ST10", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST10", - "name": "Get Realtor number", - "next": "SB6", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/realtor" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "SB6", - "name": "Set realtor number to Bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "realtor_number": { - "$ref": "result.data.realtor_number" - } - } - } - }, - { - "id": "ST2", - "name": "Get user home properties", - "next": "SB3", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects?list_type=home&limit={{bag.limit}}&offset={{bag.offset}}&profile_id={{bag.profile.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST2-1", - "name": "Get user home properties", - "next": "SB3-1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects?list_type=home&limit={{bag.limit}}&offset={{bag.offset}}&profile_id={{bag.profile.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB3-1", - "name": "Set properties_projects to Bag", - "next": "U3", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "properties_projects": { - "$ref": "result.data" - } - } - } - }, - { - "id": "SB3", - "name": "Set properties_projects to Bag", - "next": "ST6", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "properties_projects": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST6", - "name": "Check access home", - "next": "U1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/access_home_count/{{ bag.profile.mobile_phone }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "U1", - "name": "User action with home", - "next": "F1", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "profile": { - "$ref": "bag.profile" - }, - "realtor_number": { - "$ref": "bag.realtor_number" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "message": { - "type": "string" - }, - "property_project_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "PROPERTIES_PROJECTS_LIST", - "timeout": 3600 - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "chat": "SB7", - "exit": "E", - "like": "SB4", - "return": "ST2", - "default": "SB2", - "details": "ST9", - "undefined": "E" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "SB7", - "name": "Set message to bag", - "next": "ST11", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "ST11", - "name": "Get chat", - "next": "F4", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/chats?request_id=eq.{{bag.profile.current_request_id}}&chat_type=eq.REALTOR" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F4", - "name": "Check if chat already exists", - "next": { - "false": "ST12", - "default": "SB9" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$js": "({result}) => (result.data.length == 0) ? false : true" - } - } - } - }, - { - "id": "ST12", - "name": "Create Chat", - "next": "SB8", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "chat_type": "REALTOR", - "request_id": { - "$ref": "bag.profile.current_request_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/chat" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB8", - "name": "Set chat_id to bag", - "next": "ST13", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "chat_id": { - "$ref": "result.data.id" - } - } - } - }, - { - "id": "SB9", - "name": "Set chat_id to bag", - "next": "ST13", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "chat_id": { - "$ref": "result.data[0].id" - } - } - } - }, - { - "id": "ST13", - "name": "Send Message to Realtor", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "message": { - "$ref": "bag.message" - }, - "destiny_phone": { - "$ref": "bag.realtor_numbers" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/chat" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST9", - "name": "Insert Property Project into History", - "next": "U3", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - }, - "property_project_id": { - "$ref": "result.activities[0].data.property_project_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/history" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "U3", - "name": "Get Propertie Project details", - "next": "F3", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "profile": { - "$ref": "bag.profile" - }, - "realtor_number": { - "$ref": "bag.realtor_number" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "message": { - "type": "string" - }, - "property_project_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "PROPERTY_PROJECT_DETAIL", - "timeout": 3600 - } - }, - { - "id": "F3", - "name": "Check action", - "next": { - "chat": "SB7", - "like": "SB4-1", - "return": "ST2", - "default": "E", - "undefined": "E" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "SB4-1", - "name": "Set properties_project id to Bag", - "next": "ST3-1", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "liked_propertie_project": { - "$ref": "result.activities[0].data.property_project_id" - } - } - } - }, - { - "id": "ST3-1", - "name": "Like propertie_project", - "next": "ST4-1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - }, - "properties_projects_id": { - "$ref": "bag.liked_propertie_project" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/like" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "ST4-1", - "name": "User has a match?", - "next": "F2-1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - }, - "property_project_id": { - "$ref": "bag.liked_propertie_project" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/match" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F2-1", - "name": "Check match result", - "next": { - "true": "ST5-1", - "default": "ST2-1" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST5-1", - "name": "Get match property project", - "next": "U2-1", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/properties_projects?id=eq.{{bag.liked_propertie_project}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U2-1", - "name": "Get Match Information", - "next": "F1", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "image": "PeopleCelebrating", - "title": "Deu match!", - "subtitle": "Seu corretor recomenda", - "paragraph": "este empreendimento que você gostou!!", - "goBackLabel": "Ver mais empreendimentos", - "goNextLabel": "Falar com o corretor", - "realtor_number": { - "$ref": "bag.realtor_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "action": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "additionalProperties": false - }, - "property_project": { - "$ref": "result.data[0]" - } - }, - "action": "MATCH" - } - }, - { - "id": "SB4", - "name": "Set properties_project id to Bag", - "next": "ST3", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "liked_propertie_project": { - "$ref": "result.activities[0].data.property_project_id" - } - } - } - }, - { - "id": "ST3", - "name": "Like propertie_project", - "next": "ST4", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - }, - "properties_projects_id": { - "$ref": "bag.liked_propertie_project" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/like" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "ST4", - "name": "User has a match?", - "next": "F2", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.profile.id" - }, - "property_project_id": { - "$ref": "bag.liked_propertie_project" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/match" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F2", - "name": "Check match result", - "next": { - "true": "ST5", - "default": "ST2" - }, - "type": "Flow", - "lane_id": "U", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST5", - "name": "Get user profile", - "next": "U2", - "type": "SystemTask", - "lane_id": "U", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/properties_projects?id=eq.{{bag.liked_propertie_project}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U2", - "name": "Get Match Information", - "next": "F1", - "type": "UserTask", - "lane_id": "U", - "parameters": { - "input": { - "image": "PeopleCelebrating", - "title": "Deu match!", - "subtitle": "Seu corretor recomenda", - "paragraph": "este empreendimento que você gostou!!", - "goBackLabel": "Ver mais empreendimentos", - "goNextLabel": "Falar com o corretor", - "realtor_number": { - "$ref": "bag.realtor_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "action": { - "type": "string" - }, - "message": { - "type": "string" - } - }, - "additionalProperties": false - }, - "property_project": { - "$ref": "result.data[0]" - } - }, - "action": "MATCH" - } - }, - { - "id": "SB2", - "name": "Set offset to bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "U", - "category": "SetToBag", - "parameters": { - "input": { - "offset": { - "$js": "({bag}) => bag.offset + bag.limit" - } - } - } - }, - { - "id": "E", - "name": "Finish Home", - "next": null, - "type": "Finish", - "lane_id": "U" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/metaCRUD.json b/samples/blueprints/approva/metaCRUD.json deleted file mode 100644 index 6d9ad780..00000000 --- a/samples/blueprints/approva/metaCRUD.json +++ /dev/null @@ -1,821 +0,0 @@ -{ - "name": "metaCRUD", - "description": "Fluxo para cadastro genérico", - "blueprint_spec": { - "lanes": [ - { - "id": "GENERAL", - "name": "General access", - "rule": { - "$js": "({actor_data, bag}) => ((actor_data.claims).includes('admin') || (actor_data.claims).includes('create') || (actor_data.claims).includes('list') || (actor_data.claims).includes('read') || (actor_data.claims).includes('update') || (actor_data.claims).includes('delete'))" - } - }, - { - "id": "LIST", - "name": "List", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('list')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "CREATE", - "name": "Create", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('create')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "READ", - "name": "Read", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('read')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "UPDATE", - "name": "Update", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('update')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "DELETE", - "name": "Delete", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('delete')) && actor_data.actor_id == bag.actor_id)" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start meta CRUD", - "next": "GET-DEV-CONTRACTS", - "type": "Start", - "lane_id": "GENERAL", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "intent", - "key" - ], - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "intent": { - "type": "string" - }, - "filters": { - "type": "object" - } - } - } - } - }, - { - "id": "GET-DEV-CONTRACTS", - "name": "Get dev_contracts", - "next": "SET-DEV-CONTRACTS-TO-BAG", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.{{bag.key}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-DEV-CONTRACTS-TO-BAG", - "name": "Set dev_contracts object to bag", - "next": "VALIDATE-INPUT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "data": { - "$js": "({bag}) => bag.data ? bag.data : {}" - }, - "schema": { - "$ref": "result.data[0].value" - }, - "filters": { - "$js": "({bag}) => bag.filters ? bag.filters : {}" - }, - "key_url": { - "$js": "({bag}) => {return (bag.key).substring(9,(bag.key.length))}" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "VALIDATE-INPUT", - "name": "Validate input", - "next": "CHECK-INPUT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "data": { - "$ref": "bag.data" - }, - "intent": { - "$ref": "bag.intent" - }, - "filters": { - "$ref": "bag.filters" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/validate/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CHECK-INPUT", - "name": "Check input", - "next": { - "VALID": "SET-QUERYS-TO-BAG", - "default": "FINISH-DEV-CONTRACTS" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "SET-QUERYS-TO-BAG", - "name": "Set url to bag", - "next": "CHECK-QUERYS", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "query_id": { - "key": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'construction_companies' : bag.key_url == 'typologies' ? 'properties_projects' : bag.key_url == 'simulators_params' ? 'properties_projects' : bag.key_url == 'proposals' ? 'units' : null" - } - }, - "query_column": { - "key": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'company_name' : bag.key_url == 'typologies' ? 'title' : bag.key_url == 'simulators_params' ? 'title' : bag.key_url == 'proposals' ? 'unit_code' : null" - } - } - } - } - }, - { - "id": "CHECK-QUERYS", - "name": "Check query_id and column", - "next": { - "true": "GET-IDS", - "default": "CHECK-INTENT" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !!bag.query_id.key && !!bag.query_column.key" - } - } - } - }, - { - "id": "GET-IDS", - "name": "Get ids", - "next": "SET-IDS-TO-BAG", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/{{bag.query_id.key}}?select=id,{{bag.query_column.key}}&order=created_at.asc" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-IDS-TO-BAG", - "name": "Set ids to bag", - "next": "CHECK-INTENT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "type": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'string' : bag.key_url == 'typologies' ? 'string' : bag.key_url == 'simulators_params' ? 'string' : bag.key_url == 'proposals' ? 'string' : null" - }, - "title": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'Nome do Incorporador' : bag.key_url == 'typologies' ? 'Código do Empreendimento' : bag.key_url == 'simulators_params' ? 'Código do Empreendimento' : bag.key_url == 'proposals' ? 'Código da Unidade' : null" - }, - "query_id": { - "$js": "({bag, result}) => { const d = {...bag.query_id, ids: (result.data).map(obj => obj.id)}; d.ids.push(''); return d; }" - }, - "object_name": { - "$js": "({bag}) => bag.key_url == 'properties_projects' ? 'construction_company_id' : bag.key_url == 'typologies' ? 'properties_projects_id' : bag.key_url == 'simulators_params' ? 'properties_projects_id' : bag.key_url == 'proposals' ? 'unit_id' : null" - }, - "query_column": { - "$js": "({bag,result}) => { const d = {...bag.query_column, column_data: (result.data).map(obj => obj[bag.query_column.key])}; d.column_data.push(''); return d; }" - } - } - } - }, - { - "id": "CHECK-INTENT", - "name": "Check intent", - "next": { - "LIST": "GET-DATA-TO-LIST", - "READ": "READ", - "CREATE": "CREATE", - "DELETE": "DELETE", - "UPDATE": "GET-DATA-TO-UPDATE", - "default": "NOTIFY-INTENT-NOT-FOUND" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$ref": "bag.intent" - } - } - } - }, - { - "id": "GET-DATA-TO-LIST", - "name": "List", - "next": "SHOW-DATA-TO-LIST", - "type": "SystemTask", - "lane_id": "LIST", - "category": "HTTP", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - }, - "filters": { - "$ref": "bag.filters" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SHOW-DATA-TO-LIST", - "name": "Send data to list", - "next": "CHECK-TIMEOUT-LIST", - "type": "UserTask", - "lane_id": "LIST", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "list": { - "$js": "({result}) => result.data?.result ? result.data.result : []" - }, - "limit": { - "$ref": "bag.filters.limit" - }, - "intent": { - "$ref": "bag.intent" - }, - "offset": { - "$ref": "bag.filters.offset" - }, - "total_items": { - "$js": "({result}) => result.data?.count ? result.data.count : 0" - }, - "activity_schema": { - "$ref": "bag.schema.LIST" - } - }, - "action": "LIST", - "timeout": 3600 - } - }, - { - "id": "CHECK-TIMEOUT-LIST", - "name": "Check timeout", - "next": { - "true": "FINISH-LIST", - "default": "SET-OFFSET-LIMIT-TO-BAG" - }, - "type": "Flow", - "lane_id": "LIST", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "SET-OFFSET-LIMIT-TO-BAG", - "name": "Set value offset and limit to bag", - "next": "GET-DATA-TO-LIST", - "type": "SystemTask", - "lane_id": "LIST", - "category": "SetToBag", - "parameters": { - "input": { - "filters": { - "$js": "({result}) => result.activities[0]?.data?.filters ? result.activities[0].data.filters : {}" - } - } - } - }, - { - "id": "CREATE", - "name": "Create", - "next": "SUBMIT-CREATE", - "type": "UserTask", - "lane_id": "CREATE", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - }, - "form_data": { - "$ref": "bag.schema.CREATE.form_data" - }, - "ui_schema": { - "$ref": "bag.schema.CREATE.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => (bag.object_name ? {...bag.schema?.CREATE?.activity_schema, properties: {...bag.schema?.CREATE?.activity_schema?.properties, [bag.object_name]: {enum: bag.query_id.ids, enumNames: bag.query_column.column_data, title: bag.title, type: bag.type}}} : bag.schema?.CREATE?.activity_schema)" - } - }, - "action": "CREATE", - "timeout": 3600 - } - }, - { - "id": "SUBMIT-CREATE", - "name": "Create", - "next": "NOTIFY-CREATE", - "type": "SystemTask", - "lane_id": "CREATE", - "category": "HTTP", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "data": { - "$ref": "result.activities[0].data.form_data" - }, - "intent": { - "$ref": "bag.intent" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-CREATE", - "name": "Notify create", - "next": "FINISH-CREATE", - "type": "UserTask", - "lane_id": "CREATE", - "parameters": { - "input": { - "message": "{{bag.key_url}} created.", - "toggleModal": true - }, - "action": "NOTIFY_CREATE", - "timeout": 1 - } - }, - { - "id": "READ", - "name": "Read", - "next": "SEND-DATA-TO-READ", - "type": "SystemTask", - "lane_id": "READ", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SEND-DATA-TO-READ", - "name": "Send data to read", - "next": "FINISH-READ", - "type": "UserTask", - "lane_id": "READ", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - }, - "form_data": { - "$ref": "result.data" - }, - "ui_schema": { - "$ref": "bag.schema.READ.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => (bag.object_name ? {...bag.schema?.READ?.activity_schema, properties: {...bag.schema?.READ?.activity_schema.properties, [bag.object_name]: {enum: bag.query_id.ids, enumNames: bag.query_column.column_data, title: bag.title, type: bag.type}}} : bag.schema?.READ?.activity_schema)" - } - }, - "action": "READ", - "timeout": 3600 - } - }, - { - "id": "GET-DATA-TO-UPDATE", - "name": "Get data to update", - "next": "SEND-DATA-TO-UPDATE", - "type": "SystemTask", - "lane_id": "UPDATE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/{{bag.key_url}}?id=eq.{{bag.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SEND-DATA-TO-UPDATE", - "name": "Send data to update", - "next": "CHECK-TIMEOUT-UPDATE", - "type": "UserTask", - "lane_id": "UPDATE", - "parameters": { - "input": { - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - }, - "form_data": { - "$ref": "result.data[0]" - }, - "ui_schema": { - "$ref": "bag.schema.UPDATE.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => (bag.object_name ? {...bag.schema?.UPDATE?.activity_schema, properties: {...bag.schema?.UPDATE?.activity_schema?.properties, [bag.object_name]: {enum: bag.query_id.ids, enumNames: bag.query_column.column_data, title: bag.title, type: bag.type}}} : bag.schema?.UPDATE?.activity_schema)" - } - }, - "action": "UPDATE", - "timeout": 3600 - } - }, - { - "id": "CHECK-TIMEOUT-UPDATE", - "name": "Check timeout", - "next": { - "true": "FINISH-UPDATE", - "default": "UPDATE" - }, - "type": "Flow", - "lane_id": "UPDATE", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "UPDATE", - "name": "Update", - "next": "NOTIFY-UPDATE", - "type": "SystemTask", - "lane_id": "UPDATE", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "data": { - "$ref": "result.activities[0].data.form_data" - }, - "intent": { - "$ref": "bag.intent" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-UPDATE", - "name": "Notify update", - "next": "FINISH-UPDATE", - "type": "UserTask", - "lane_id": "UPDATE", - "parameters": { - "input": { - "message": "{{bag.key_url}} updated.", - "toggleModal": true - }, - "action": "NOTIFY_UPDATE", - "timeout": 1 - } - }, - { - "id": "DELETE", - "name": "Delete", - "next": "NOTIFY-DELETE", - "type": "SystemTask", - "lane_id": "DELETE", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "key": { - "$ref": "bag.key" - }, - "intent": { - "$ref": "bag.intent" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/meta_crud" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-DELETE", - "name": "Notify delete", - "next": "FINISH-DELETE", - "type": "UserTask", - "lane_id": "DELETE", - "parameters": { - "input": { - "message": { - "$ref": "{{bag.key_url}} deleted." - }, - "toggleModal": true - }, - "action": "NOTIFY_DELETE", - "timeout": 1 - } - }, - { - "id": "NOTIFY-INTENT-NOT-FOUND", - "name": "Notify intent not found", - "next": "FINISH-INTENT-NOT-FOUND", - "type": "UserTask", - "lane_id": "GENERAL", - "parameters": { - "input": { - "message": "{{bag.key_url}} intent not found.", - "toggleModal": true - }, - "action": "NOTIFY-INTENT-NOT-FOUND", - "timeout": 1 - } - }, - { - "id": "FINISH-LIST", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "LIST" - }, - { - "id": "FINISH-CREATE", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "CREATE" - }, - { - "id": "FINISH-UPDATE", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "UPDATE" - }, - { - "id": "FINISH-NO-LOCK", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "UPDATE" - }, - { - "id": "FINISH-DELETE", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "DELETE" - }, - { - "id": "FINISH-READ", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "READ" - }, - { - "id": "FINISH-DEV-CONTRACTS", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "GENERAL" - }, - { - "id": "FINISH-INTENT-NOT-FOUND", - "name": "Finish metaCRUD", - "next": null, - "type": "Finish", - "lane_id": "GENERAL" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/new_request.json b/samples/blueprints/approva/new_request.json deleted file mode 100644 index 851ad29b..00000000 --- a/samples/blueprints/approva/new_request.json +++ /dev/null @@ -1,11331 +0,0 @@ -{ - "name": "new_request", - "description": "Fluxo único de request 2.0", - "blueprint_spec": { - "lanes": [ - { - "id": "BOT_X_BACKOFFICE", - "name": "BOT_X_BACKOFFICE", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "or", - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "or", - [ - "=", - "v", - [ - "`", - "adminRequests" - ] - ], - [ - "=", - "v", - [ - "`", - "botGeneral" - ] - ], - [ - "=", - "v", - [ - "`", - "botRealtor" - ] - ], - [ - "=", - "v", - [ - "`", - "botLead" - ] - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - ] - }, - { - "id": "B", - "name": "BackOffice", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "adminRequests" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start Request Workflow", - "next": "PARTY-NUMBER-CHECK-1", - "type": "Start", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "party_number" - ], - "properties": { - "requested": { - "type": "boolean" - }, - "party_number": { - "type": "string" - }, - "realtor_number": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "PARTY-NUMBER-CHECK-1", - "name": "Check if the party number length has 12 characters or 13 and put the number 9 if is necessary.", - "next": "PARTY-NUMBER-CHECK-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/validate-whatsapp/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "PARTY-NUMBER-CHECK-2", - "name": "Set whatsapp validation to party number", - "next": "ST21-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "party_number": { - "$ref": "result.data.mobile_phone" - } - } - } - }, - { - "id": "ST21-L", - "name": "get chat or create if not exist", - "next": "FLOW-CHAT", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat_by_buyer_mobile_phone/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "FLOW-CHAT", - "name": "Check if profile is an Realtor after check phone_number.", - "next": { - "REALTOR": "ST22-L", - "default": "SB10-G" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.data.role" - } - } - } - }, - { - "id": "SB10-G", - "name": "Set chat_id and chat_participant_id (buyer)", - "next": "SB12-G", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "chat_id": { - "$ref": "result.data.chat_id" - }, - "buyer_chat_participant_id": { - "$ref": "result.data.buyer_chat_participant_id" - } - } - } - }, - { - "id": "SB12-G", - "name": "get chat details and messages by chat ID.", - "next": "SB13-G", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB13-G", - "name": "Save messages history to bag.", - "next": "ST22-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "ST22-L", - "name": "get bot phone number", - "next": "SB11-G", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/bot-phone-number" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB11-G", - "name": "Set bot phone number to bag.", - "next": "ST4-G", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "bot_phone_number": { - "$ref": "result.data.bot_phone_number" - } - } - } - }, - { - "id": "ST4-G", - "name": "Get account settings", - "next": "SB2-G", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB2-G", - "name": "Save default claims to bag, account_id and files phrases", - "next": "F1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "account_id": { - "$ref": "result.data[0].id" - }, - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "F1", - "name": "Check how process started", - "next": { - "true": "OLD-BUYER", - "default": "U1-G" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.requested" - } - } - } - }, - { - "id": "U1-G", - "name": "Capturing first message content", - "next": "SB8-G", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_FIRST_MESSAGE" - } - }, - { - "id": "SB8-G", - "name": "Set number to bag", - "next": "ST21-G", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_number": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "ST21-G", - "name": "Validate Phone Number", - "next": "SB9-G", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.buyer_number}}/phone-number-validator" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB9-G", - "name": "Check first message response", - "next": "ST18-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "is_phone_number": { - "$ref": "result.data.is_valid" - } - } - } - }, - { - "id": "ST18-L", - "name": "Get Profile", - "next": "F10-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F10-L", - "name": "Check if profile is an Realtor after check phone_number.", - "next": { - "REALTOR": "F4", - "default": "ST19-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.data.role" - } - } - } - }, - { - "id": "F4", - "name": "Check if first message content is a telephone number", - "next": { - "true": "ST16-R", - "default": "U16-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.is_phone_number" - } - } - } - }, - { - "id": "U16-L", - "name": "Notify realtor", - "next": "EXIT-REALTOR-INVALID-PHONE-NUMBER", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Olá Corretor, para que eu possa te ajudar, preciso que você envie um número de um cliente para eu entrar em contato. O número deve ser enviado nesse formato XXXXXXXXXXX , sendo 2 dígitos do ddd e 9 do número. Ex: 21999998888. Obrigada! =)", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_REALTOR_SHOULD_SEND_CLIENT_TELEPHONE", - "timeout": 1 - } - }, - { - "id": "EXIT-REALTOR-INVALID-PHONE-NUMBER", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE" - }, - { - "id": "ST19-L", - "name": "Get request", - "next": "ST19-L-A1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/requests?id=eq.{{result.data.current_request_id}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "ST19-L-A1", - "name": "Set request to bag", - "next": "F8-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "F8-L", - "name": "User already has an approved request?", - "next": { - "default": "OLD-BUYER", - "APPROVED": "EXIT-REQUEST-APPROVED", - "DOCUMENTS_RECEIVED": "U15-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.request.status" - } - } - } - }, - { - "id": "U14-L", - "name": "Notify user his last request was approved", - "next": "ST36-L", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: *Parabéns*! SEU crédito foi *APROVADO*!!\nJá pode preparar a Festa! 🎉\n\nMuito em breve um de nossos colaboradores irá entrar em contato com você, ok?\n\nPara visualizar as opções de empreendimentos que selecionamos para você é só baixar o APP Approva Fácil através do link\nhttps://play.google.com/store/apps/details?id=com.aprovafacil\nOBS:Caso esteja com o APP instalado no celular e aberto, por favor, feche e abra novamente", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_REQUEST_ALREADY_APPROVED", - "timeout": 1 - } - }, - { - "id": "ST36-L", - "name": "Save message on entity message from NOTIFY_REQUEST_ALREADY_APPROVED.", - "next": "ST40-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: *Parabéns*! SEU crédito foi *APROVADO*!!\nJá pode preparar a Festa! 🎉\n\nMuito em breve um de nossos colaboradores irá entrar em contato com você, ok?\n\nPara visualizar as opções de empreendimentos que selecionamos para você é só baixar o APP Approva Fácil através do link\nhttps://play.google.com/store/apps/details?id=com.aprovafacil\nOBS:Caso esteja com o APP instalado no celular e aberto, por favor, feche e abra novamente", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "ST40-L", - "name": "get chat details and messages by chat ID.", - "next": "SB15-G", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB15-G", - "name": "Save messages history to bag.", - "next": "EXIT-REQUEST-APPROVED", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "EXIT-REQUEST-APPROVED", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE" - }, - { - "id": "U15-L", - "name": "Notify user his documents are under analysis", - "next": "ST23-L", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Falta pouco! Nossa equipe está realizando o processo de análise da sua carta de crédito, logo mais enviaremos o resultado.", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_DOCUMENTS_UNDER_ANALYSIS", - "timeout": 1 - } - }, - { - "id": "ST23-L", - "name": "Save message on entity message from NOTIFY_DOCUMENTS_UNDER_ANALYSIS.", - "next": "ST41-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Falta pouco! Nossa equipe está realizando o processo de análise da sua carta de crédito, logo mais enviaremos o resultado.", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "ST41-L", - "name": "get chat details and messages by chat ID.", - "next": "SB13-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB13-L", - "name": "Save messages history to bag.", - "next": "EXIT-DOCUMENTS-ANALYSIS", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "EXIT-DOCUMENTS-ANALYSIS", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE" - }, - { - "id": "ST16-R", - "name": "Check if Realtor is able to contact with this lead.", - "next": "ST16-R-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "buyer_number": { - "$mustache": "55{{bag.buyer_number}}" - }, - "realtor_number": { - "$ref": "bag.party_number" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/checkPreviousRealtor" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST16-R-2", - "name": "Set request to bag", - "next": "REALTOR-NOTIFY-CLIENT", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "order": { - "$ref": "result.data" - } - } - } - }, - { - "id": "REALTOR-NOTIFY-CLIENT", - "name": "Map request status", - "next": "F7-R", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "request_status": { - "$js": "({bag}) => bag.order.request_status === 'AWAITING_DOCUMENTS' ? 'Enviando Documentos' : bag.order.request_status === 'DOCUMENTS_RECEIVED' ? 'Documentos Enviados' : bag.order.request_status === 'APPROVED' ? 'Aprovado' : bag.order.request_status === 'DOCUMENTS_ANALYSIS' ? 'Documentos em Análise' : bag.order.request_status === 'CLOSED' ? 'Cancelado' : bag.order.request_status === 'REJECTED' ? 'Reprovado' : bag.order.request_status === 'DOCUMENTS_REJECTED' ? 'Documentos Rejeitados' : bag.order.request_status === 'DOCUMENTS_APPROVED' ? 'Documentos Aprovados' : 'Status Não Encontrado'" - } - } - } - }, - { - "id": "F7-R", - "name": "Is realtor able to create request for client?", - "next": { - "CLOSED": "REALTOR-NOTIFY-CLIENT-3", - "default": "REALTOR-REQUEST-APPROVED-2-A-1", - "APPROVED": "REALTOR-REQUEST-APPROVED-1", - "NOT_ABLE": "REALTOR-NOTIFY-CLIENT-2", - "REJECTED": "REALTOR-NOTIFY-CLIENT-3", - "AWAITING_DOCUMENTS": "REALTOR-NOTIFY-CLIENT-1", - "DOCUMENTS_ANALYSIS": "REALTOR-NOTIFY-CLIENT-1", - "DOCUMENTS_APPROVED": "REALTOR-NOTIFY-CLIENT-1", - "DOCUMENTS_RECEIVED": "REALTOR-NOTIFY-CLIENT-1", - "DOCUMENTS_REJECTED": "REALTOR-NOTIFY-CLIENT-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.order.request_status" - } - } - } - }, - { - "id": "REALTOR-NOTIFY-CLIENT-1", - "name": "Notify request status", - "next": "EXIT-NOTIFY-LEAD", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Não é possível prosseguir com a solicitação, pois o cliente informado já possui uma solicitação de crédito em andamento na fase de *{{bag.request_status}}*. Por favor, informe outro número ou entre em contato com o administrador." - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_LEAD", - "timeout": 1 - } - }, - { - "id": "REALTOR-NOTIFY-CLIENT-2", - "name": "Notify lead as not able", - "next": "EXIT-LEAD-INVALID", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Não é possível prosseguir com a solicitação, pois o cliente informado já possui um corretor responsável por ele. Por favor, informe outro número ou entre em contato com o administrador.", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_LEAD", - "timeout": 1 - } - }, - { - "id": "REALTOR-NOTIFY-CLIENT-3", - "name": "Notify request status", - "next": "ST17-R", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: O cliente informado já possui uma solicitação de crédito com o status *{{bag.request_status}}*." - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_LEAD", - "timeout": 1 - } - }, - { - "id": "EXIT-LEAD-INVALID", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE" - }, - { - "id": "ST17-R", - "name": "Start new request workflow ", - "next": "U13-R", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "startProcess", - "parameters": { - "input": { - "requested": true, - "party_number": { - "$mustache": "55{{bag.buyer_number}}" - }, - "realtor_number": { - "$ref": "bag.party_number" - } - }, - "timeout": 1, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "new_request" - } - }, - { - "id": "U13-R", - "name": "Notify contacting lead", - "next": "EXIT-NOTIFY-LEAD", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Beleza. Vou notificar o cliente e iniciar um novo fluxo de análise de crédito.", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_CONTACTING_LEAD", - "timeout": 1 - } - }, - { - "id": "EXIT-NOTIFY-LEAD", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE" - }, - { - "id": "REALTOR-REQUEST-APPROVED-1", - "name": "Notify request approved exist and make a question if is necessary reset.", - "next": "REALTOR-REQUEST-APPROVED-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: O cliente informado já possui um pedido *{{bag.request_status}}* com o crédito de *{{bag.order.request_credit_limit_formatted}}*.\nDeseja iniciar uma nova análise de crédito?\n1 - Sim. \n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "NOTIFY_REQUEST_RESET" - } - }, - { - "id": "REALTOR-REQUEST-APPROVED-2", - "name": "Check realtor answer.", - "next": { - "1": "REALTOR-REQUEST-APPROVED-2-A-1", - "2": "REALTOR-REQUEST-APPROVED-2-B-1", - "default": "REALTOR-REQUEST-APPROVED-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "REALTOR-REQUEST-APPROVED-2-A-1", - "name": "Set request status equal 'CLOSED' and set current resquest equal null", - "next": "ST17-R", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/reset/55{{bag.buyer_number}}/{{bag.order.request_id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "REALTOR-REQUEST-APPROVED-2-B-1", - "name": "Notify contacting lead", - "next": "EXIT-NOTIFY-LEAD", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Tudo bem, estarei aqui quando precisar.", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_REALTOR_EXIT", - "timeout": 1 - } - }, - { - "id": "OLD-BUYER", - "name": "Verify if profiles exists", - "next": "SC-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/verify/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SC-1", - "name": "Save user existence to bag.", - "next": "OLD-BUYER-A1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "profile_exist": { - "$ref": "result.data" - } - } - } - }, - { - "id": "OLD-BUYER-A1", - "name": "Check if profile exists", - "next": { - "true": "NEW-REQUEST", - "default": "OLD-BUYER-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.profile_exist" - } - } - } - }, - { - "id": "OLD-BUYER-1", - "name": "Save on table message the first message sent from buyer.", - "next": "OLD-BUYER-1-A1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.buyer_number" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "OLD-BUYER-1-A1", - "name": "get chat details and messages by chat ID.", - "next": "OLD-BUYER-1-A2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "OLD-BUYER-1-A2", - "name": "Save messages history to bag.", - "next": "OLD-BUYER-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "OLD-BUYER-2", - "name": "Get profile", - "next": "OLD-BUYER-2-A1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "OLD-BUYER-2-A1", - "name": "Save profile to bag.", - "next": "OLD-BUYER-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_profile": { - "$ref": "result.data" - } - } - } - }, - { - "id": "OLD-BUYER-3", - "name": "Welcome back to buyer", - "next": "OLD-BUYER-3-A1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Olha quem está aqui de novo! Estou feliz em te ver por aqui {{ bag.buyer_profile.nickname }}." - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "WELCOME_BACK", - "timeout": 1 - } - }, - { - "id": "OLD-BUYER-3-A1", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "OLD-BUYER-3-A2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Olha quem está aqui de novo! Estou feliz em te ver por aqui {{ bag.buyer_profile.nickname }}." - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "OLD-BUYER-3-A2", - "name": "get chat details and messages by chat ID.", - "next": "OLD-BUYER-3-A3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "OLD-BUYER-3-A3", - "name": "Save messages history to bag.", - "next": "OLD-BUYER-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "OLD-BUYER-4", - "name": "Capturing will to proceed", - "next": "OLD-BUYER-4-A1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Prazer {{bag.buyer_profile.nickname}}, vem comigo que vou te mostrar o jeito mais fácil de conquistar sua Casa Própria sem aquelas burocracias e filas chatas, sabe? Vamos lá? \n1 - Sim, vamos! \n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_WILL_TO_PROCEED" - } - }, - { - "id": "OLD-BUYER-4-A1", - "name": "Save user consent to bag.", - "next": "OLD-BUYER-4-A2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_consent": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "OLD-BUYER-4-A2", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "OLD-BUYER-4-A3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Prazer {{bag.buyer_profile.nickname}}, vem comigo que vou te mostrar o jeito mais fácil de conquistar sua Casa Própria sem aquelas burocracias e filas chatas, sabe? Vamos lá? \n1 - Sim, vamos! \n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "OLD-BUYER-4-A3", - "name": "get chat details and messages by chat ID.", - "next": "OLD-BUYER-4-A4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "OLD-BUYER-4-A4", - "name": "Save messages history to bag.", - "next": "OLD-BUYER-4-A5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "OLD-BUYER-4-A5", - "name": "Save on table message the user consent.", - "next": "OLD-BUYER-4-A6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_consent" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "OLD-BUYER-4-A6", - "name": "get chat details and messages by chat ID.", - "next": "OLD-BUYER-4-A7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "OLD-BUYER-4-A7", - "name": "Save messages history to bag.", - "next": "OLD-BUYER-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "OLD-BUYER-5", - "name": "Check user consent", - "next": { - "1": "OLD-BUYER-6", - "2": "NEW-REQUEST-5", - "default": "OLD-BUYER-4" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_consent" - } - } - } - }, - { - "id": "OLD-BUYER-6", - "name": "Check if buyer has current request", - "next": { - "null": "ST5-L", - "default": "RESET-REQUEST-OLD-BUYER" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.buyer_profile.current_request_id" - } - } - } - }, - { - "id": "RESET-REQUEST-OLD-BUYER", - "name": "Set request status equal 'CLOSED' and set current resquest equal null", - "next": "ST5-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/reset/{{bag.buyer_profile.mobile_phone}}/{{bag.buyer_profile.current_request_id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "NEW-REQUEST", - "name": "Save on table message the first message sent from buyer.", - "next": "NEW-REQUEST-A1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.buyer_number" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": null - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-A1", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-1", - "name": "Capturing client nickname", - "next": "NEW-REQUEST-1-A-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Olá! Eu sou a Bela, Assistente Virtual do Approva Fácil! 😊 Estou feliz em te ver por aqui! Me fala, *como posso te chamar*?", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_NICKNAME" - } - }, - { - "id": "NEW-REQUEST-1-A-1", - "name": "Set nickname to bag", - "next": "NEW-REQUEST-1-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "nickname": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "NEW-REQUEST-1-A-2", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-1-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Olá! Eu sou a Bela do Aprova Fácil! 😊 Estou feliz em te ver por aqui! Me fala, *como posso te chamar*?", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-1-A-3", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-1-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-1-A-4", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-1-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-1-A-5", - "name": "Save on table message the nickname receveid.", - "next": "NEW-REQUEST-1-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.nickname" - }, - "external_id": { - "$ref": null - }, - "chat_participant_id": { - "$ref": null - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-1-A-6", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-1-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-1-A-7", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-1-A-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-1-A-8", - "name": "Capturing confirm nickname", - "next": "NEW-REQUEST-1-A-9", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Você poderia me confirmar se seu *nome* está correto?\nNome: *{{bag.nickname}};*\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_CONFIRM_NICKNAME" - } - }, - { - "id": "NEW-REQUEST-1-A-9", - "name": "Save user name to bag.", - "next": "NEW-REQUEST-1-A-10", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_confirm_nickname": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "NEW-REQUEST-1-A-10", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-1-A-11", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Você poderia me confirmar se seu *nome* está correto?\nNome: *{{bag.nickname}};*\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-1-A-11", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-1-A-12", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-1-A-12", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-1-A-13", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-1-A-13", - "name": "Save name in table message.", - "next": "NEW-REQUEST-1-A-14", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_confirm_nickname" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-1-A-14", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-1-A-15", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-1-A-15", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-1-A-16", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-1-A-16", - "name": "Check if user confirm nickname", - "next": { - "1": "NEW-REQUEST-2", - "2": "NEW-REQUEST-1", - "default": "NEW-REQUEST-1-A-8" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_confirm_nickname" - } - } - } - }, - { - "id": "NEW-REQUEST-2", - "name": "Capturing will to proceed", - "next": "NEW-REQUEST-2-A-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Prazer {{bag.nickname}}, vem comigo que vou te mostrar o jeito mais fácil de conquistar sua Casa Própria sem aquelas burocracias e filas chatas, sabe? Vamos lá? \n1 - Sim, vamos! \n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_WILL_TO_PROCEED" - } - }, - { - "id": "NEW-REQUEST-2-A-1", - "name": "Save user consent to bag.", - "next": "NEW-REQUEST-2-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_consent": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "NEW-REQUEST-2-A-2", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-2-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Prazer {{bag.nickname}}, vem comigo que vou te mostrar o jeito mais fácil de conquistar sua Casa Própria sem aquelas burocracias e filas chatas, sabe? Vamos lá? \n1 - Sim, vamos! \n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-2-A-3", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-2-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-2-A-4", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-2-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-2-A-5", - "name": "Save on table message the user consent.", - "next": "NEW-REQUEST-2-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_consent" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": null - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-2-A-6", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-2-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-2-A-7", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-4", - "name": "Check user consent", - "next": { - "1": "NEW-REQUEST-6", - "2": "NEW-REQUEST-5", - "default": "NEW-REQUEST-2" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_consent" - } - } - } - }, - { - "id": "NEW-REQUEST-5", - "name": "Notify user has not given consent", - "next": "NEW-REQUEST-5-A-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Não tem problema! Estarei aqui quando você estiver pronto, ok? É só me chamar! 😊", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_USER_HAS_NOT_GIVEN_WILL_TO_PROCEED", - "timeout": 1 - } - }, - { - "id": "NEW-REQUEST-5-A-1", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-5-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Não tem problema! Estarei aqui quando você estiver pronto, ok? É só me chamar! 😊", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-5-A-2", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-5-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-5-A-3", - "name": "Save messages history to bag.", - "next": "EXIT-USER-DID-NOT-WANT-TO-PROCEED", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "EXIT-USER-DID-NOT-WANT-TO-PROCEED", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE" - }, - { - "id": "NEW-REQUEST-6", - "name": "Capturing client name", - "next": "NEW-REQUEST-6-A-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Eba! Legal! Conta comigo! Agora, me fala o *seu nome completo* (você já me conhece e agora é minha vez de te conhecer! 😊)", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_NAME" - } - }, - { - "id": "NEW-REQUEST-6-A-1", - "name": "Set name to bag", - "next": "NEW-REQUEST-6-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "name": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "NEW-REQUEST-6-A-2", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-6-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Eba! Legal! Conta comigo! Agora, me fala o *seu nome completo* (você já me conhece e agora é minha vez de te conhecer! 😊)", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-6-A-3", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-6-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-6-A-4", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-6-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-6-A-5", - "name": "Save on table message the name receveid.", - "next": "NEW-REQUEST-6-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.name" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": null - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-6-A-6", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-6-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-6-A-7", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-6-A-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-6-A-8", - "name": "Capturing confirm name", - "next": "NEW-REQUEST-6-A-9", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Você poderia me confirmar se seu nome completo está correto?\nNome completo: *{{bag.name}};*\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_CONFIRM_NAME" - } - }, - { - "id": "NEW-REQUEST-6-A-9", - "name": "Save user name to bag.", - "next": "NEW-REQUEST-6-A-10", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_confirm_name": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "NEW-REQUEST-6-A-10", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-6-A-11", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Você poderia me confirmar se seu nome completo está correto?\nNome completo: *{{bag.name}};*\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-6-A-11", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-6-A-12", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-6-A-12", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-6-A-13", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-6-A-13", - "name": "Save name in table message.", - "next": "NEW-REQUEST-6-A-14", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_confirm_name" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-6-A-14", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-6-A-15", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-6-A-15", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-6-A-16", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-6-A-16", - "name": "Check if user confirm name", - "next": { - "1": "NEW-REQUEST-10", - "2": "NEW-REQUEST-6", - "default": "NEW-REQUEST-6-A-8" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_confirm_name" - } - } - } - }, - { - "id": "NEW-REQUEST-10", - "name": "Capturing client email", - "next": "NEW-REQUEST-10-A-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Perfeito! Agora me fala seu *e-mail*, por favor?", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_EMAIL" - } - }, - { - "id": "NEW-REQUEST-10-A-1", - "name": "Set email to bag", - "next": "NEW-REQUEST-10-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "email": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "NEW-REQUEST-10-A-2", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-10-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Perfeito! Agora me fala seu *e-mail*, por favor?", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-10-A-3", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-10-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-10-A-4", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-10-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-10-A-5", - "name": "Save on table message the email receveid.", - "next": "NEW-REQUEST-10-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.email" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": null - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-10-A-6", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-10-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-10-A-7", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-10-A-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-10-A-8", - "name": "Capturing confirm email", - "next": "NEW-REQUEST-10-A-9", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Você poderia me confirmar se seu email está correto?\nE-mail: *{{bag.email}};*\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_CONFIRM_EMAIL" - } - }, - { - "id": "NEW-REQUEST-10-A-9", - "name": "Save user email to bag.", - "next": "NEW-REQUEST-10-A-10", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_confirm_email": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "NEW-REQUEST-10-A-10", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-10-A-11", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Você poderia me confirmar se seu email está correto?\nE-mail: *{{bag.email}};*\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir)." - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-10-A-11", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-10-A-12", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-10-A-12", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-10-A-13", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-10-A-13", - "name": "Save name in table message.", - "next": "NEW-REQUEST-10-A-14", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_confirm_email" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-10-A-14", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-10-A-15", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-10-A-15", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-10-A-16", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-10-A-16", - "name": "Check if user confirm email", - "next": { - "1": "ST1-L", - "2": "NEW-REQUEST-10", - "default": "NEW-REQUEST-10-A-7" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_confirm_email" - } - } - } - }, - { - "id": "NEW-REQUEST-12", - "name": "Capturing user information", - "next": "NEW-REQUEST-12-A1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Prontinho! Já anotei as suas informações aqui, agora vamos ao que interessa!" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "CAPTURING_INFORMATION", - "timeout": 1 - } - }, - { - "id": "NEW-REQUEST-12-A1", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-12-A2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Prontinho! Já anotei as suas informações aqui, agora vamos ao que interessa!" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-12-A2", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-12-A3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-12-A3", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-14-A2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-14-A2", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-14-A3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-14-A3", - "name": "Save messages history to bag.", - "next": "NEW-REQUEST-15", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "NEW-REQUEST-15", - "name": "Notify written information", - "next": "NEW-REQUEST-15-A1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Para você conquistar a Casa Própria precisamos primeiro aprovar o seu crédito. São apenas alguns documentos, ok? Mas pode ficar tranquilo, suas informações estarão seguras aqui, e muito antes do que você imagina te daremos um retorno do status da sua carta de crédito. 🤩", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_WRITTEN_INFORMATION_SECOND_PART", - "timeout": 1 - } - }, - { - "id": "NEW-REQUEST-15-A1", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "NEW-REQUEST-15-A2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Para você conquistar a Casa Própria precisamos primeiro aprovar o seu crédito. São apenas alguns documentos, ok? Mas pode ficar tranquilo, suas informações estarão seguras aqui, e muito antes do que você imagina te daremos um retorno do status da sua carta de crédito. 🤩", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "NEW-REQUEST-15-A2", - "name": "get chat details and messages by chat ID.", - "next": "NEW-REQUEST-15-A3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "NEW-REQUEST-15-A3", - "name": "Save messages history to bag.", - "next": "DOCUMENT-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "ST1-L", - "name": "Get Profile", - "next": "F5-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F5-L", - "name": "User already exists?", - "next": { - "true": "SB1-L", - "default": "ST2-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({result}) => (result.data.id) ? true : false" - } - } - } - }, - { - "id": "ST2-L", - "name": "Create actor", - "next": "ST3-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "CreateActorTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "claims": { - "$ref": "bag.default_claims" - }, - "account_id": { - "$ref": "bag.account_id" - } - } - } - }, - { - "id": "ST3-L", - "name": "Create profile", - "next": "SB1-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "email": { - "$ref": "bag.email" - }, - "actor_id": { - "$ref": "result.actor.id" - }, - "nickname": { - "$ref": "bag.nickname" - }, - "mobile_phone": { - "$ref": "bag.party_number" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/create" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB1-L", - "name": "Set party profile to bag", - "next": "ST5-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_profile": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST5-L", - "name": "Create Request", - "next": "SB3-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "buyer_profile_id": { - "$ref": "bag.buyer_profile.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB3-L", - "name": "Set request to bag", - "next": "ST6-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST6-L", - "name": "Assign Realtor to Request", - "next": "SB4-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "realtor_number": { - "$ref": "bag.realtor_number" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/assign" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB4-L", - "name": "Set buyer profile with new current_request to bag", - "next": "CHAT-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_profile": { - "$ref": "result.data" - } - } - } - }, - { - "id": "CHAT-1", - "name": "get chat or create if not exist", - "next": "SB1-L-A1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat_by_buyer_mobile_phone/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1-L-A1", - "name": "Associate profile to chat", - "next": "CHAT-1-A1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/associate_profile_to_chat/{{bag.party_number}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CHAT-1-A1", - "name": "get chat or create if not exist", - "next": "CHAT-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat_by_buyer_mobile_phone/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "CHAT-2", - "name": "Set chat_id and chat_participant_id (buyer)", - "next": "CHAT-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "chat_id": { - "$ref": "result.data.chat_id" - }, - "buyer_chat_participant_id": { - "$ref": "result.data.buyer_chat_participant_id" - }, - "realtor_chat_participant_id": { - "$ref": "result.data.realtor_chat_participant_id" - } - } - } - }, - { - "id": "CHAT-3", - "name": "get chat details and messages by chat ID.", - "next": "CHAT-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "CHAT-4", - "name": "Save messages history to bag.", - "next": "F5-L-A1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "F5-L-A1", - "name": "User already exists?", - "next": { - "true": "NEW-REQUEST-12", - "default": "NEW-REQUEST-14-A2" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.profile_exist" - } - } - } - }, - { - "id": "DOCUMENT-3", - "name": "Notify hints list", - "next": "DOCUMENT-4", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Dicas importantes: \n💡 Tire fotos em um lugar bem iluminado;\n💡 Nada de foto tremida, ein?!", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_HINTS_LIST", - "timeout": 1 - } - }, - { - "id": "DOCUMENT-4", - "name": "Save message on entity message from NOTIFY_HINTS_LIST", - "next": "DOCUMENT-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Dicas importantes: \n💡 Tire fotos em um lugar bem iluminado;\n💡 Nada de foto tremida, ein?!", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-5", - "name": "Notify send documents", - "next": "DOCUMENT-6", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_SEND_DOCUMENTS", - "timeout": 1 - } - }, - { - "id": "DOCUMENT-6", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-7", - "name": "Save messages history to bag.", - "next": "DOCUMENT-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-8", - "name": "Capturing CNH or RG.", - "next": "DOCUMENT-8-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Prontinho! Agora é sua vez! Primeiro, qual o documento de identificação você prefere me informar?\n1 - CNH;\n2 - RG.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_CNH_OR_RG" - } - }, - { - "id": "DOCUMENT-8-1", - "name": "Save user document chose to bag.", - "next": "DOCUMENT-8-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "files_phrases": [ - { - "order": 1, - "is_text": "false", - "message": "Bela: Beleza! Agora, me envie uma *foto* ou *PDF* da frente do documento, por favor.", - "document": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'CNH_FRONT' : result.activities[0].data.message === '2' ? 'RG_FRONT' : 'OTHER'" - }, - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do documento, por favor.", - "is_attachment": "true", - "second_message": "Bela: Beleza! Agora, me envie uma *foto* ou *PDF* da frente do documento, por favor." - }, - { - "order": 2, - "is_text": "false", - "message": "Bela: Obrigada! Documento recebido com sucesso! Agora, me envie uma *foto* ou *PDF* do verso, por favor.", - "document": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'CNH_BACK' : result.activities[0].data.message === '2' ? 'RG_BACK' : 'OTHER'" - }, - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do verso do documento, por favor.", - "is_attachment": "true", - "second_message": "Bela: Obrigada! Documento recebido com sucesso! Agora, me envie uma *foto* ou *PDF* do verso, por favor." - }, - { - "order": 3, - "is_text": "true", - "document": "CPF_NATIVE", - "is_attachment": "false", - "second_document": "SECOND_CPF_NATIVE" - }, - { - "order": 4, - "is_text": "false", - "message": "Bela: Obrigada! Me envie uma *foto* ou *PDF* do *Comprovante de Residência*, por favor.\nOBS: Verifique se está dentro do prazo de 60 dias.\n(pode ser fatura de cartão, gás, água, conta de telefone ou celular, etc).", - "document": "DOCUMENT_RESIDENCE_PROOF", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Comprovante de Residência*, por favor.", - "is_attachment": "true", - "second_message": "Bela: Obrigada! Me envie uma *foto* ou *PDF* do *Comprovante de Residência* dele(a), por favor.\nOBS: Verifique se está dentro do prazo de 60 dias.\n(pode ser fatura de cartão, gás, água, conta de telefone ou celular, etc).", - "second_document": "SECOND_DOCUMENT_RESIDENCE_PROOF" - }, - { - "order": 5, - "is_text": "true", - "document": "DOCUMENT_INCOME_CERTIFICATE_TYPE", - "is_attachment": "false", - "second_document": "SECOND_DOCUMENT_INCOME_CERTIFICATE_TYPE" - }, - { - "order": 6, - "is_text": "false", - "message": "Bela: Certo, me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda* vigente, por favor.", - "document": "PROLABORE", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Pró-labore* ou Imposto de Renda vigente, por favor", - "is_attachment": "true", - "second_message": "Bela: Certo, me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda* vigente dele(a), por favor.", - "second_document": "SECOND_PROLABORE" - }, - { - "order": 7, - "is_text": "false", - "document": "DOCUMENT_INCOME_CERTIFICATE", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Comprovante de Renda*, por favor", - "is_attachment": "true", - "second_document": "SECOND_DOCUMENT_INCOME_CERTIFICATE" - }, - { - "order": 8, - "is_text": "true", - "document": "DOCUMENT_INCOME_CERTIFICATE_DATE", - "is_attachment": "false", - "second_document": "SECOND_DOCUMENT_INCOME_CERTIFICATE_DATE" - }, - { - "order": 9, - "is_text": "true", - "message": "Bela: Contando todos seus contratos de trabalho, você possui mais de 36 meses de carteira assinada? Não precisa ser na mesma empresa.\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "document": "FGTS", - "is_attachment": "false", - "second_message": "Bela: Contando todos os contratos de trabalho, ele(a) possui mais de 36 meses de carteira assinada? Não precisa ser na mesma empresa.\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "second_document": "SECOND_FGTS" - }, - { - "order": 10, - "is_text": "true", - "document": "MARITAL_STATUS", - "is_attachment": "false", - "second_document": "SECOND_MARITAL_STATUS" - } - ], - "cpf_native_question": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'Bela: Muito bem! Por favor, *digite* agora a sua *naturalidade* (exemplo: Rio de Janeiro - RJ).' : result.activities[0].data.message === '2' ? 'Bela: Muito bem! Por favor, *digite* agora o seu *CPF*.' : 'Digite 1 ou 2 para prosseguir.'" - }, - "user_document_chose": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'CNH' : result.activities[0].data.message === '2' ? 'RG' : 'OTHER'" - } - } - } - }, - { - "id": "DOCUMENT-8-2", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "DOCUMENT-8-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Prontinho! Agora é sua vez! Primeiro, qual o documento de identificação você prefere me informar?\n1 - CNH;\n2 - RG.\n(digite 1 ou 2 para prosseguir).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-8-3", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-8-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-8-4", - "name": "Save messages history to bag.", - "next": "DOCUMENT-8-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-8-5", - "name": "Save on table message the user document chose.", - "next": "DOCUMENT-8-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_document_chose" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-8-6", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-8-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-8-7", - "name": "Save messages history to bag.", - "next": "DOCUMENT-8-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": 1 - } - } - }, - { - "id": "DOCUMENT-8-8", - "name": "Check the next document to receive.", - "next": { - "RG": "DOCUMENT-9-A-1", - "CNH": "DOCUMENT-9-A-1", - "default": "DOCUMENT-8" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_document_chose" - } - } - } - }, - { - "id": "DOCUMENT-9-A-1", - "name": "Check upload last step.", - "next": { - "true": "DOCUMENT-9-A-2", - "default": "ST10-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.next_document < 11" - } - } - } - }, - { - "id": "DOCUMENT-9-A-2", - "name": "Check the next document to receive.", - "next": { - "true": "DOCUMENT-10-A-1", - "default": "DOCUMENT-11" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].is_attachment" - } - } - } - }, - { - "id": "DOCUMENT-10-A-1", - "name": "User uploading documents", - "next": "DOCUMENT-10-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].message" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "external_id" - ], - "properties": { - "message": { - "type": "string" - }, - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "DOCUMENT-10-B-1", - "name": "User uploading documents", - "next": "DOCUMENT-10-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].error_message" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "external_id" - ], - "properties": { - "message": { - "type": "string" - }, - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "DOCUMENT-10-A-2", - "name": "Set external_id to bag", - "next": "DOCUMENT-10-A-2-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "external_id": { - "$ref": "result.activities[0].data.external_id" - } - } - } - }, - { - "id": "DOCUMENT-10-A-2-1", - "name": "Verify file extension", - "next": "DOCUMENT-10-A-2-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "CheckExternalIdValidTask", - "parameters": { - "input": { - "document": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].document" - }, - "external_id": { - "$ref": "bag.external_id" - } - } - } - }, - { - "id": "DOCUMENT-10-A-2-2", - "name": "Check if file extension is valid.", - "next": { - "true": "DOCUMENT-10-A-3", - "default": "DOCUMENT-10-B-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "DOCUMENT-10-A-3", - "name": "Check if any media file was received from customer.", - "next": { - "true": "DOCUMENT-10-A-3-A-1", - "default": "DOCUMENT-10-B-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => (!!bag.external_id)" - } - } - } - }, - { - "id": "DOCUMENT-10-A-3-A-1", - "name": "Save BOT message on entity message from USER_UPLOADING_DOCUMENTS", - "next": "DOCUMENT-10-A-3-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-10-A-3-A-2", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-10-A-3-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-10-A-3-A-3", - "name": "Save messages history to bag.", - "next": "DOCUMENT-10-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-10-A-4", - "name": "Create Proofs and Attachments", - "next": "DOCUMENT-10-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "document": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].document" - }, - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "external_id": { - "$ref": "bag.external_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/proofs" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-10-A-5", - "name": "Save on table message the media file receveid.", - "next": "DOCUMENT-10-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.message ? bag.message : null" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-10-A-6", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-10-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-10-A-7", - "name": "Save messages history to bag.", - "next": "DOCUMENT-9-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "DOCUMENT-11", - "name": "Check the next document to receive.", - "next": { - "FGTS": "DOCUMENT-11-D-1", - "default": "DOCUMENT-12", - "CPF_NATIVE": "DOCUMENT-11-A-1", - "DOCUMENT_PROFESSION": "DOCUMENT-11-E-1", - "DOCUMENT_INCOME_CERTIFICATE_DATE": "DOCUMENT-11-C-1", - "DOCUMENT_INCOME_CERTIFICATE_TYPE": "DOCUMENT-11-B-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].document" - } - } - } - }, - { - "id": "DOCUMENT-11-A-1", - "name": "User send document data.", - "next": "DOCUMENT-11-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$ref": "bag.cpf_native_question" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "DOCUMENT-11-A-2", - "name": "Set message and external_id to bag", - "next": "DOCUMENT-11-A-2-VALIDATE-CPF-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "user_cpf_native": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "DOCUMENT-11-A-2-VALIDATE-CPF-1", - "name": "Check if the chosen document is the RG", - "next": { - "RG": "DOCUMENT-11-A-2-VALIDATE-CPF-2", - "default": "DOCUMENT-11-A-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_document_chose" - } - } - } - }, - { - "id": "DOCUMENT-11-A-2-VALIDATE-CPF-2", - "name": "Save parsed cpf to bag.", - "next": "DOCUMENT-11-A-2-VALIDATE-CPF-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_cpf_native": { - "$js": "({bag}) => bag.user_cpf_native.replace(/[^0-9]/g, '')" - } - } - } - }, - { - "id": "DOCUMENT-11-A-2-VALIDATE-CPF-3", - "name": "Validate CPF", - "next": "DOCUMENT-11-A-2-VALIDATE-CPF-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "ValidateCpfTask", - "parameters": { - "input": { - "user_cpf_native": { - "$ref": "bag.user_cpf_native" - } - } - } - }, - { - "id": "DOCUMENT-11-A-2-VALIDATE-CPF-4", - "name": "Check result from validate CPF", - "next": { - "false": "DOCUMENT-11-A-2-VALIDATE-CPF-5", - "default": "DOCUMENT-11-A-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "DOCUMENT-11-A-2-VALIDATE-CPF-5", - "name": "Send message to user informing about the invalid CPF", - "next": "DOCUMENT-11-A-2-VALIDATE-CPF-6", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: O CPF informado é inválido!", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_CPF", - "timeout": 1 - } - }, - { - "id": "DOCUMENT-11-A-2-VALIDATE-CPF-6", - "name": "Save message on entity message from NOTIFY_INVALID_CPF", - "next": "DOCUMENT-11-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: O CPF informado é inválido!", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-A-3", - "name": "Save on table message the documents data", - "next": "DOCUMENT-11-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.cpf_native_question" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-A-4", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-A-5", - "name": "Save messages history to bag.", - "next": "DOCUMENT-11-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-11-A-6", - "name": "Create Proofs and Attachments", - "next": "DOCUMENT-11-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "document": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].document" - }, - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "external_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/proofs" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-A-7", - "name": "Save on table message documents data receveid.", - "next": "DOCUMENT-11-A-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.message" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-A-8", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-A-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-A-9", - "name": "Save messages history to bag.", - "next": "DOCUMENT-9-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "DOCUMENT-11-B-1", - "name": "User send Proofs of income.", - "next": "DOCUMENT-11-B-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Muito bem, {{bag.buyer_profile.nickname}}! Como você comprova sua renda?\n1 - Formal (Carteira Assinada);\n2 - Informal (Extrato Bancário);\n3 - Empresário (Contrato Social).\n(digite 1, 2 ou 3 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_PROOF_INCOME" - } - }, - { - "id": "DOCUMENT-11-B-2", - "name": "Save user proof income to bag.", - "next": "DOCUMENT-11-B-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "files_phrases": [ - { - "order": 6, - "is_text": { - "$js": "({result}) => result.activities[0].data.message === '2' ? true : result.activities[0].data.message === '3' ? false : ''" - }, - "message": { - "$js": "({result}) => result.activities[0].data.message === '2' ? 'Bela: Qual é a sua profissão? (ex: vendedor).' : result.activities[0].data.message === '3' ? 'Certo, me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda* vigente, por favor.' : ''" - }, - "document": { - "$js": "({result}) => result.activities[0].data.message === '2' ? 'DOCUMENT_PROFESSION' : result.activities[0].data.message === '3' ? 'PROLABORE' : ''" - }, - "error_message": { - "$js": "({result}) => result.activities[0].data.message === '2' ? 'Bela: Para prosseguir, preciso que você digite a sua profissão? (ex: vendedor)' : result.activities[0].data.message === '3' ? 'Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda* vigente, por favor' : ''" - }, - "is_attachment": { - "$js": "({result}) => result.activities[0].data.message === '2' ? false : result.activities[0].data.message === '3' ? true : ''" - } - }, - { - "order": 7, - "is_text": "false", - "message": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'Bela: Certo, me envie uma *foto* ou *PDF* do *Contracheque*, por favor.' : result.activities[0].data.message === '2' ? 'Bela: Certo, me envie um *PDF* do *Extrato Bancário* dos últimos 06 meses, por favor.' : 'Bela: Obrigada! Vou precisar também que me envie uma *foto* ou *PDF* do *Contrato Social*, por favor.'" - }, - "document": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'FORMAL' : result.activities[0].data.message === '2' ? 'INFORMAL' : result.activities[0].data.message === '3' ? 'EMPRESARIO(A)' : 'OTHER'" - }, - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Comprovante de Renda*, por favor", - "is_attachment": "true" - }, - { - "order": 8, - "is_text": "true", - "document": "DOCUMENT_INCOME_CERTIFICATE_DATE", - "is_attachment": "false", - "second_document": "SECOND_DOCUMENT_INCOME_CERTIFICATE_DATE" - }, - { - "order": 9, - "is_text": "true", - "message": "Bela: Contando todos seus contratos de trabalho, você possui mais de 36 meses de carteira assinada? Não precisa ser na mesma empresa.\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "document": "FGTS", - "is_attachment": "false", - "second_message": "Bela: Contando todos os contratos de trabalho, ele(a) possui mais de 36 meses de carteira assinada? Não precisa ser na mesma empresa.\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "second_document": "SECOND_FGTS" - }, - { - "order": 10, - "is_text": "true", - "document": "MARITAL_STATUS", - "is_attachment": "false", - "second_document": "SECOND_MARITAL_STATUS" - } - ], - "user_proof_income": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'FORMAL' : result.activities[0].data.message === '2' ? 'INFORMAL' : result.activities[0].data.message === '3' ? 'EMPRESARIO(A)' : 'OTHER'" - }, - "user_proof_income_question_date": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'Bela: Qual foi a data de admissão? Preciso que me informe mês e ano (ex: 02/2021).' : result.activities[0].data.message === '2' ? 'Bela: Desde quando você trabalha nessa atividade? Preciso que me informe mês e ano (ex: 02/2021).' : 'Bela: Quando a empresa foi fundada? Preciso que me informe mês e ano (Ex: 02/2021).'" - } - } - } - }, - { - "id": "DOCUMENT-11-B-3", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-11-B-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Muito bem, {{bag.buyer_profile.nickname}}! Como você comprova sua renda?\n1 - Formal (Carteira Assinada);\n2 - Informal (Extrato Bancário);\n3 - Empresário (Contrato Social).\n(digite 1, 2 ou 3 para prosseguir)." - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-B-4", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-B-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-B-5", - "name": "Save messages history to bag.", - "next": "DOCUMENT-11-B-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-11-B-6", - "name": "Save on table message the user response.", - "next": "DOCUMENT-11-B-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_proof_income" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-B-7", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-B-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-B-8", - "name": "Check income proof type chosen.", - "next": { - "FORMAL": "DOCUMENT-11-B-8-B-1", - "default": "DOCUMENT-11-B-1", - "INFORMAL": "DOCUMENT-11-B-8-A-1", - "EMPRESARIO(A)": "DOCUMENT-11-B-8-A-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_proof_income" - } - } - } - }, - { - "id": "DOCUMENT-11-B-8-A-1", - "name": "Save messages history to bag.", - "next": "DOCUMENT-9-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "DOCUMENT-11-B-8-B-1", - "name": "Save messages history to bag.", - "next": "DOCUMENT-9-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 2" - } - } - } - }, - { - "id": "DOCUMENT-11-C-1", - "name": "User send document data.", - "next": "DOCUMENT-11-C-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$ref": "bag.user_proof_income_question_date" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_PROOF_INCOME_DATE" - } - }, - { - "id": "DOCUMENT-11-C-2", - "name": "Set message and external_id to bag", - "next": "DOCUMENT-11-C-2-VALIDATE-PROOF-INCOME-DATE-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "user_proof_income_date": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "DOCUMENT-11-C-2-VALIDATE-PROOF-INCOME-DATE-1", - "name": "Validate input from user proof income date", - "next": "DOCUMENT-11-C-2-VALIDATE-PROOF-INCOME-DATE-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "ValidateAdmissionDateTask", - "parameters": { - "input": { - "user_proof_income_date": { - "$ref": "bag.user_proof_income_date" - } - } - } - }, - { - "id": "DOCUMENT-11-C-2-VALIDATE-PROOF-INCOME-DATE-2", - "name": "Check result from validate proof income date", - "next": { - "false": "DOCUMENT-11-C-2-VALIDATE-PROOF-INCOME-DATE-3", - "default": "DOCUMENT-11-C-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "DOCUMENT-11-C-2-VALIDATE-PROOF-INCOME-DATE-3", - "name": "Send message informing about the invalid proof income date", - "next": "DOCUMENT-11-C-2-VALIDATE-PROOF-INCOME-DATE-4", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: A data informada é inválida!", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_PROOF_INCOME_DATE", - "timeout": 1 - } - }, - { - "id": "DOCUMENT-11-C-2-VALIDATE-PROOF-INCOME-DATE-4", - "name": "Save message on entity message from NOTIFY_INVALID_PROOF_INCOME_DATE", - "next": "DOCUMENT-11-C-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: A data informada é inválida!", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-C-3", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-11-C-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_proof_income_question_date" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-C-4", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-C-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-C-5", - "name": "Save messages history to bag.", - "next": "DOCUMENT-11-C-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-11-C-6", - "name": "Save on table message the media file receveid.", - "next": "DOCUMENT-11-C-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.message" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-C-7", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-C-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-C-8", - "name": "Save messages history to bag.", - "next": "DOCUMENT-9-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "DOCUMENT-11-D-1", - "name": "User send FGTS data.", - "next": "DOCUMENT-11-D-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].message" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SEND_FGTS" - } - }, - { - "id": "DOCUMENT-11-D-2", - "name": "Save user proof income to bag.", - "next": "DOCUMENT-11-D-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_fgts": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SIM' : result.activities[0].data.message === '2' ? 'NÃO' : 'OTHER'" - } - } - } - }, - { - "id": "DOCUMENT-11-D-3", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-11-D-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-D-4", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-D-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-D-5", - "name": "Save messages history to bag.", - "next": "DOCUMENT-11-D-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-11-D-6", - "name": "Save on table message the user response.", - "next": "DOCUMENT-11-D-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_fgts" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-D-7", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-D-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-D-8", - "name": "Check the next document to receive.", - "next": { - "SIM": "DOCUMENT-11-D-8-A-1", - "NÃO": "DOCUMENT-11-D-9", - "default": "DOCUMENT-11-D-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_fgts" - } - } - } - }, - { - "id": "DOCUMENT-11-D-8-A-1", - "name": "User send FGTS value.", - "next": "DOCUMENT-11-D-8-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Qual o valor do saldo do seu FGTS?\n(não é necessário digitar 'R$', exemplo: 6.500,00).", - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SEND_FGTS_VALUE" - } - }, - { - "id": "DOCUMENT-11-D-8-A-2", - "name": "Save FGTS value to bag.", - "next": "DOCUMENT-11-D-8-A-2-VALIDATE-FGTS-VALUE-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_fgts_value": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "DOCUMENT-11-D-8-A-2-VALIDATE-FGTS-VALUE-1", - "name": "Check if the input value of FGTS is a currency", - "next": "DOCUMENT-11-D-8-A-2-VALIDATE-FGTS-VALUE-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "ValidateCurrencyTask", - "parameters": { - "input": { - "user_fgts_value": { - "$ref": "bag.user_fgts_value" - } - } - } - }, - { - "id": "DOCUMENT-11-D-8-A-2-VALIDATE-FGTS-VALUE-2", - "name": "Check result from validate user FGTS value", - "next": { - "false": "DOCUMENT-11-D-8-A-2-VALIDATE-FGTS-VALUE-3", - "default": "DOCUMENT-11-D-8-A-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "DOCUMENT-11-D-8-A-2-VALIDATE-FGTS-VALUE-3", - "name": "Send message informing about the invalid FGTS value", - "next": "DOCUMENT-11-D-8-A-2-VALIDATE-FGTS-VALUE-4", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: O valor informado é inválido!", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_FGTS_VALUE", - "timeout": 1 - } - }, - { - "id": "DOCUMENT-11-D-8-A-2-VALIDATE-FGTS-VALUE-4", - "name": "Save message on entity message from NOTIFY_INVALID_FGTS_VALUE", - "next": "DOCUMENT-11-D-8-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: O valor informado é inválido!", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-D-8-A-3", - "name": "Save message from bot on message.", - "next": "DOCUMENT-11-D-8-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Qual o valor do saldo do seu FGTS?\n(não é necessário digitar 'R$', exemplo: 6.500,00).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-D-8-A-4", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-D-8-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-D-8-A-5", - "name": "Save messages history to bag.", - "next": "DOCUMENT-11-D-8-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-11-D-8-A-6", - "name": "Save on table message the user response.", - "next": "DOCUMENT-11-D-8-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_fgts_value" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-D-8-A-7", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-D-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-D-9", - "name": "Save messages history to bag.", - "next": "DOCUMENT-9-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "DOCUMENT-11-E-1", - "name": "User send profession data.", - "next": "DOCUMENT-11-E-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].message" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SEND_PROFESSION" - } - }, - { - "id": "DOCUMENT-11-E-2", - "name": "Save user profession to bag.", - "next": "DOCUMENT-11-E-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_profession": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "DOCUMENT-11-E-3", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-11-E-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-E-4", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-E-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-E-5", - "name": "Save messages history to bag.", - "next": "DOCUMENT-11-E-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-11-E-6", - "name": "Save on table message the user response.", - "next": "DOCUMENT-11-E-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_profession" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-11-E-7", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-11-E-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-11-E-8", - "name": "Save messages history to bag.", - "next": "DOCUMENT-9-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "DOCUMENT-12", - "name": "User send Marital Status.", - "next": "DOCUMENT-13", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Anotado! Me informe agora, qual é o seu Estado Civil?\n1 - Solteiro(a);\n2 - Casado(a);\n3 - Divorciado(a) ou viúvo(a).\n(digite 1, 2 ou 3 para prosseguir).", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_MARITAL_STATUS" - } - }, - { - "id": "DOCUMENT-13", - "name": "Save user marital status to bag.", - "next": "DOCUMENT-13-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_marital_status": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SOLTEIRO(A)' : result.activities[0].data.message === '2' ? 'CASADO(A)' : result.activities[0].data.message === '3' ? 'DIVORCIADO(A)-VIUVO(A)' : 'OTHER'" - } - } - } - }, - { - "id": "DOCUMENT-13-A-1", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-13-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Anotado! Me informe agora, qual é o seu Estado Civil?\n1 - Solteiro(a);\n2 - Casado(a);\n3 - Divorciado(a) ou viúvo(a).\n(digite 1, 2 ou 3 para prosseguir).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-13-A-2", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-13-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-13-A-3", - "name": "Save messages history to bag.", - "next": "DOCUMENT-13-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-13-A-4", - "name": "Save on table message the user response.", - "next": "DOCUMENT-13-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_marital_status" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-13-A-5", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-13-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-13-A-6", - "name": "Save messages history to bag.", - "next": "DOCUMENT-14", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-14", - "name": "Check marital status chosen.", - "next": { - "default": "DOCUMENT-12", - "CASADO(A)": "DOCUMENT-18", - "SOLTEIRO(A)": "DOCUMENT-14-A-1", - "DIVORCIADO(A)-VIUVO(A)": "DOCUMENT-15" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_marital_status" - } - } - } - }, - { - "id": "DOCUMENT-14-A-1", - "name": "User send Marital Status.", - "next": "DOCUMENT-14-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Você possui *União Estável* em cartório?\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_STABLE_UNION" - } - }, - { - "id": "DOCUMENT-14-A-2", - "name": "Save user union stable to bag.", - "next": "DOCUMENT-14-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_stable_union": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SIM' : result.activities[0].data.message === '2' ? 'NÃO' : 'OTHER'" - } - } - } - }, - { - "id": "DOCUMENT-14-A-3", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-14-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Você possui *União Estável* em cartório?\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-14-A-4", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-14-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-14-A-5", - "name": "Save messages history to bag.", - "next": "DOCUMENT-14-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-14-A-6", - "name": "Save on table message the user response.", - "next": "DOCUMENT-14-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_stable_union" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-14-A-7", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-14-A-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-14-A-8", - "name": "Save messages history to bag.", - "next": "DOCUMENT-14-A-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-14-A-9", - "name": "Check union stable", - "next": { - "SIM": "DOCUMENT-18", - "NÃO": "DOCUMENT-15", - "default": "DOCUMENT-14-A-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_stable_union" - } - } - } - }, - { - "id": "DOCUMENT-15", - "name": "Check if user chosen a second buyer.", - "next": "DOCUMENT-15-A-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Você irá compor a renda com mais alguma pessoa?\n(ex: namorado(a), noivo(a), amigo(a), pais ... )\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_SECOND_BUYER" - } - }, - { - "id": "DOCUMENT-15-A-1", - "name": "Save user has second buyer to bag.", - "next": "DOCUMENT-15-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_second_buyer": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SIM' : result.activities[0].data.message === '2' ? 'NÃO' : 'OTHER'" - } - } - } - }, - { - "id": "DOCUMENT-15-A-2", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-15-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Você irá compor a renda com mais alguma pessoa?\n(ex: namorado(a), noivo(a), amigo(a), pais ... )\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-15-A-3", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-15-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-15-A-4", - "name": "Save messages history to bag.", - "next": "DOCUMENT-15-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-15-A-5", - "name": "Save on table message the user response.", - "next": "DOCUMENT-15-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_second_buyer" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-15-A-6", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-15-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-15-A-7", - "name": "Save messages history to bag.", - "next": "DOCUMENT-15-A-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-15-A-8", - "name": "Check second buyer.", - "next": { - "SIM": "DOCUMENT-18", - "NÃO": "DOCUMENT-17", - "default": "DOCUMENT-15" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_second_buyer" - } - } - } - }, - { - "id": "DOCUMENT-17", - "name": "Send audio URL to user for descript dependents", - "next": "DOCUMENT-17-A-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: A seguir, seguem algumas regras para a inclusão de dependentes.", - "media_url": "https://aprova-files-qa.s3.amazonaws.com/aprova_files/audio/bb9b9290-119f-11ec-969d-9f25c0966d06-Bea%20Voz.mp3", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "USER_UPLOADING_DOCUMENTS", - "timeout": 1 - } - }, - { - "id": "DOCUMENT-17-A-1", - "name": "Check if user has dependents.", - "next": "DOCUMENT-17-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Você possui dependente(s)?\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).\nObs: Por favor, é importante escutar o áudio antes de prosseguir.", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_USER_HAS_DEPENDENTS" - } - }, - { - "id": "DOCUMENT-17-A-2", - "name": "Save user dependents to bag.", - "next": "DOCUMENT-17-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "user_dependents": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SIM' : result.activities[0].data.message === '2' ? 'NÃO' : 'OTHER'" - } - } - } - }, - { - "id": "DOCUMENT-17-A-3", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-17-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Você possui dependente(s)?\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).\nObs: Por favor, é importante escutar o áudio antes de prosseguir.", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-17-A-4", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-17-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-17-A-5", - "name": "Save messages history to bag.", - "next": "DOCUMENT-17-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-17-A-6", - "name": "Save on table message the user response.", - "next": "DOCUMENT-17-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.user_dependents" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-17-A-7", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-17-A-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-17-A-8", - "name": "Save messages history to bag.", - "next": "DOCUMENT-17-A-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-17-A-9", - "name": "Check user has dependents.", - "next": { - "SIM": "DOCUMENT-18", - "NÃO": "DOCUMENT-18", - "default": "DOCUMENT-17" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_dependents" - } - } - } - }, - { - "id": "DOCUMENT-18", - "name": "Check if has a second buyer.", - "next": { - "true": "SECOND-DOCUMENT", - "default": "ST10-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.user_second_buyer === 'SIM' || bag.user_stable_union === 'SIM' || bag.user_marital_status === 'CASADO(A)'" - } - } - } - }, - { - "id": "SECOND-DOCUMENT", - "name": "Notify upload inform", - "next": "SECOND-DOCUMENT-NOTIFICATION", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Aee {{bag.buyer_profile.nickname}}, estamos quase lá!!! Recebi todos os seus documentos. Vou precisar dos documentos do seu parceiro(a), beleza?!" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_SECOND_BUYER_DATA", - "timeout": 1 - } - }, - { - "id": "SECOND-DOCUMENT-NOTIFICATION", - "name": "Save message on entity message from NOTIFY_SECOND_BUYER_DATA.", - "next": "SECOND-DOCUMENT-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Aee {{bag.buyer_profile.nickname}}, estamos quase lá!!! Recebi todos os seus documentos. Vou precisar dos documentos do seu parceiro(a), beleza?!" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-1", - "name": "Capturing CNH or RG.", - "next": "SECOND-DOCUMENT-1-1", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Então vamos lá!!\nQual o documento de identificação do seu parceiro(a) você prefere me informar.\n1 - CNH;\n2 - RG.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_CNH_OR_RG" - } - }, - { - "id": "SECOND-DOCUMENT-1-1", - "name": "Save user document chose to bag.", - "next": "SECOND-DOCUMENT-1-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "files_phrases": [ - { - "order": 1, - "is_text": "false", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* da frente do documento, por favor.", - "is_attachment": "true", - "second_message": "Bela: Beleza! Agora, me envie uma *foto* ou *PDF* da frente do documento, por favor.", - "second_document": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SECOND_CNH_FRONT' : result.activities[0].data.message === '2' ? 'SECOND_RG_FRONT' : 'OTHER'" - } - }, - { - "order": 2, - "is_text": "false", - "message": "Bela: Obrigada! Documento recebido com sucesso! Agora, me envie uma *foto* ou *PDF* do verso, por favor.", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do verso do documento, por favor.", - "is_attachment": "true", - "second_message": "Bela: Obrigada! Documento recebido com sucesso! Agora, me envie uma *foto* ou *PDF* do verso, por favor.", - "second_document": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SECOND_CNH_BACK' : result.activities[0].data.message === '2' ? 'SECOND_RG_BACK' : 'OTHER'" - } - }, - { - "order": 3, - "is_text": "true", - "document": "CPF_NATIVE", - "is_attachment": "false", - "second_document": "SECOND_CPF_NATIVE" - }, - { - "order": 4, - "is_text": "false", - "message": "Bela: Obrigada! Me envie uma *foto* ou *PDF* do *Comprovante de Residência*, por favor.\nOBS: Verifique se está dentro do prazo de 60 dias.\n(pode ser fatura de cartão, gás, água, conta de telefone ou celular, etc).", - "document": "DOCUMENT_RESIDENCE_PROOF", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Comprovante de Residência*, por favor.", - "is_attachment": "true", - "second_message": "Bela: Obrigada! Me envie uma *foto* ou *PDF* do *Comprovante de Residência* dele(a), por favor.\nOBS: Verifique se está dentro do prazo de 60 dias.\n(pode ser fatura de cartão, gás, água, conta de telefone ou celular, etc).", - "second_document": "SECOND_DOCUMENT_RESIDENCE_PROOF" - }, - { - "order": 5, - "is_text": "true", - "document": "DOCUMENT_INCOME_CERTIFICATE_TYPE", - "is_attachment": "false", - "second_document": "SECOND_DOCUMENT_INCOME_CERTIFICATE_TYPE" - }, - { - "order": 6, - "is_text": "false", - "message": "Bela: Certo, me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda* vigente, por favor.", - "document": "PROLABORE", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Pró-labore* ou Imposto de Renda vigente, por favor", - "is_attachment": "true", - "second_message": "Bela: Certo, me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda* vigente dele(a), por favor.", - "second_document": "SECOND_PROLABORE" - }, - { - "order": 7, - "is_text": "false", - "document": "DOCUMENT_INCOME_CERTIFICATE", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Comprovante de Renda*, por favor", - "is_attachment": "true", - "second_document": "SECOND_DOCUMENT_INCOME_CERTIFICATE" - }, - { - "order": 8, - "is_text": "true", - "document": "DOCUMENT_INCOME_CERTIFICATE_DATE", - "is_attachment": "false", - "second_document": "SECOND_DOCUMENT_INCOME_CERTIFICATE_DATE" - }, - { - "order": 9, - "is_text": "true", - "message": "Bela: Contando todos seus contratos de trabalho, você possui mais de 36 meses de carteira assinada? Não precisa ser na mesma empresa.\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "document": "FGTS", - "is_attachment": "false", - "second_message": "Bela: Contando todos os contratos de trabalho, ele(a) possui mais de 36 meses de carteira assinada? Não precisa ser na mesma empresa.\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "second_document": "SECOND_FGTS" - }, - { - "order": 10, - "is_text": "true", - "document": "MARITAL_STATUS", - "is_attachment": "false", - "second_document": "SECOND_MARITAL_STATUS" - } - ], - "second_cpf_native_question": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'Bela: Muito bem! Por favor, *digite* agora a *naturalidade* (exemplo: Rio de Janeiro - RJ).' : result.activities[0].data.message === '2' ? 'Bela: Muito bem! Por favor, *digite* agora o *CPF*.' : 'Digite 1 ou 2 para prosseguir.'" - }, - "second_user_document_chose": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'CNH' : result.activities[0].data.message === '2' ? 'RG' : 'OTHER'" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-1-2", - "name": "Save on table message the message sent from virtual assistant to buyer.", - "next": "SECOND-DOCUMENT-1-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Então vamos lá!!\nQual o documento de identificação do seu parceiro(a) você prefere me informar.\n1 - CNH;\n2 - RG.\n(digite 1 ou 2 para prosseguir).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-1-3", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-1-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-1-4", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-1-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-1-5", - "name": "Save on table message the user document chose.", - "next": "SECOND-DOCUMENT-1-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_user_document_chose" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-1-6", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-1-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-1-7", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-1-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": 1 - } - } - }, - { - "id": "SECOND-DOCUMENT-1-8", - "name": "Check the next document to receive.", - "next": { - "RG": "SECOND-DOCUMENT-2-A-1", - "CNH": "SECOND-DOCUMENT-2-A-1", - "default": "SECOND-DOCUMENT-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.second_user_document_chose" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-2-A-1", - "name": "Check upload last step.", - "next": { - "true": "SECOND-DOCUMENT-2-A-2", - "default": "ST10-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.next_document < 11" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-2-A-2", - "name": "Check the next document to receive.", - "next": { - "true": "SECOND-DOCUMENT-3-A-1", - "default": "SECOND-DOCUMENT-4" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].is_attachment" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-3-A-1", - "name": "User uploading documents", - "next": "SECOND-DOCUMENT-3-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_message" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "external_id" - ], - "properties": { - "message": { - "type": "string" - }, - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "SECOND-DOCUMENT-3-B-1", - "name": "User uploading documents", - "next": "SECOND-DOCUMENT-3-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].error_message" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "external_id" - ], - "properties": { - "message": { - "type": "string" - }, - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "SECOND-DOCUMENT-3-A-2", - "name": "Set external_id to bag", - "next": "SECOND-DOCUMENT-3-A-2-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "external_id": { - "$ref": "result.activities[0].data.external_id" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-3-A-2-1", - "name": "Verify file extension", - "next": "SECOND-DOCUMENT-3-A-2-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "CheckExternalIdValidTask", - "parameters": { - "input": { - "document": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].document" - }, - "external_id": { - "$ref": "bag.external_id" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-3-A-2-2", - "name": "Check if file extension is valid.", - "next": { - "true": "SECOND-DOCUMENT-3-A-3", - "default": "SECOND-DOCUMENT-3-B-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-3-A-3", - "name": "Check if any media file was received from customer.", - "next": { - "true": "SECOND-DOCUMENT-3-A-3-A-1", - "default": "SECOND-DOCUMENT-3-B-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => (!!bag.external_id)" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-3-A-3-A-1", - "name": "Save BOT message on entity message from USER_UPLOADING_DOCUMENTS", - "next": "SECOND-DOCUMENT-3-A-3-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-3-A-3-A-2", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-3-A-3-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-3-A-3-A-3", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-3-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-3-A-4", - "name": "Create Proofs and Attachments", - "next": "SECOND-DOCUMENT-3-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "document": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_document" - }, - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "external_id": { - "$ref": "bag.external_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/proofs" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-3-A-5", - "name": "Save on table message the media file received.", - "next": "SECOND-DOCUMENT-3-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.message ? bag.message : null" - }, - "external_id": { - "$ref": "bag.external_id" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-3-A-6", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-3-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-3-A-7", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-2-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4", - "name": "Check the next document to receive.", - "next": { - "default": "SECOND-DOCUMENT-5", - "SECOND_FGTS": "SECOND-DOCUMENT-4-D-1", - "SECOND_CPF_NATIVE": "SECOND-DOCUMENT-4-A-1", - "SECOND_DOCUMENT_PROFESSION": "SECOND-DOCUMENT-4-E-1", - "SECOND_DOCUMENT_INCOME_CERTIFICATE_DATE": "SECOND-DOCUMENT-4-C-1", - "SECOND_DOCUMENT_INCOME_CERTIFICATE_TYPE": "SECOND-DOCUMENT-4-B-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_document" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-A-1", - "name": "User send document data.", - "next": "SECOND-DOCUMENT-4-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$ref": "bag.second_cpf_native_question" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "SECOND-DOCUMENT-4-A-2", - "name": "Set message and external_id to bag", - "next": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "second_user_cpf_native": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-1", - "name": "Check if the chosen document of the second buyer is the RG", - "next": { - "RG": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-2", - "default": "SECOND-DOCUMENT-4-A-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.second_user_document_chose" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-2", - "name": "Save parsed cpf to bag.", - "next": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "second_user_cpf_native": { - "$js": "({bag}) => bag.second_user_cpf_native.replace(/[^0-9]/g, '')" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-3", - "name": "Validate second user CPF", - "next": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "ValidateCpfTask", - "parameters": { - "input": { - "user_cpf_native": { - "$ref": "bag.second_user_cpf_native" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-4", - "name": "Check result from validate second user CPF", - "next": { - "false": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-5", - "default": "SECOND-DOCUMENT-4-A-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-5", - "name": "Send message informing about the invalid CPF", - "next": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-6", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: O CPF informado é inválido!", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_CPF", - "timeout": 1 - } - }, - { - "id": "SECOND-DOCUMENT-4-A-2-VALIDATE-CPF-6", - "name": "Save message on entity message from NOTIFY_INVALID_CPF", - "next": "SECOND-DOCUMENT-4-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: O CPF informado é inválido!", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-A-3", - "name": "Save on table message the documents data", - "next": "SECOND-DOCUMENT-4-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_cpf_native_question" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-A-4", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-A-5", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-4-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-A-6", - "name": "Create Proofs and Attachments", - "next": "SECOND-DOCUMENT-4-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "document": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_document" - }, - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "external_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/proofs" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-A-7", - "name": "Save on table message the media file receveid.", - "next": "SECOND-DOCUMENT-4-A-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.message" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-A-8", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-A-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-A-9", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-2-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-B-1", - "name": "User send Proofs of income.", - "next": "SECOND-DOCUMENT-4-B-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Muito bem, {{bag.buyer_profile.nickname}}! Como ele(a) comprova renda?\n1 - Formal (Carteira Assinada);\n2 - Informal (Extrato Bancário);\n3 - Empresário (Contrato Social);\n4 - Não possui renda.\n(digite 1, 2, 3 ou 4 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_PROOF_INCOME" - } - }, - { - "id": "SECOND-DOCUMENT-4-B-2", - "name": "Save user proof income to bag.", - "next": "SECOND-DOCUMENT-4-B-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "files_phrases": [ - { - "order": 6, - "is_text": { - "$js": "({result}) => result.activities[0].data.message === '2' ? true : result.activities[0].data.message === '3' ? false : ''" - }, - "error_message": { - "$js": "({result}) => result.activities[0].data.message === '2' ? 'Bela: Para prosseguir, preciso que você digite a profissão dele(a)? (ex: vendedor)' : result.activities[0].data.message === '3' ? 'Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda* vigente, por favor' : ''" - }, - "is_attachment": { - "$js": "({result}) => result.activities[0].data.message === '2' ? false : result.activities[0].data.message === '3' ? true : ''" - }, - "second_message": { - "$js": "({result}) => result.activities[0].data.message === '2' ? 'Bela: Qual é a profissão dele(a)? (ex: vendedor).' : result.activities[0].data.message === '3' ? 'Certo, me envie uma *foto* ou *PDF* do *Pró-labore* ou *Imposto de Renda* vigente, por favor.' : ''" - }, - "second_document": { - "$js": "({result}) => result.activities[0].data.message === '2' ? 'SECOND_DOCUMENT_PROFESSION' : result.activities[0].data.message === '3' ? 'SECOND_PROLABORE' : ''" - } - }, - { - "order": 7, - "is_text": "false", - "error_message": "Bela: Para prosseguir, preciso que você me envie uma *foto* ou *PDF* do *Comprovante de Renda* dele(a), por favor", - "is_attachment": "true", - "second_message": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'Bela: Certo, me envie uma *foto* ou *PDF* do *Contracheque*, por favor.' : result.activities[0].data.message === '2' ? 'Bela: Certo, me envie um *PDF* do *Extrato Bancário* dos últimos 06 meses, por favor.' : 'Bela: Obrigada! Vou precisar também que me envie uma *foto* ou *PDF* do *Contrato Social* dele(a), por favor.'" - }, - "second_document": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SECOND_FORMAL' : result.activities[0].data.message === '2' ? 'SECOND_INFORMAL' : result.activities[0].data.message === '3' ? 'SECOND_EMPRESARIO(A)' : 'OTHER'" - } - }, - { - "order": 8, - "is_text": "true", - "is_attachment": "false", - "second_document": "SECOND_DOCUMENT_INCOME_CERTIFICATE_DATE" - }, - { - "order": 9, - "is_text": "true", - "message": "Bela: Contando todos seus contratos de trabalho, você possui mais de 36 meses de carteira assinada? Não precisa ser na mesma empresa.\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "is_attachment": "false", - "second_message": "Bela: Contando todos os contratos de trabalho, ele(a) possui mais de 36 meses de carteira assinada? Não precisa ser na mesma empresa.\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "second_document": "SECOND_FGTS" - }, - { - "order": 10, - "is_text": "true", - "is_attachment": "false", - "second_document": "SECOND_MARITAL_STATUS" - } - ], - "second_user_proof_income": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'FORMAL' : result.activities[0].data.message === '2' ? 'INFORMAL' : result.activities[0].data.message === '3' ? 'EMPRESARIO(A)' : result.activities[0].data.message === '4' ? 'SEM_RENDA' : 'OTHER'" - }, - "second_user_proof_income_question_date": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'Bela: Qual foi a data de admissão dele(a)? Preciso que me informe mês e ano (ex: 02/2021).' : result.activities[0].data.message === '2' ? 'Bela: Desde quando ele(a) trabalha nessa atividade? Mês e Ano (Ex: 02/2021)' : 'Bela: Quando a empresa dele(a) fundada? Preciso que me informe mês e ano (Ex: 02/2021).'" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-B-3", - "name": "Save on table message the bot message.", - "next": "SECOND-DOCUMENT-4-B-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Muito bem, {{bag.buyer_profile.nickname}}! Como ele(a) comprova renda?\n1 - Formal (Carteira Assinada);\n2 - Informal (Extrato Bancário);\n3 - Empresário (Contrato Social);\n4 - Não possui renda.\n(digite 1, 2, 3 ou 4 para prosseguir)." - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-B-4", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-B-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-B-5", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-4-B-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-B-6", - "name": "Save on table message the user response.", - "next": "SECOND-DOCUMENT-4-B-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_user_proof_income" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-B-7", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-B-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-B-8", - "name": "Check the next document to receive.", - "next": { - "FORMAL": "SECOND-DOCUMENT-4-B-8-B-1", - "default": "SECOND-DOCUMENT-4-B-1", - "INFORMAL": "SECOND-DOCUMENT-4-B-8-C-1", - "SEM_RENDA": "SECOND-DOCUMENT-4-B-8-A-1", - "EMPRESARIO(A)": "SECOND-DOCUMENT-4-B-8-C-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.second_user_proof_income" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-B-8-A-1", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-2-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 4" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-B-8-B-1", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-2-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 2" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-B-8-C-1", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-2-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-C-1", - "name": "User send document data.", - "next": "SECOND-DOCUMENT-4-C-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$ref": "bag.second_user_proof_income_question_date" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_PROOF_INCOME_DATE" - } - }, - { - "id": "SECOND-DOCUMENT-4-C-2", - "name": "Set message and external_id to bag", - "next": "SECOND-DOCUMENT-4-C-2-VALIDATE-PROOF-INCOME-DATE-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "second_user_proof_income_date": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-C-2-VALIDATE-PROOF-INCOME-DATE-1", - "name": "Validate input from second user proof income date", - "next": "SECOND-DOCUMENT-4-C-2-VALIDATE-PROOF-INCOME-DATE-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "ValidateAdmissionDateTask", - "parameters": { - "input": { - "user_proof_income_date": { - "$ref": "bag.second_user_proof_income_date" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-C-2-VALIDATE-PROOF-INCOME-DATE-2", - "name": "Check result from validate proof income date from second user", - "next": { - "false": "SECOND-DOCUMENT-4-C-2-VALIDATE-PROOF-INCOME-DATE-3", - "default": "SECOND-DOCUMENT-4-C-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-C-2-VALIDATE-PROOF-INCOME-DATE-3", - "name": "Send message informing about the invalid proof income date from second user", - "next": "SECOND-DOCUMENT-4-C-2-VALIDATE-PROOF-INCOME-DATE-4", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: A data informada é inválida!", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_PROOF_INCOME_DATE", - "timeout": 1 - } - }, - { - "id": "SECOND-DOCUMENT-4-C-2-VALIDATE-PROOF-INCOME-DATE-4", - "name": "Save message on entity message from NOTIFY_INVALID_PROOF_INCOME_DATE", - "next": "SECOND-DOCUMENT-4-C-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: A data informada é inválida!", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-C-3", - "name": "Save on table message the bot message.", - "next": "SECOND-DOCUMENT-4-C-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_user_proof_income_question_date" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-C-4", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-C-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-C-5", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-4-C-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-C-6", - "name": "Save on table message the media file received.", - "next": "SECOND-DOCUMENT-4-C-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.message" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-C-7", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-C-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-C-8", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-2-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-D-1", - "name": "User send FGTS data.", - "next": "SECOND-DOCUMENT-4-D-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_message" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SEND_FGTS" - } - }, - { - "id": "SECOND-DOCUMENT-4-D-2", - "name": "Save user proof income to bag.", - "next": "SECOND-DOCUMENT-4-D-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "second_user_fgts": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SIM' : result.activities[0].data.message === '2' ? 'NÃO' : 'OTHER'" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-D-3", - "name": "Save on table message the bot message.", - "next": "SECOND-DOCUMENT-4-D-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-4", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-D-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-5", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-4-D-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-D-6", - "name": "Save on table message the user response.", - "next": "SECOND-DOCUMENT-4-D-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_user_fgts" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-7", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-D-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8", - "name": "Check the next document to receive.", - "next": { - "SIM": "SECOND-DOCUMENT-4-D-8-A-1", - "NÃO": "SECOND-DOCUMENT-4-D-9", - "default": "SECOND-DOCUMENT-4-D-1" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.second_user_fgts" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-1", - "name": "User send FGTS value.", - "next": "SECOND-DOCUMENT-4-D-8-A-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Qual o valor do saldo do FGTS dele(a)?\n(não é necessário digitar 'R$', exemplo: 6.500,00).", - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SEND_FGTS_VALUE" - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-2", - "name": "Save FGTS value to bag.", - "next": "SECOND-DOCUMENT-4-D-8-A-2-VALIDATE-FGTS-VALUE-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "second_user_fgts_value": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-2-VALIDATE-FGTS-VALUE-1", - "name": "Check if the input FGTS value from second user is a currency", - "next": "SECOND-DOCUMENT-4-D-8-A-2-VALIDATE-FGTS-VALUE-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "ValidateCurrencyTask", - "parameters": { - "input": { - "second_user_fgts_value": { - "$ref": "bag.second_user_fgts_value" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-2-VALIDATE-FGTS-VALUE-2", - "name": "Check result from validate second user FGTS value", - "next": { - "false": "SECOND-DOCUMENT-4-D-8-A-2-VALIDATE-FGTS-VALUE-3", - "default": "SECOND-DOCUMENT-4-D-8-A-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-2-VALIDATE-FGTS-VALUE-3", - "name": "Send message informing about the invalid FGTS value from second user", - "next": "SECOND-DOCUMENT-4-D-8-A-2-VALIDATE-FGTS-VALUE-4", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: O valor informado é inválido!", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_INVALID_FGTS_VALUE", - "timeout": 1 - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-2-VALIDATE-FGTS-VALUE-4", - "name": "Save message on entity message from NOTIFY_INVALID_FGTS_VALUE", - "next": "SECOND-DOCUMENT-4-D-8-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: O valor informado é inválido!", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-3", - "name": "Save message from bot on message.", - "next": "SECOND-DOCUMENT-4-D-8-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Qual o valor do saldo do FGTS dele(a)?\n(não é necessário digitar 'R$', exemplo: 6.500,00).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-4", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-D-8-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-5", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-4-D-8-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-6", - "name": "Save on table message the user response.", - "next": "SECOND-DOCUMENT-4-D-8-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_user_fgts_value" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-8-A-7", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-D-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-D-9", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-2-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-E-1", - "name": "User send profession data.", - "next": "SECOND-DOCUMENT-4-E-2", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_message" - }, - "document": { - "$ref": "bag.next_document" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_SEND_PROFESSION" - } - }, - { - "id": "SECOND-DOCUMENT-4-E-2", - "name": "Save second user profession to bag.", - "next": "SECOND-DOCUMENT-4-E-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "second_user_profession": { - "$ref": "result.activities[0].data.message" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-E-3", - "name": "Save on table message the bot message.", - "next": "SECOND-DOCUMENT-4-E-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => bag.files_phrases.filter((document) => document.order === bag.next_document)[0].second_message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-E-4", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-E-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-E-5", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-4-E-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-4-E-6", - "name": "Save on table message the user response.", - "next": "SECOND-DOCUMENT-4-E-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_user_profession" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-E-7", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-4-E-8", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-4-E-8", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-2-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - }, - "next_document": { - "$js": "({bag}) => bag.next_document + 1" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-5", - "name": "Check the if has second buyer.", - "next": { - "SIM": "SECOND-DOCUMENT-5-A-1", - "default": "ST10-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.user_second_buyer" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-5-A-1", - "name": "User send Marital Status.", - "next": "SECOND-DOCUMENT-6", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Anotado! Me informe agora, qual é o Estado Civil dele(a)?\n1 - Solteiro(a);\n2 - Casado(a);\n3 - Divorciado(a) ou viúvo(a).\n(digite 1, 2 ou 3 para prosseguir).", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_MARITAL_STATUS" - } - }, - { - "id": "SECOND-DOCUMENT-6", - "name": "Save user marital status to bag.", - "next": "SECOND-DOCUMENT-6-A-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "second_user_marital_status": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SOLTEIRO(A)' : result.activities[0].data.message === '2' ? 'CASADO(A)' : result.activities[0].data.message === '3' ? 'DIVORCIADO(A)-VIUVO(A)' : 'OTHER'" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-6-A-1", - "name": "Save on table message the bot message.", - "next": "SECOND-DOCUMENT-6-A-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Anotado! Me informe agora, qual é o Estado Civil dele(a)?\n1 - Solteiro(a);\n2 - Casado(a);\n3 - Divorciado(a) ou viúvo(a).\n(digite 1, 2 ou 3 para prosseguir).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-6-A-2", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-6-A-3", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-6-A-3", - "name": "Save messages history to bag.", - "next": "SECOND-DOCUMENT-6-A-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "SECOND-DOCUMENT-6-A-4", - "name": "Save on table message the user response.", - "next": "SECOND-DOCUMENT-6-A-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_user_marital_status" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "SECOND-DOCUMENT-6-A-5", - "name": "get chat details and messages by chat ID.", - "next": "SECOND-DOCUMENT-6-A-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SECOND-DOCUMENT-6-A-6", - "name": "Save messages history to bag.", - "next": "DOCUMENT-6-A-7", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-6-A-7", - "name": "Check marital status chosen.", - "next": { - "default": "SECOND-DOCUMENT-5-A-1", - "CASADO(A)": "ST10-L", - "SOLTEIRO(A)": "DOCUMENT-6-A-8", - "DIVORCIADO(A)-VIUVO(A)": "ST10-L" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.second_user_marital_status" - } - } - } - }, - { - "id": "DOCUMENT-6-A-8", - "name": "User send Marital Status.", - "next": "DOCUMENT-6-A-9", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Ele(a) é solteiro(a) com *União Estável* em cartório?\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_STABLE_UNION" - } - }, - { - "id": "DOCUMENT-6-A-9", - "name": "Save user union stable to bag.", - "next": "DOCUMENT-6-A-10", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "second_user_stable_union": { - "$js": "({result}) => result.activities[0].data.message === '1' ? 'SIM' : result.activities[0].data.message === '2' ? 'NÃO' : 'OTHER'" - } - } - } - }, - { - "id": "DOCUMENT-6-A-10", - "name": "Save on table message the bot message.", - "next": "DOCUMENT-6-A-11", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": "Bela: Ele(a) é solteiro(a) com *União Estável* em cartório?\n1 - Sim;\n2 - Não.\n(digite 1 ou 2 para prosseguir).", - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-6-A-11", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-6-A-12", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-6-A-12", - "name": "Save messages history to bag.", - "next": "DOCUMENT-6-A-13", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-6-A-13", - "name": "Save on table message the user response.", - "next": "DOCUMENT-6-A-14", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.second_user_stable_union" - }, - "external_id": null, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "DOCUMENT-6-A-14", - "name": "get chat details and messages by chat ID.", - "next": "DOCUMENT-6-A-15", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "DOCUMENT-6-A-15", - "name": "Save messages history to bag.", - "next": "DOCUMENT-6-A-16", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "DOCUMENT-6-A-16", - "name": "Check union stable", - "next": { - "SIM": "ST10-L", - "NÃO": "ST10-L", - "default": "DOCUMENT-6-A-8" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.second_user_stable_union" - } - } - } - }, - { - "id": "ST10-L", - "name": "Update request status", - "next": "U8-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "status": "DOCUMENTS_RECEIVED" - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "U8-L", - "name": "Notify that all documents were received", - "next": "ST34-L", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Muito bem, {{bag.buyer_profile.nickname}}!!! O Grande passo foi dado para compra da sua Casa Própria! Deixa eu te falar, agora nosso Time vai correr para analisar seus documentos e trazer uma resposta logo logo, ok? Obrigada!\nMe aguarde que eu não demoro! 🧡" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_DOCUMENTS_RECEIVED", - "timeout": 1 - } - }, - { - "id": "ST34-L", - "name": "Save message on entity message from NOTIFY_DOCUMENTS_RECEIVED.", - "next": "ST53-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$mustache": "Bela: Muito bem, {{bag.buyer_profile.nickname}}!!! O Grande passo foi dado para compra da sua Casa Própria! Deixa eu te falar, agora nosso Time vai correr para analisar seus documentos e trazer uma resposta logo logo, ok? Obrigada!\nMe aguarde que eu não demoro! 🧡" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "ST53-L", - "name": "get chat details and messages by chat ID.", - "next": "SB25-L", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB25-L", - "name": "Save messages history to bag.", - "next": "PROFILE-CREDIT-INFO-1", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "PROFILE-CREDIT-INFO-1", - "name": "Check if has a second buyer on request.", - "next": { - "true": "PROFILE-CREDIT-INFO-2", - "default": "PROFILE-CREDIT-INFO-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.user_second_buyer === 'SIM' || bag.user_stable_union === 'SIM' || bag.user_marital_status === 'CASADO(A)'" - } - } - } - }, - { - "id": "PROFILE-CREDIT-INFO-2", - "name": "Save profile credit info data from buyer to bag.", - "next": "PROFILE-CREDIT-INFO-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "profiles_credit_infos": [ - { - "id": { - "$js": "({bag}) => bag.buyer_profile.profiles_credit_infos ? bag.buyer_profile.profiles_credit_infos.filter((profile) => profile.profile_type === 'buyer').length > 0 ? bag.buyer_profile.profiles_credit_infos.filter((profile) => profile.profile_type === 'buyer')[0].id : null : null" - }, - "cpf": { - "$js": "({bag}) => bag.user_document_chose === 'RG' ? bag.user_cpf_native : null" - }, - "native": { - "$js": "({bag}) => bag.user_document_chose === 'CNH' ? bag.user_cpf_native : null" - }, - "has_fgts": { - "$js": "({bag}) => bag.user_fgts === 'SIM' ? true : false" - }, - "fgts_value": { - "$js": "({bag}) => bag.user_fgts === 'SIM' ? bag.user_fgts_value : null" - }, - "profession": { - "$js": "({bag}) => bag.user_proof_income === 'INFORMAL' ? bag.user_profession : null" - }, - "civil_status": { - "$js": "({bag}) => bag.user_marital_status.toLowerCase()" - }, - "profile_type": "buyer", - "proof_income": { - "$js": "({bag}) => bag.user_proof_income === 'SEM_RENDA' ? 'sem-renda' : bag.user_proof_income.toLowerCase()" - }, - "document_type": { - "$ref": "bag.user_document_chose" - }, - "admission_date": { - "$ref": "bag.user_proof_income_date" - }, - "has_dependents": { - "$js": "({bag}) => bag.user_dependents === 'SIM' ? true : false" - }, - "has_stable_union": { - "$js": "({bag}) => bag.user_stable_union === 'SIM' ? true : false" - } - }, - { - "id": { - "$js": "({bag}) => bag.buyer_profile.profiles_credit_infos ? bag.buyer_profile.profiles_credit_infos.filter((profile) => profile.profile_type !== 'buyer').length > 0 ? bag.buyer_profile.profiles_credit_infos.filter((profile) => profile.profile_type !== 'buyer')[0].id : null : null" - }, - "cpf": { - "$js": "({bag}) => bag.second_user_document_chose === 'RG' ? bag.second_user_cpf_native : null" - }, - "native": { - "$js": "({bag}) => bag.second_user_document_chose === 'CNH' ? bag.second_user_cpf_native : null" - }, - "has_fgts": { - "$js": "({bag}) => bag.second_user_fgts === 'SIM' ? true : false" - }, - "fgts_value": { - "$js": "({bag}) => bag.second_user_fgts === 'SIM' ? bag.second_user_fgts_value : null" - }, - "profession": { - "$js": "({bag}) => bag.second_user_proof_income === 'INFORMAL' ? bag.second_user_profession : null" - }, - "civil_status": { - "$js": "({bag}) => bag.user_stable_union === 'SIM' ? 'solteiro(a)' : bag.user_marital_status === 'CASADO(A)' ? 'casado(a)' : bag.second_user_marital_status.toLowerCase()" - }, - "profile_type": { - "$js": "({bag}) => bag.user_stable_union === 'SIM' ? 'union_stable' : bag.user_marital_status === 'CASADO(A)' ? 'conjuge' : 'second_buyer'" - }, - "proof_income": { - "$js": "({bag}) => bag.second_user_proof_income === 'SEM_RENDA' ? 'sem-renda' : bag.second_user_proof_income.toLowerCase()" - }, - "document_type": { - "$ref": "bag.second_user_document_chose" - }, - "admission_date": { - "$js": "({bag}) => bag.second_user_proof_income !== 'SEM_RENDA' ? bag.second_user_proof_income_date : null" - }, - "has_dependents": { - "$js": "({bag}) => bag.second_user_dependents === 'SIM' ? true : false" - }, - "has_stable_union": { - "$js": "({bag}) => bag.second_user_stable_union === 'SIM' ? true : false" - } - } - ] - } - } - }, - { - "id": "PROFILE-CREDIT-INFO-3", - "name": "Save profile credit info data from buyer to bag.", - "next": "PROFILE-CREDIT-INFO-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "profiles_credit_infos": [ - { - "id": { - "$js": "({bag}) => bag.buyer_profile.profiles_credit_infos ? bag.buyer_profile.profiles_credit_infos.filter((profile) => profile.profile_type === 'buyer').length > 0 ? bag.buyer_profile.profiles_credit_infos.filter((profile) => profile.profile_type === 'buyer')[0].id : null : null" - }, - "cpf": { - "$js": "({bag}) => bag.user_document_chose === 'RG' ? bag.user_cpf_native : null" - }, - "native": { - "$js": "({bag}) => bag.user_document_chose === 'CNH' ? bag.user_cpf_native : null" - }, - "has_fgts": { - "$js": "({bag}) => bag.user_fgts === 'SIM' ? true : false" - }, - "fgts_value": { - "$js": "({bag}) => bag.user_fgts === 'SIM' ? bag.user_fgts_value : null" - }, - "profession": { - "$js": "({bag}) => bag.user_proof_income === 'INFORMAL' ? bag.user_profession : null" - }, - "civil_status": { - "$js": "({bag}) => bag.user_marital_status.toLowerCase()" - }, - "profile_type": "buyer", - "proof_income": { - "$js": "({bag}) => bag.user_proof_income === 'SEM_RENDA' ? 'sem-renda' : bag.user_proof_income.toLowerCase()" - }, - "document_type": { - "$ref": "bag.user_document_chose" - }, - "admission_date": { - "$ref": "bag.user_proof_income_date" - }, - "has_dependents": { - "$js": "({bag}) => bag.user_dependents === 'SIM' ? true : false" - }, - "has_stable_union": { - "$js": "({bag}) => bag.user_stable_union === 'SIM' ? true : false" - } - } - ] - } - } - }, - { - "id": "PROFILE-CREDIT-INFO-4", - "name": "Update Profile with credit infos", - "next": "ST11-B", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profiles_credit_infos": { - "$ref": "bag.profiles_credit_infos" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/{{bag.buyer_profile.id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST11-B", - "name": "Get request details", - "next": "SB5-B", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/{{bag.request.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB5-B", - "name": "Set request details to bag", - "next": "U9-B", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "request_details": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U9-B", - "name": "Backoffice request analysis", - "next": "SB7-B", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "request": { - "$ref": "bag.request_details" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "type": { - "type": "string" - }, - "action": { - "type": "string" - }, - "message": { - "type": "string" - }, - "credit_limit": { - "type": "string" - }, - "proof_status": { - "type": "string" - }, - "attachment_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "client_mobile_phone": { - "$ref": "bag.party_number" - } - }, - "action": "REQUEST_ANALYSIS" - } - }, - { - "id": "SB7-B", - "name": "Set activity content to bag", - "next": "F4-B", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "type": { - "$ref": "result.activities[0].data.type" - }, - "action": { - "$ref": "result.activities[0].data.action" - }, - "message": { - "$ref": "result.activities[0].data.message" - }, - "credit_limit": { - "$ref": "result.activities[0].data.credit_limit" - }, - "proof_status": { - "$ref": "result.activities[0].data.proof_status" - }, - "attachment_id": { - "$ref": "result.activities[0].data.attachment_id" - } - } - } - }, - { - "id": "F4-B", - "name": "Check Backoffice action", - "next": { - "default": "REJECT-REQUEST-1", - "approve_request": "FINISH-REQUEST-1", - "classify_documents": "CLASSIFY-DOCUMENT-1", - "request_new_documents": "REVIEW-DOCUMENT-1", - "notify_documents_review": "APPROVE-DOCUMENT-1" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "bag.action" - } - } - } - }, - { - "id": "APPROVE-DOCUMENT-1", - "name": "Set to bag notify_documents_review", - "next": "APPROVE-DOCUMENT-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "notify_documents_review": true - } - } - }, - { - "id": "APPROVE-DOCUMENT-2", - "name": "Update request status to DOCUMENTS_APPROVED", - "next": "U9-B", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "status": "DOCUMENTS_APPROVED" - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "REVIEW-DOCUMENT-1", - "name": "Update request status to REJECTED", - "next": "REVIEW-DOCUMENT-2", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "status": "DOCUMENTS_REJECTED" - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "REVIEW-DOCUMENT-2", - "name": "Notify request documents again", - "next": "REVIEW-DOCUMENT-3", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => 'Bela: ' + bag.message" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_REQUEST_DOCUMENTS_AGAIN", - "timeout": 1 - } - }, - { - "id": "REVIEW-DOCUMENT-3", - "name": "Save message on entity message from NOTIFY_REQUEST_DOCUMENTS_AGAIN", - "next": "REVIEW-DOCUMENT-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$js": "({bag}) => 'Bela: ' + bag.message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "REVIEW-DOCUMENT-4", - "name": "get chat details and messages by chat ID.", - "next": "REVIEW-DOCUMENT-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "REVIEW-DOCUMENT-5", - "name": "Save messages history to bag.", - "next": "REVIEW-DOCUMENT-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "REVIEW-DOCUMENT-6", - "name": "Start sub process to review documents.", - "next": "ST10-L", - "type": "SubProcess", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "bot_phone_number": { - "$ref": "bag.bot_phone_number" - }, - "buyer_profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "chat_participant_id": { - "$ref": "bag.buyer_chat_participant_id" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "documentReview", - "valid_response": "finished" - } - }, - { - "id": "CLASSIFY-DOCUMENT-1", - "name": "Update attachments", - "next": "CLASSIFY-DOCUMENT-2", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "type": { - "$ref": "bag.type" - } - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/attachments?id=eq.{{bag.attachment_id}}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CLASSIFY-DOCUMENT-2", - "name": "Update proofs", - "next": "CLASSIFY-DOCUMENT-3", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "status": { - "$ref": "bag.proof_status" - }, - "approved_by_actor_id": { - "$ref": "actor_data.actor_id" - } - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/proofs?attachment_id=eq.{{bag.attachment_id}}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CLASSIFY-DOCUMENT-3", - "name": "Get backoffice data", - "next": "CLASSIFY-DOCUMENT-4", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/profiles?actor_id=eq.{{actor_data.actor_id}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "CLASSIFY-DOCUMENT-4", - "name": "Save the user's name to make last analisy documents to bag.", - "next": "CLASSIFY-DOCUMENT-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "last_analysis_by": { - "$ref": "result.data[0].name" - } - } - } - }, - { - "id": "CLASSIFY-DOCUMENT-5", - "name": "Update request status to DOCUMENTS_ANALYSIS", - "next": "ST11-B", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "status": "DOCUMENTS_ANALYSIS" - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "FINISH-REQUEST-1", - "name": "Approve Request", - "next": "FINISH-REQUEST-2", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "credit_limit": { - "$ref": "bag.credit_limit" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/approve" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "FINISH-REQUEST-2", - "name": "create a new chat with type REALTOR.", - "next": "FINISH-REQUEST-3", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "chat_type": "REALTOR", - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "buyer_profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "realtor_profile_id": { - "$ref": "bag.request_details.realtor.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "FINISH-REQUEST-3", - "name": "Set chat details to bag", - "next": "FINISH-REQUEST-4", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "chat_id": { - "$ref": "result.data.chat_id" - }, - "chat_bot_id": { - "$ref": "bag.chat_id" - }, - "buyer_chat_participant_id": { - "$ref": "result.data.buyer_chat_participant_id" - }, - "realtor_chat_participant_id": { - "$ref": "result.data.realtor_chat_participant_id" - } - } - } - }, - { - "id": "REJECT-REQUEST-1", - "name": "Reject Request", - "next": "FINISH-REQUEST-4", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/reject" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "FINISH-REQUEST-4", - "name": "Notify user of request analysis result", - "next": "FINISH-REQUEST-5", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$js": "({bag}) => 'Bela: ' + bag.message" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_REQUEST_ANALYSIS_RESULT", - "timeout": 1 - } - }, - { - "id": "FINISH-REQUEST-5", - "name": "Save message on entity message from NOTIFY_REQUEST_ANALYSIS_RESULT.", - "next": "FINISH-REQUEST-6", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - }, - "chat_id": { - "$ref": "bag.chat_bot_id" - }, - "content": { - "$js": "({bag}) => 'Bela: ' + bag.message" - }, - "external_id": null, - "chat_participant_id": null - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "FINISH-REQUEST-6", - "name": "Check if chat_bot_id was defined.", - "next": { - "false": "FINISH-REQUEST-8", - "default": "FINISH-REQUEST-7" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => (!!bag.chat_bot_id)" - } - } - } - }, - { - "id": "FINISH-REQUEST-7", - "name": "get chat details and messages by chat ID.", - "next": "FINISH-REQUEST-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_bot_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "FINISH-REQUEST-8", - "name": "get chat details and messages by chat ID.", - "next": "FINISH-REQUEST-9", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "FINISH-REQUEST-9", - "name": "Save messages history to bag.", - "next": "FINISH-REQUEST-10", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "messages": { - "$ref": "result.data.messages" - } - } - } - }, - { - "id": "FINISH-REQUEST-10", - "name": "Get bot data", - "next": "FINISH-REQUEST-11", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "GetBotDataTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.bot_phone_number" - } - } - } - }, - { - "id": "FINISH-REQUEST-11", - "name": "Check request was approved.", - "next": { - "default": "EXIT-REQUEST-ANALYSIS-RESULT", - "approve_request": "FINISH-REQUEST-12" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.action" - } - } - } - }, - { - "id": "FINISH-REQUEST-12", - "name": "Start realtorChat workflow.", - "next": "EXIT-REQUEST-ANALYSIS-RESULT", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "startProcess", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - } - }, - "actor_data": { - "$ref": "result" - }, - "workflow_name": "realtorChat" - } - }, - { - "id": "EXIT-REQUEST-ANALYSIS-RESULT", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/notifyMessage.json b/samples/blueprints/approva/notifyMessage.json deleted file mode 100644 index 041e7200..00000000 --- a/samples/blueprints/approva/notifyMessage.json +++ /dev/null @@ -1,339 +0,0 @@ -{ - "name": "notifyMessage", - "description": "Subprocess to notify realtor by number", - "blueprint_spec": { - "lanes": [ - { - "id": "REQUESTBOT", - "name": "Request BOT", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('requestBot');" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start notifyMessage", - "next": "GET-MANAGER-REALTOR-DATA", - "type": "Start", - "lane_id": "REQUESTBOT", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "author_id", - "buyer_number", - "request" - ], - "properties": { - "status": { - "type": "string" - }, - "request": { - "type": "object" - }, - "author_id": { - "type": "string" - }, - "buyer_number": { - "type": "string" - } - } - } - } - }, - { - "id": "GET-MANAGER-REALTOR-DATA", - "name": "Get manager data", - "next": "SET-MANAGER-REALTOR-DATA-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "realtor_id": { - "$ref": "bag.request.realtor.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/get-manager-actor-id-by-realtor-id" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-MANAGER-REALTOR-DATA-TO-BAG", - "name": "set manager data on bag", - "next": "CREATE-REALTOR-CHAT-NOTIFY", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - }, - "manager_data": { - "$ref": "result.data" - } - } - } - }, - { - "id": "CREATE-REALTOR-CHAT-NOTIFY", - "name": "Create or setup party number chat", - "next": "BAG-CREATED-REALTOR-CHAT-NOTIFY", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "buyer_phone_number": { - "$ref": "bag.request.realtor.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/create-setup-chat" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "BAG-CREATED-REALTOR-CHAT-NOTIFY", - "name": "Set chat to bag", - "next": "NOTIFY-REALTOR-TO-STATUS-UPDATE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "realtor_chat_id": { - "$ref": "result.data.id" - } - } - } - }, - { - "id": "NOTIFY-REALTOR-TO-STATUS-UPDATE", - "name": "Notify realtor status update", - "next": "INACTIVATE-REALTOR-CHAT-NOTIFY", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Corretor, a análise de pedido do seu cliente *{{bag.buyer_number}}* foi atualizado para *{{bag.status}}*." - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.request.realtor.mobile_phone" - } - }, - "action": "NOTIFY_REALTOR_AND_MANAGER_REALTOR_STATUS_MESSAGE", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-NOTIFY", - "name": "Inactivate realtor chat id", - "next": "CREATE-MANAGER-CHAT-NOTIFY", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "CREATE-MANAGER-CHAT-NOTIFY", - "name": "Create or setup party number chat", - "next": "BAG-CREATE-MANAGER-CHAT-NOTIFY", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "buyer_phone_number": { - "$ref": "bag.manager_data.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/create-setup-chat" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "BAG-CREATE-MANAGER-CHAT-NOTIFY", - "name": "Set chat to bag", - "next": "NOTIFY-MANAGER-REALTOR-TO-STATUS-UPDATE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "manager_realtor_chat_id": { - "$ref": "result.data.id" - } - } - } - }, - { - "id": "NOTIFY-MANAGER-REALTOR-TO-STATUS-UPDATE", - "name": "Notify manager realtor status update", - "next": "INACTIVATE-MANAGER-REALTOR-CHAT-ID", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.manager_realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Gerente, o status de pedido do cliente *{{bag.buyer_number}}* foi atualizado para *{{bag.status}}*." - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.manager_data.mobile_phone" - } - }, - "action": "NOTIFY_REALTOR_AND_MANAGER_REALTOR_STATUS_MESSAGE", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-MANAGER-REALTOR-CHAT-ID", - "name": "Inactivate manager realtor chat id", - "next": "RETURN", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.manager_realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "RETURN", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": {}, - "status": "SUCCESS" - } - } - ], - "prepare": [], - "environment": { - "XPTO": "BOTAUTHOR", - "JWT_KEY": "JWT_KEY_BP", - "CHAT_API": "CHAT_API", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/onboardingCRUD.json b/samples/blueprints/approva/onboardingCRUD.json deleted file mode 100644 index 7ddb165d..00000000 --- a/samples/blueprints/approva/onboardingCRUD.json +++ /dev/null @@ -1,239 +0,0 @@ -{ - "name": "onboardingCRUD", - "description": "Workflow para CRUD de imagens de onboarding", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('adminOnboarding')" - } - }, - { - "id": "B-LATCHED", - "name": "Backoffice Latched", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('adminOnboarding') && actor_data.actor_id === bag.actor_id" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "SB2", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "SB2", - "name": "Set ActorId To Bag", - "next": "ST5", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "ST5", - "name": "Get onboarding images", - "next": "SB1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/onboarding_images" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set onboarding images to Bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "onboarding_images": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U1", - "name": "User selects what wanna to do", - "next": "F1", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "id": { - "type": "string" - }, - "action": { - "type": "string" - }, - "option": { - "type": "string" - }, - "status": { - "type": "string" - }, - "media_type": { - "type": "string" - }, - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "onboarding_images": { - "$ref": "result.data" - } - }, - "action": "CRUD_ONBOARDING_IMAGES" - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "CREATE": "F3", - "DELETE": "B1", - "default": "E" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "F3", - "name": "Check payload to create", - "next": { - "return": "ST5", - "default": "ST2" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "ST2", - "name": "Request to create onboarding_image", - "next": "ST5", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "data": { - "$ref": "result.activities[0].data" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/onboarding_images" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "B1", - "name": "Set onboarding_image id to Bag", - "next": "ST4", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - } - } - } - }, - { - "id": "ST4", - "name": "Request to delete an enterprise", - "next": "ST5", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/onboarding_images/{{bag.id}}" - }, - "verb": "DELETE", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B-LATCHED" - } - ], - "prepare": [], - "environment": { - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/orderList.json b/samples/blueprints/approva/orderList.json deleted file mode 100644 index 8c650346..00000000 --- a/samples/blueprints/approva/orderList.json +++ /dev/null @@ -1,444 +0,0 @@ -{ - "name": "orderList", - "description": "Workflow para Listagem de pedidos ", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "adminOrderList" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "B1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "B1", - "name": "Set initial value page and page_size to bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "page": 0, - "filters": { - "name": "", - "status": "", - "endDate": "", - "startDate": "", - "mobile_phone": "" - }, - "page_size": 10 - } - } - }, - { - "id": "ST1", - "name": "Get Orders", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests?order=created_at.desc&page={{bag.page}}&page_size={{bag.page_size}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U1", - "name": "List Orders", - "next": "B2", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "orders": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "required": [ - "option" - ], - "properties": { - "id": { - "type": "string" - }, - "option": { - "type": "string" - }, - "status": { - "type": "string" - }, - "buyer_id": { - "type": "string" - }, - "buyer_name": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "realtor_id": { - "type": "string" - }, - "credit_limit": { - "type": "string" - }, - "realtor_name": { - "type": "string" - }, - "buyer_mobile_phone": { - "type": "string" - }, - "realtor_mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_ORDER_LIST", - "activity_manager": "commit" - } - }, - { - "id": "B2", - "name": "Set activity information to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "option": { - "$ref": "result.activities[0].data.option" - }, - "result": { - "$ref": "result" - }, - "filters": { - "$ref": "result.activities[0].data.filters" - }, - "request_id": { - "$ref": "result.activities[0].data.id" - } - } - } - }, - { - "id": "F1", - "name": "Check option", - "next": { - "LIST": "ST1", - "DETAIL": "ST2", - "FILTER": "ST1", - "RELOAD": "B1", - "default": "E", - "PAGINATION": "ST5" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "ST2", - "name": "Detail Order", - "next": "ST3", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/requests?id=eq.{{bag.request_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST3", - "name": "Set order to bag", - "next": "ST4", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "order": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST4", - "name": "Order Schema", - "next": "ST6", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/dev_contracts?key=eq.request_details" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST6", - "name": "Set order schema to bag", - "next": "ST7", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "schema": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST7", - "name": "Get Profile Data", - "next": "ST8", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/profiles?id=eq.{{bag.order.buyer_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST8", - "name": "Set profile data to bag", - "next": "ST9", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST9", - "name": "Get Realtor Data", - "next": "ST10", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/profiles?id=eq.{{bag.order.realtor}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST10", - "name": "Set realtor data to bag", - "next": "U2", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "realtor": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "U2", - "name": "List Detail Order", - "next": "F1", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "realtor": { - "$ref": "bag.realtor" - }, - "request": { - "$ref": "bag.order" - }, - "profiles": { - "main": { - "$js": "({ bag }) => { const title = { name: bag.order.metadata.profiles.main.name.value, email: bag.order.metadata.profiles.main.email.value, phone: bag.party_number }; return { ...bag.order.metadata.profiles.main, title }; };" - }, - "second": { - "$js": "({ bag }) => { const title = { name: bag.order.metadata.profiles.second?.name?.value, email: bag.order.metadata.profiles.second?.email?.value }; return { ...bag.order.metadata.profiles.second, title }; };" - } - }, - "card_data": { - "date": { - "$ref": "bag.profile.created_at" - }, - "name": { - "$ref": "bag.profile.name" - }, - "phone": { - "$ref": "bag.profile.mobile_phone" - } - }, - "ui_schema": { - "$ref": "bag.schema.value.ui_schema" - }, - "activity_schema": { - "$ref": "bag.schema.value.activity_schema" - }, - "additionalProperties": false - }, - "action": "USER_CHOOSE_ACTION_ORDER_DETAIL", - "activity_manager": "commit" - } - }, - { - "id": "ST5", - "name": "Set value page to bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "page": { - "$ref": "result.activities[0].data.page" - } - } - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/orderListV2.json b/samples/blueprints/approva/orderListV2.json deleted file mode 100644 index 3d19befb..00000000 --- a/samples/blueprints/approva/orderListV2.json +++ /dev/null @@ -1,466 +0,0 @@ -{ - "name": "orderListV2", - "description": "Workflow para Listagem de pedidos ", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('adminOrderList')" - } - }, - { - "id": "B-LATCHED", - "name": "Backoffice Latched", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('adminOrderList') && actor_data.actor_id === bag.actor_id" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "B1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "B1", - "name": "Set initial value offset and limit to bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "limit": 10, - "offset": 0, - "filters": { - "status": "", - "end_date": "", - "buyer_name": "", - "start_date": "", - "buyer_phone": "", - "realtor_name": "", - "realtor_phone": "" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "ST1", - "name": "Get Orders", - "next": "U1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests?offset={{bag.offset}}&limit={{bag.limit}}&buyer_name={{bag.filters.buyer_name}}&realtor_name={{bag.filters.realtor_name}}&buyer_phone={{bag.filters.buyer_phone}}&realtor_phone={{bag.filters.realtor_phone}}&status={{bag.filters.status}}&startDate={{bag.filters.start_date}}&endDate={{bag.filters.end_date}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "U1", - "name": "List Orders", - "next": "B2", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "orders": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "required": [ - "option" - ], - "properties": { - "id": { - "type": "string" - }, - "option": { - "type": "string" - }, - "status": { - "type": "string" - }, - "buyer_id": { - "type": "string" - }, - "buyer_name": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "realtor_id": { - "type": "string" - }, - "credit_limit": { - "type": "string" - }, - "realtor_name": { - "type": "string" - }, - "buyer_mobile_phone": { - "type": "string" - }, - "realtor_mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_ORDER_LIST", - "activity_manager": "commit" - } - }, - { - "id": "B2", - "name": "Set activity information to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "option": { - "$ref": "result.activities[0].data.option" - }, - "result": { - "$ref": "result" - }, - "filters": { - "$ref": "result.activities[0].data.filters" - }, - "request_id": { - "$ref": "result.activities[0].data.id" - } - } - } - }, - { - "id": "F1", - "name": "Check option", - "next": { - "LIST": "ST1", - "DETAIL": "ST2", - "FILTER": "ST1", - "RELOAD": "B1", - "default": "E", - "PAGINATION": "ST5" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "ST2", - "name": "Detail Order", - "next": "ST3", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{bag.request_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST3", - "name": "Set order to bag", - "next": "ST4", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "order": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST4", - "name": "Order Schema", - "next": "ST6", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.request_details" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST6", - "name": "Set order schema to bag", - "next": "ST7", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "schema": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST7", - "name": "Get Profile Data", - "next": "ST8", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{bag.order.buyer_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST8", - "name": "Set profile data to bag", - "next": "ST9", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST9", - "name": "Get Realtor Data", - "next": "ST10", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{bag.order.realtor}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST10", - "name": "Set realtor data to bag", - "next": "ST11", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "realtor": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST11", - "name": "Get proofs Data", - "next": "SB1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/{{bag.order.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set proofs data to bag", - "next": "U2", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "proofs": { - "$ref": "result.data.proofs" - } - } - } - }, - { - "id": "U2", - "name": "List Detail Order", - "next": "F1", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "proofs": { - "$ref": "bag.proofs" - }, - "realtor": { - "$ref": "bag.realtor" - }, - "request": { - "$ref": "bag.order" - }, - "profiles": { - "main": { - "$js": "({ bag }) => { const title = { name: bag?.order?.metadata?.profiles?.main?.name?.value, email: bag?.order?.metadata?.profiles?.main?.email?.value, phone: bag?.party_number }; return { ...bag?.order?.metadata?.profiles?.main, title }; };" - }, - "second": { - "$js": "({ bag }) => { const title = { name: bag?.order?.metadata?.profiles?.second?.name?.value, email: bag?.order?.metadata?.profiles.second?.email?.value }; return { ...bag?.order?.metadata?.profiles?.second, title }; };" - } - }, - "card_data": { - "date": { - "$ref": "bag.profile.created_at" - }, - "name": { - "$ref": "bag.profile.name" - }, - "phone": { - "$ref": "bag.profile.mobile_phone" - } - }, - "ui_schema": { - "$ref": "bag.schema.value.ui_schema" - }, - "activity_schema": { - "$ref": "bag.schema.value.activity_schema" - }, - "additionalProperties": false - }, - "action": "USER_CHOOSE_ACTION_ORDER_DETAIL", - "activity_manager": "commit" - } - }, - { - "id": "ST5", - "name": "Set value offset to bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "offset": { - "$ref": "result.activities[0].data.page" - } - } - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B-LATCHED" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/propertiesCRUD.json b/samples/blueprints/approva/propertiesCRUD.json deleted file mode 100644 index 51d8f70c..00000000 --- a/samples/blueprints/approva/propertiesCRUD.json +++ /dev/null @@ -1,519 +0,0 @@ -{ - "name": "propertiesCRUD", - "description": "Workflow para CRUD de imóveis", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('adminProperties')" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "ST5", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST5", - "name": "Get user properties projects", - "next": "SB1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/properties_projects" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set properties projects to Bag", - "next": "ST1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "properties_projects": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST1", - "name": "Request to Mock.io", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "U1", - "name": "User selects what wanna to do", - "next": "SET-ACTION-TO-BAG", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "properties": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "ack": { - "type": "boolean" - }, - "size": { - "type": "number" - }, - "text": "Tem certeza que deseja apagar o imóvel? A ação não poderá ser desfeita.", - "price": { - "type": "string" - }, - "title": "Apagar", - "action": { - "type": "string" - }, - "images": { - "type": "array" - }, - "option": { - "type": "string" - }, - "address": { - "type": "string" - }, - "buttons": [ - { - "type": "primary", - "label": "Sim" - }, - { - "type": "secondary", - "label": "Cancelar" - } - ], - "property_type": { - "type": "string" - }, - "properties_projects_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "USER_CHOOSE_ACTION_PROPERTIES_CRUD" - } - }, - { - "id": "SET-ACTION-TO-BAG", - "name": "Set action on bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "action": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "CREATE": "F3", - "DELETE": "F2", - "UPDATE": "F4", - "default": "E", - "RETURN_LIST": "ST5" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "bag.action" - } - } - } - }, - { - "id": "U3", - "name": "User insert information to create an enterprise", - "next": "F3", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "price", - "size", - "address", - "property_type", - "images" - ], - "properties": { - "id": { - "type": "string" - }, - "size": { - "type": "number" - }, - "price": { - "type": "string" - }, - "images": { - "type": "array" - }, - "option": { - "type": "string" - }, - "address": { - "type": "string" - }, - "property_type": { - "type": "string" - }, - "properties_projects_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "CREATE_PROPERTY" - } - }, - { - "id": "F3", - "name": "Check payload to create", - "next": { - "return": "ST5", - "default": "ST2" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "ST2", - "name": "Request to create an enterprise", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "data": { - "$ref": "result.activities[0].data" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "U4", - "name": "User insert information to UPDATE info", - "next": "F4", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string" - }, - "size": { - "type": "number" - }, - "price": { - "type": "string" - }, - "images": { - "type": "array" - }, - "option": { - "type": "string" - }, - "address": { - "type": "string" - }, - "property_type": { - "type": "string" - }, - "properties_projects_id": { - "type": "string" - } - } - }, - "properties_projects": { - "$ref": "bag.properties_projects" - } - }, - "action": "UPDATE_PROPERTY" - } - }, - { - "id": "F4", - "name": "Check option to update", - "next": { - "return": "ST5", - "default": "B2" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "B2", - "name": "Set enterprise's id to bag", - "next": "ST3", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - }, - "new_data": { - "$ref": "result.activities[0].data" - } - } - } - }, - { - "id": "ST3", - "name": "Request to update an enterprise", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "data": { - "$ref": "bag.new_data" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties/{{bag.id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "U2", - "name": "Confirm delete", - "next": "F2", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "text": "Tem certeza que deseja apagar o imóvel? A ação não poderá ser desfeita.", - "title": "Apagar", - "buttons": [ - { - "type": "primary", - "label": "Sim" - }, - { - "type": "secondary", - "label": "Cancelar" - } - ], - "activity_schema": { - "type": "object", - "required": [ - "ack" - ], - "properties": { - "id": { - "type": "string" - }, - "action": { - "type": "boolean" - } - }, - "additionalProperties": false - } - }, - "action": "CONFIRM_DELETE_PROPERTY" - } - }, - { - "id": "F2", - "name": "Check ACK delete", - "next": { - "true": "B1", - "false": "ST5", - "default": "ST5" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.ack" - } - } - } - }, - { - "id": "B1", - "name": "Set enterprise's id to Bag", - "next": "ST4", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - } - } - } - }, - { - "id": "ST4", - "name": "Request to delete an enterprise", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties/{{bag.id}}" - }, - "verb": "DELETE", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "CONFIRMATION-MESSAGE", - "name": "Request made message", - "next": "SET-ACTION-TO-BAG", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "action": { - "$ref": "bag.action" - }, - "confirm_message": true - }, - "action": "CONFIRMATION_MESSAGE_TO_USER_TO_PROPERTIES", - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/propertiesProjectsCRUD.json b/samples/blueprints/approva/propertiesProjectsCRUD.json deleted file mode 100644 index fe43d9f3..00000000 --- a/samples/blueprints/approva/propertiesProjectsCRUD.json +++ /dev/null @@ -1,512 +0,0 @@ -{ - "name": "propertiesProjectsCRUD", - "description": "Workflow para CRUD de empreendimentos", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('adminPropertiesProjects')" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "ST1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": { - "required": [ - "offset", - "limit" - ], - "properties": { - "limit": { - "type": "integer" - }, - "offset": { - "type": "integer" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "ST1", - "name": "Request to Mock.io", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects/raw?limit={{bag.limit}}&offset={{bag.offset}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "U1", - "name": "User selects what wanna to do", - "next": "SET-ACTION-TO-BAG", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "properties": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "id": { - "type": "string" - }, - "ack": { - "type": "boolean" - }, - "text": "Tem certeza que deseja apagar o empreendimento? A ação não poderá ser desfeita.", - "title": "Apagar", - "action": { - "type": "string" - }, - "images": { - "type": "array" - }, - "option": { - "type": "string" - }, - "buttons": [ - { - "type": "primary", - "label": "Sim" - }, - { - "type": "secondary", - "label": "Cancelar" - } - ], - "latitude": { - "type": "string" - }, - "longitude": { - "type": "string" - }, - "acessories": { - "type": "string" - }, - "credit_limit": { - "type": "string" - }, - "properties_ids": { - "type": "array" - }, - "region_description": { - "type": "string" - }, - "project_description": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_PROPETIES_PROJECT_CRUD" - } - }, - { - "id": "SET-ACTION-TO-BAG", - "name": "Set action to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "action": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "CREATE": "F3", - "DELETE": "F2", - "UPDATE": "F4", - "default": "E", - "FETCH_MORE": "B3", - "RETURN_LIST": "ST1" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "bag.action" - } - } - } - }, - { - "id": "U3", - "name": "User insert information to create an enterprise", - "next": "F3", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "project_description", - "credit_limit", - "external_ids" - ], - "properties": { - "images": { - "type": "array" - }, - "option": { - "type": "string" - }, - "latitude": { - "type": "string" - }, - "longitude": { - "type": "string" - }, - "acessories": { - "type": "string" - }, - "credit_limit": { - "type": "string" - }, - "properties_ids": { - "type": "array" - }, - "region_description": { - "type": "string" - }, - "project_description": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CREATE_PROPERTY_PROJECT" - } - }, - { - "id": "F3", - "name": "Check payload to create", - "next": { - "return": "ST1", - "default": "ST2" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "ST2", - "name": "Request to create an enterprise", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "data": { - "$ref": "result.activities[0].data" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "U4", - "name": "User insert information to UPDATE info", - "next": "F4", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string" - }, - "images": { - "type": "array" - }, - "option": { - "type": "string" - }, - "latitude": { - "type": "string" - }, - "longitude": { - "type": "string" - }, - "acessories": { - "type": "string" - }, - "credit_limit": { - "type": "string" - }, - "region_description": { - "type": "string" - }, - "project_description": { - "type": "string" - } - } - } - }, - "action": "UPDATE_PROPERTY_PROJECT" - } - }, - { - "id": "F4", - "name": "Check option to update", - "next": { - "return": "ST1", - "default": "B2" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "B2", - "name": "Set enterprise's id to bag", - "next": "ST3", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - }, - "new_data": { - "$ref": "result.activities[0].data" - } - } - } - }, - { - "id": "ST3", - "name": "Request to update an enterprise", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "data": { - "$ref": "bag.new_data" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects/{{bag.id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "U2", - "name": "Confirm delete", - "next": "F2", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "text": "Tem certeza que deseja apagar o empreendimento? A ação não poderá ser desfeita.", - "title": "Apagar", - "buttons": [ - { - "type": "primary", - "label": "Sim" - }, - { - "type": "secondary", - "label": "Cancelar" - } - ], - "activity_schema": { - "type": "object", - "required": [ - "ack" - ], - "properties": { - "id": { - "type": "string" - }, - "action": { - "type": "boolean" - } - }, - "additionalProperties": false - } - }, - "action": "CONFIRM_DELETE_PROPERTY_PROJECT" - } - }, - { - "id": "F2", - "name": "Check ACK delete", - "next": { - "true": "B1", - "false": "ST1", - "default": "ST1" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.ack" - } - } - } - }, - { - "id": "B1", - "name": "Set enterprise's id to Bag", - "next": "ST4", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - } - } - } - }, - { - "id": "ST4", - "name": "Request to delete an enterprise", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects/{{bag.id}}" - }, - "verb": "DELETE", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "B3", - "name": "Set offset to bag", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "offset": { - "$js": "({bag}) => bag.offset + bag.limit" - } - } - } - }, - { - "id": "CONFIRMATION-MESSAGE", - "name": "Request made message", - "next": "SET-ACTION-TO-BAG", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "action": { - "$ref": "bag.action" - }, - "confirm_message": true - }, - "action": "CONFIRMATION_MESSAGE_TO_USER_ON_PROPERTIES_PROJECTS_CRUD", - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B" - } - ], - "prepare": [], - "environment": { - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/realtorCRUD.json b/samples/blueprints/approva/realtorCRUD.json deleted file mode 100644 index 6eaba870..00000000 --- a/samples/blueprints/approva/realtorCRUD.json +++ /dev/null @@ -1,828 +0,0 @@ -{ - "name": "realtorCRUD", - "description": "Workflow para CRUD de corretores", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('adminRealtors')" - } - }, - { - "id": "B-LATCHED", - "name": "Backoffice Latched", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('adminRealtors') && bag.actor_id === actor_data.actor_id" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "ST1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST1", - "name": "Get realtors", - "next": "SB1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/list/realtor" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set realtors to Bag", - "next": "ST10", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - }, - "realtors": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST10", - "name": "List active teams", - "next": "SB5", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/list-realtor-teams/active" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB5", - "name": "Set realtors to Bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "teams": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U1", - "name": "User selects what wanna to do", - "next": "SB2", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "teams": { - "$ref": "bag.teams" - }, - "realtors": { - "$ref": "bag.realtors" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "action": { - "type": "string" - }, - "mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_REALTORS_CRUD" - } - }, - { - "id": "SB2", - "name": "Set activity information to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - }, - "name": { - "$ref": "result.activities[0].data.name" - }, - "actor": { - "$ref": "result.activities[0].data.mobile_phone" - }, - "email": { - "$ref": "result.activities[0].data.email" - }, - "action": { - "$ref": "result.activities[0].data.action" - }, - "option": { - "$ref": "result.activities[0].data.option" - }, - "team_id": { - "$ref": "result.activities[0].data.team_id" - }, - "mobile_phone": { - "$ref": "result.activities[0].data.mobile_phone" - } - } - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "CREATE": "ST7", - "DELETE": "F4", - "UPDATE": "F3", - "default": "E", - "UPDATE_NEW_PHONE": "ST8", - "VERIFICATION_NUMBER_PHONE": "ST1" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.action" - } - } - } - }, - { - "id": "ST7", - "name": "Verification number phone", - "next": "F5", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "email": { - "$ref": "bag.email" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/verify/{{bag.mobile_phone}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "F5", - "name": "Check number phone verification", - "next": { - "true": "F2", - "default": "U2" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST8", - "name": "Verification number phone update realtor", - "next": "F6", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "email": { - "$ref": "bag.email" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/verify/{{bag.mobile_phone}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "F6", - "name": "Check number phone verification update realtor", - "next": { - "true": "F3", - "default": "U2" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U2", - "name": "Open cellular number duplication modal", - "next": "SB4", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "realtors": { - "$ref": "bag.realtors" - }, - "toggleModal": true, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "action": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_REALTORS_VERIFICATION_PHONE" - } - }, - { - "id": "SB4", - "name": "Save action bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "action": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "F2", - "name": "Check payload to create", - "next": { - "return": "ST1", - "default": "ST2" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.option" - } - } - } - }, - { - "id": "ST2", - "name": "Get account settings", - "next": "SB3", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB3", - "name": "Save default claims to bag", - "next": "ST3", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "account_id": { - "$ref": "result.data[0].id" - }, - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "ST3", - "name": "Create actor", - "next": "ST4", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "CreateActorTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.mobile_phone" - }, - "claims": { - "$ref": "bag.default_claims" - }, - "account_id": { - "$ref": "bag.account_id" - } - } - } - }, - { - "id": "ST4", - "name": "Create profile", - "next": "SET-REALTOR-ID-TO-BAG", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "role": "REALTOR", - "email": { - "$ref": "bag.email" - }, - "actor_id": { - "$ref": "result.actor.id" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/create" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-REALTOR-ID-TO-BAG", - "name": "Save realtor id to bag", - "next": "CREATE-PARTY", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "realtor_id": { - "$ref": "result.data.id" - } - } - } - }, - { - "id": "CREATE-PARTY", - "name": "Create party on CHAT Service.", - "next": "ST12", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "role": "REALTOR", - "actor": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/create-party-by-actor" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST12", - "name": "Set team to realtor", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "team_id": { - "$ref": "bag.team_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/set-realtor-team/{{bag.realtor_id}}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "F3", - "name": "Check option to update", - "next": { - "return": "ST1", - "default": "GET-ACCOUNT-INFO" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.option" - } - } - } - }, - { - "id": "GET-ACCOUNT-INFO", - "name": "Get account settings", - "next": "SET-CLAIMS-TO-BAG", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SET-CLAIMS-TO-BAG", - "name": "Save default claims to bag", - "next": "ST5", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "ST5", - "name": "update profile", - "next": "ST9", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "email": { - "$ref": "bag.email" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/{{bag.id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST9", - "name": "update actor", - "next": "UPDATE-PARTY", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.actor" - }, - "claims": { - "$ref": "bag.default_claims" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.WORKFLOW_API}}}/actor/update/{{result.data.actor_id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "UPDATE-PARTY", - "name": "Update Party on CHAT Service.", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.user.mobile_phone" - }, - "new_actor": { - "$ref": "bag.actor" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/update-party-by-actor" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "F4", - "name": "Check option to inactivate", - "next": { - "return": "ST1", - "default": "ST6" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.option" - } - } - } - }, - { - "id": "ST6", - "name": "inactivate profile", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/disable/{{bag.id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CONFIRMATION-MESSAGE", - "name": "Request made message", - "next": "SET-ACTION-TO-BAG", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "action": { - "$ref": "bag.action" - }, - "confirm_message": true - }, - "action": "CONFIRMATION_MESSAGE_TO_USER_ON_REALTORS_CRUD", - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "SET-ACTION-TO-BAG", - "name": "Set activity information to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "action": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B-LATCHED" - } - ], - "prepare": [], - "environment": { - "JWT_KEY": "JWT_KEY_BP", - "CHAT_API": "CHAT_API", - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API", - "WORKFLOW_API": "WORKFLOW_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/realtorChat.json b/samples/blueprints/approva/realtorChat.json deleted file mode 100644 index 05124a68..00000000 --- a/samples/blueprints/approva/realtorChat.json +++ /dev/null @@ -1,356 +0,0 @@ -{ - "name": "realtorChat", - "description": "Fluxo de chat entre o corretor e o cliente", - "blueprint_spec": { - "lanes": [ - { - "id": "L", - "name": "LoggedUser", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "botGeneral" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - }, - { - "id": "B&CP", - "name": "BackOffice", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "or", - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "or", - [ - "=", - "v", - [ - "`", - "adminRequests" - ] - ], - [ - "=", - "v", - [ - "`", - "botGeneral" - ] - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "get", - "actor_data", - [ - "`", - "actor_id" - ] - ] - ] - ], - [ - "get", - "bag", - [ - "`", - "actors_ids" - ] - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "S", - "name": "Start node", - "next": "ST1", - "type": "Start", - "lane_id": "L", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "chat_id" - ], - "properties": { - "chat_id": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "ST1", - "name": "Get actors participants and chat history", - "next": "SB1", - "type": "SystemTask", - "lane_id": "L", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set ActorId To Bag and chat history", - "next": "U1", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "actors_ids": { - "$ref": "result.data.chat_participants_actors_ids" - }, - "chat_details": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U1", - "name": "Send Message or back-office admin chat", - "next": "SB2", - "type": "UserTask", - "lane_id": "B&CP", - "parameters": { - "input": { - "chat_details": { - "$ref": "bag.chat_details" - }, - "party_number": { - "$ref": "bag.chat_details.buyer_number" - }, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "message": { - "type": "string" - }, - "external_id": { - "type": "string" - }, - "mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "SEND_MESSAGE_OR_ADMIN_CHAT" - } - }, - { - "id": "SB2", - "name": "Set activity result to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "L", - "category": "SetToBag", - "parameters": { - "input": { - "activity_result": { - "$ref": "result.activities[0].data" - } - } - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "default": "EXIT-CHAT", - "SEND_MESSAGE": "ST2" - }, - "type": "Flow", - "lane_id": "B&CP", - "parameters": { - "input": { - "key": { - "$ref": "bag.activity_result.action" - } - } - } - }, - { - "id": "ST2", - "name": "Get chat participant by mobile phone", - "next": "ST3", - "type": "SystemTask", - "lane_id": "B&CP", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat/chat_participant_by_mobile_phone/{{bag.activity_result.mobile_phone}}/{{bag.chat_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "ST3", - "name": "Save Message", - "next": "ST1", - "type": "SystemTask", - "lane_id": "B&CP", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.activity_result.mobile_phone" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "content": { - "$ref": "bag.activity_result.message" - }, - "external_id": { - "$ref": "bag.activity_result.external_id" - }, - "chat_participant_id": { - "$ref": "result.data.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/messages" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "EXIT-CHAT", - "name": "Finish Chat", - "next": null, - "type": "Finish", - "lane_id": "B&CP" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/recommendations.json b/samples/blueprints/approva/recommendations.json deleted file mode 100644 index dc5b6e30..00000000 --- a/samples/blueprints/approva/recommendations.json +++ /dev/null @@ -1,300 +0,0 @@ -{ - "name": "recommendations", - "description": "Workflow para recomendação", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "adminRecommendations" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "ST1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST1", - "name": "Request to Mock API to GET Request", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": "https://5fdca9a048321c001701201d.mockapi.io/Request", - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "U1", - "name": "List requests to user to select one", - "next": "F1", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "requests": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "action": { - "type": "string" - }, - "profile_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_REQUEST" - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "return": "E", - "default": "SB1" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "SB1", - "name": "Set profile id to bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "profile_id": { - "$ref": "result.activities[0].data.profile_id" - } - } - } - }, - { - "id": "ST2", - "name": "Get User Properties", - "next": "SB2", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/properties_projects?list_type=home&limit=10&offset=0&profile_id={{bag.profile_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB2", - "name": "Set Properties Projects to Bag", - "next": "U2", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "properties_projects": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U2", - "name": "List Property Projects", - "next": "F2", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "buyer_id": { - "type": "string" - }, - "estate_agent_id": { - "type": "string" - }, - "properties_projects_id": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "PROPERTIES_PROJECTS_LIST" - } - }, - { - "id": "F2", - "name": "Check action", - "next": { - "return": "E", - "default": "SB3" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "SB3", - "name": "Set data to bag", - "next": "ST3", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_id": { - "$ref": "result.activities[0].data.buyer_id" - }, - "estate_agent_id": { - "$ref": "result.activities[0].data.estate_agent_id" - }, - "properties_projects_id": { - "$ref": "result.activities[0].data.properties_projects_id" - } - } - } - }, - { - "id": "ST3", - "name": "Recommend to user", - "next": "E", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "buyer_id": { - "$ref": "bag.buyer_id" - }, - "estate_agent_id": { - "$ref": "bag.estate_agent_id" - }, - "properties_projects_id": { - "$ref": "bag.properties_projects_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/recommend" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B" - } - ], - "prepare": [], - "environment": { - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/remindClient.json b/samples/blueprints/approva/remindClient.json deleted file mode 100644 index 4ebff447..00000000 --- a/samples/blueprints/approva/remindClient.json +++ /dev/null @@ -1,238 +0,0 @@ -{ - "name": "remindClient", - "description": "Sub process to remind client to finish his request.", - "blueprint_spec": { - "lanes": [ - { - "id": "BOT_X_BACKOFFICE", - "name": "BOT_X_BACKOFFICE", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "or", - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "or", - [ - "=", - "v", - [ - "`", - "adminRequests" - ] - ], - [ - "=", - "v", - [ - "`", - "botGeneral" - ] - ], - [ - "=", - "v", - [ - "`", - "botRealtor" - ] - ], - [ - "=", - "v", - [ - "`", - "botLead" - ] - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "START", - "name": "Start node", - "next": "REMIND-CLIENT-1", - "type": "Start", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "reply_count", - "party_number" - ], - "properties": { - "reply_count": { - "type": "number" - }, - "party_number": { - "type": "string" - } - }, - "additionalProperties": true - } - } - }, - { - "id": "REMIND-CLIENT-1", - "name": "Check if reply_count reach five to end new_request process because client doesn't answer", - "next": { - "true": "REMIND-CLIENT-3", - "default": "REMIND-CLIENT-2" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.reply_count === 6" - } - } - } - }, - { - "id": "REMIND-CLIENT-2", - "name": "Notify client to continue his request", - "next": "EXIT", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": "Bela: Olá, tudo bem? Só vim te lembrar para continuar o seu processo de aprovação de crédito e conquistar o grande sonho da casa própria.", - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_CLIENT_FINISH_REQUEST", - "timeout": 1 - } - }, - { - "id": "REMIND-CLIENT-3", - "name": "Notify client to continue request.", - "next": "REMIND-CLIENT-4", - "type": "UserTask", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "message": { - "$mustache": "Bela: Oi, tudo bem? Notei que você não prosseguiu com o envio dos seus dados.\nVocê deseja continuar com o processo de aprovação de crédito?\n1 - Sim, quero continuar. \n2 - Não, desejo encerrar.\n(digite 1 ou 2 para prosseguir)." - }, - "party_number": { - "$ref": "bag.party_number" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CAPTURING_WILL_TO_PROCEED", - "timeout": 60 - } - }, - { - "id": "REMIND-CLIENT-4", - "name": "Set user consent to bag", - "next": "REMIND-CLIENT-5", - "type": "SystemTask", - "lane_id": "BOT_X_BACKOFFICE", - "category": "SetToBag", - "parameters": { - "input": { - "consent": { - "$js": "({result}) => result.is_continue ? '2' : result.activities[0].data.message" - }, - "is_continue": { - "$js": "({result}) => result.is_continue ? true : false" - } - } - } - }, - { - "id": "REMIND-CLIENT-5", - "name": "Check user consent", - "next": { - "1": "EXIT", - "2": "EXIT-REQUEST", - "default": "REMIND-CLIENT-3" - }, - "type": "Flow", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "key": { - "$ref": "bag.consent" - } - } - } - }, - { - "id": "EXIT", - "name": "Finish remindClient", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "request_continue": true - } - } - }, - { - "id": "EXIT-REQUEST", - "name": "Finish remindClient", - "next": null, - "type": "Finish", - "lane_id": "BOT_X_BACKOFFICE", - "parameters": { - "input": { - "request_continue": false - } - } - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/request.json b/samples/blueprints/approva/request.json deleted file mode 100644 index f0b14c9a..00000000 --- a/samples/blueprints/approva/request.json +++ /dev/null @@ -1,1091 +0,0 @@ -{ - "name": "request", - "description": "Fluxo único de request", - "blueprint_spec": { - "lanes": [ - { - "id": "A", - "name": "Anonymous", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "anonymous" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - }, - { - "id": "B", - "name": "BackOffice", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "adminRequests" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start Request Workflow", - "next": "U1", - "type": "Start", - "lane_id": "A", - "parameters": { - "input_schema": {} - } - }, - { - "id": "U1", - "name": "Realtor or buyer started?", - "next": "SB1", - "type": "UserTask", - "lane_id": "A", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "option" - ], - "properties": { - "option": { - "type": "string" - }, - "actor_number": { - "type": "string" - }, - "realtor_number": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "CHOOSE_START_WAY" - } - }, - { - "id": "SB1", - "name": "Set actor_number to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "mobile_phone": { - "$ref": "result.activities[0].data.actor_number" - } - } - } - }, - { - "id": "F1", - "name": "Default Flow", - "next": { - "default": "ST1", - "realtor": "U2" - }, - "type": "Flow", - "lane_id": "A", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.option" - } - } - } - }, - { - "id": "ST1", - "name": "Get profile", - "next": "SB2", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/profiles?mobile_phone=eq.{{bag.mobile_phone}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB2", - "name": "Set buyer profile to bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_profile": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "ST2", - "name": "Create Request", - "next": "SB5", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "buyer_profile_id": { - "$ref": "bag.buyer_profile.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB5", - "name": "Set request to bag", - "next": "ST14", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST14", - "name": "Assign Realtor to Request", - "next": "ST6", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/assign" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST6", - "name": "Set Active Request", - "next": "SB6", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "new_request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/active" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB6", - "name": "Set buyer profile with new current_request to bag", - "next": "ST16", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_profile": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST16", - "name": "Create Chat", - "next": "SB9", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "chat_type": "BOT", - "request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/chat" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB9", - "name": "Set chat_id to bag", - "next": "ST17", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "chat_id": { - "$ref": "result.data.id" - } - } - } - }, - { - "id": "ST17", - "name": "Get number of uploaded documentation", - "next": "F3", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/proofs?request_id=eq.{{bag.request.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F3", - "name": "User still uploading documents?", - "next": { - "true": "U3", - "default": "U9" - }, - "type": "Flow", - "lane_id": "A", - "parameters": { - "input": { - "key": { - "$js": "({result}) => (result.data.length < 6) ? true : false" - } - } - } - }, - { - "id": "U3", - "name": "User uploading documents", - "next": "ST7", - "type": "UserTask", - "lane_id": "A", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "chat_id": { - "$ref": "bag.chat_id" - }, - "properties": { - "external_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "number_of_uploaded_documents": { - "$ref": "result.data.length" - } - }, - "action": "USER_UPLOADING_DOCUMENTS" - } - }, - { - "id": "U9", - "name": "Notify that all documents were received", - "next": "ST8", - "type": "UserTask", - "lane_id": "A", - "parameters": { - "input": {}, - "action": "NOTIFY_DOCUMENTS_RECEIVED", - "timeout": 60 - } - }, - { - "id": "ST8", - "name": "Update request status", - "next": "ST9-B", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "status": "DOCUMENTS_RECEIVED" - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST9-B", - "name": "Get request details", - "next": "SB7-B", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/{{bag.request.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB7-B", - "name": "Set request details to bag", - "next": "U4-B", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "request_details": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U4-B", - "name": "Backoffice request analysis", - "next": "F4-B", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "request": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "type": { - "type": "string" - }, - "action": { - "type": "string" - }, - "message": { - "type": "string" - }, - "credit_limit": { - "type": "string" - }, - "proof_status": { - "type": "string" - }, - "attachment_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "client_mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "action": "REQUEST_ANALYSIS" - } - }, - { - "id": "F4-B", - "name": "Check Backoffcie action", - "next": { - "default": "ST12-B", - "approve_request": "ST11-B", - "classify_documents": "SB8-B" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "U7-B", - "name": "Backoffice rejects request,and set message", - "next": "ST12-B", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "request": { - "$ref": "bag.request_details" - }, - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - }, - "client_mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "action": "REJECT_REQUEST" - } - }, - { - "id": "ST12-B", - "name": "Reject Request", - "next": "E", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/reject" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "U6-B", - "name": "Backoffice approves request,set credit_limits and message", - "next": "ST11-B", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "request": { - "$ref": "bag.request_details" - }, - "activity_schema": { - "type": "object", - "required": [ - "credit_limit", - "message" - ], - "properties": { - "message": { - "type": "string" - }, - "credit_limit": { - "type": "string" - } - }, - "additionalProperties": false - }, - "client_mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "action": "APPROVE_REQUEST" - } - }, - { - "id": "ST11-B", - "name": "Approve Request", - "next": "E", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "credit_limit": { - "$ref": "result.activities[0].data.credit_limit" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/requests/approve" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "U5-B", - "name": "Backoffice classify documents", - "next": "SB8-B", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "request": { - "$ref": "bag.request_details" - }, - "activity_schema": { - "type": "object", - "required": [ - "attachment_id", - "proof_status" - ], - "properties": { - "type": { - "type": "string" - }, - "proof_status": { - "type": "string" - }, - "attachment_id": { - "type": "string" - } - }, - "additionalProperties": false - }, - "client_mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "action": "CLASSIFY_DOCUMENTS" - } - }, - { - "id": "SB8-B", - "name": "Set attachment_id and type to bag", - "next": "ST10-B", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "type": { - "$ref": "result.activities[0].data.type" - }, - "proof_status": { - "$ref": "result.activities[0].data.proof_status" - }, - "attachment_id": { - "$ref": "result.activities[0].data.attachment_id" - } - } - } - }, - { - "id": "ST10-B", - "name": "Update attachments", - "next": "ST13-B", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "type": { - "$ref": "bag.type" - } - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/attachments?id=eq.{{bag.attachment_id}}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST13-B", - "name": "Update proofs", - "next": "ST9-B", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": { - "status": { - "$ref": "bag.proof_status" - } - }, - "request": { - "url": { - "$mustache": "http://postgrest:3000/proofs?attachment_id=eq.{{bag.attachment_id}}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST7", - "name": "Create Proofs and Attachments", - "next": "ST17", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "external_id": { - "$ref": "result.activities[0].data.external_id" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/proofs" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "U2", - "name": "User has given consent?", - "next": "F2", - "type": "UserTask", - "lane_id": "A", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "consent" - ], - "properties": { - "consent": { - "type": "boolean" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CONSENT" - } - }, - { - "id": "F2", - "name": "Check Consent", - "next": { - "true": "ST3", - "default": "E" - }, - "type": "Flow", - "lane_id": "A", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.consent" - } - } - } - }, - { - "id": "ST3", - "name": "Get account settings", - "next": "SB3", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://postgrest:3000/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB3", - "name": "Save default claims to bag", - "next": "ST15", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "account_id": { - "$ref": "result.data[0].id" - }, - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "ST15", - "name": "Get User information", - "next": "F6", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/{{ bag.mobile_phone }}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "F6", - "name": "User aleready exists?", - "next": { - "true": "SB4", - "default": "ST4" - }, - "type": "Flow", - "lane_id": "A", - "parameters": { - "input": { - "key": { - "$js": "({result}) => (result.data.id) ? true : false" - } - } - } - }, - { - "id": "ST4", - "name": "Create actor", - "next": "ST5", - "type": "SystemTask", - "lane_id": "A", - "category": "CreateActorTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.mobile_phone" - }, - "claims": { - "$ref": "bag.default_claims" - }, - "account_id": { - "$ref": "bag.account_id" - } - } - } - }, - { - "id": "ST5", - "name": "Create profile", - "next": "SB4", - "type": "SystemTask", - "lane_id": "A", - "category": "HTTP", - "parameters": { - "input": { - "actor_id": { - "$ref": "result.actor.id" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/profiles/create" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB4", - "name": "Set buyer profile to bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "A", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_profile": { - "$ref": "result.data" - } - } - } - }, - { - "id": "E", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "A" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/requestV3.json b/samples/blueprints/approva/requestV3.json deleted file mode 100644 index f59e9ba6..00000000 --- a/samples/blueprints/approva/requestV3.json +++ /dev/null @@ -1,2938 +0,0 @@ -{ - "name": "requestV3", - "description": "Fluxo para iniciar um pedido de análise de crédito.", - "blueprint_spec": { - "lanes": [ - { - "id": "REQUESTBOT", - "name": "Buyer", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "eval", - [ - "apply", - "or", - [ - "map", - [ - "fn", - [ - "v" - ], - [ - "=", - "v", - [ - "`", - "requestBot" - ] - ] - ], - [ - "get", - "actor_data", - [ - "`", - "claims" - ] - ] - ] - ] - ] - ] - }, - { - "id": "CONVERSION-MANAGER", - "name": "An operator with manager rules", - "rule": [ - "fn", - [ - "actor_data", - "bag" - ], - [ - "=", - [ - "get", - "bag", - [ - "`", - "manager_actor_id" - ] - ], - [ - "get", - "actor_data", - [ - "`", - "actor_id" - ] - ] - ] - ] - } - ], - "nodes": [ - { - "id": "SA", - "name": "Start Request v3", - "next": "PARAMETERS-BAG", - "type": "Start", - "lane_id": "REQUESTBOT", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "party_number", - "chat_id", - "request" - ], - "properties": { - "chat_id": { - "type": "string" - }, - "request": { - "type": "object" - }, - "profiles": { - "type": "object" - }, - "party_number": { - "type": "string" - }, - "realtor_number": { - "type": "string" - } - } - } - } - }, - { - "id": "PARAMETERS", - "name": "Fetch parameters for the process", - "next": "PARAMETERS-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/dev_contracts?key=eq.request_PARAMETERS" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - }, - "max_content_length": 10000 - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "PARAMETERS-BAG", - "name": "bag parameters", - "next": "PROFILE-PROVIDED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "buyer": { - "$ref": "actor_data" - }, - "settings": { - "$ref": "result.data[0].value" - }, - "author_id": { - "$ref": "environment.XPTO" - } - } - } - }, - { - "id": "PROFILE-PROVIDED", - "name": "Verify if the profile was provided", - "next": { - "default": "PROFILE_TYPE-BAG", - "undefined": "PROFILE-BAG" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.profiles" - } - } - } - }, - { - "id": "PROFILE-BAG", - "name": "Set profile to bag", - "next": "PROFILE_TYPE-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "main": {}, - "second": {} - } - } - } - }, - { - "id": "PROFILE_TYPE-BAG", - "name": "Set profiles type to bag", - "next": "UPDATE-REQUEST-STATUS-AWAITING_CONSENT-ON-DB", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profile_type": "main" - } - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING_CONSENT-ON-DB", - "name": "Update request status to AWAITING_CONSENT on database", - "next": "UPDATE-REQUEST-STATUS-AWAITING_CONSENT-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "AWAITING_CONSENT" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING_CONSENT-TO-BAG", - "name": "update request status to AWAITING_CONSENT to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-CONSENT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'AWAITING_CONSENT' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-CONSENT", - "name": "Notify status to realtor", - "next": "CONSENT-GETINFO", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "AGUARDANDO CONSENTIMENTO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "CONSENT-GETINFO", - "name": "Submit consent", - "next": "CONSENT-RESULT", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "consent", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$js": "({bag}) => bag.profiles[bag.profile_type]" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "CONSENT-RESULT", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CONSENT-RESPONSE", - "default": "UPDATE-REQUEST-STATUS-NO_CONSENT-ON-DB", - "FAIL-QUIT": "UPDATE-REQUEST-STATUS-NO_CONSENT-ON-DB", - "FAIL-TIMEOUT": "UPDATE-REQUEST-STATUS-NO_CONSENT-ON-DB", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CONSENT-RESPONSE", - "NEXT-QUESTION": "NAME-GETINFO", - "RETURN-CLIENT": "CONSENT-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CONSENT-RESPONSE", - "name": "Verify getInfo response", - "next": { - "1": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-DOCS", - "default": "UPDATE-REQUEST-STATUS-NO_CONSENT-ON-DB" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.profile.consent.value" - } - } - } - }, - { - "id": "UPDATE-REQUEST-STATUS-NO_CONSENT-ON-DB", - "name": "Update request status to NO_CONSENT on database", - "next": "UPDATE-REQUEST-STATUS-NO_CONSENT-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "NO_CONSENT" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-NO_CONSENT-TO-BAG", - "name": "update request status to NO_CONSENT to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-NO-CONSENT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'NO_CONSENT' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-NO-CONSENT", - "name": "Notify status to realtor", - "next": "CLOSE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "SEM CONSENTIMENTO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-DOCS", - "name": "Notify status to realtor", - "next": "NICKNAME-GETINFO", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "AGUARDANDO DOCUMENTOS", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "NICKNAME-GETINFO", - "name": "Submit nickname", - "next": "NICKNAME-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "nickname", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$js": "({bag}) => bag.profiles[bag.profile_type]" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "NICKNAME-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "NAME-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "NAME-GETINFO", - "NEXT-QUESTION": "NAME-GETINFO", - "RETURN-CLIENT": "CONSENT-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "NAME-GETINFO", - "name": "Submit name", - "next": "NAME-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "name", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "NAME-GETINFO-SECOND_BUYER", - "name": "Submit name", - "next": "NAME-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "name", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$js": "({bag}) => bag.profiles[bag.profile_type]" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "NAME-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "EMAIL-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "EMAIL-GETINFO", - "NEXT-QUESTION": "EMAIL-GETINFO", - "RETURN-CLIENT": "NICKNAME-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "EMAIL-GETINFO", - "name": "Submit email", - "next": "EMAIL-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "email", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "EMAIL-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "ID-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "ID-GETINFO", - "NEXT-QUESTION": "ID-GETINFO", - "RETURN-CLIENT": "NAME-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "ID-GETINFO", - "name": "Submit CNH or RG", - "next": "ID-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "document_type", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "ID-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "ID-DOC_TYPE", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "ID-DOC_TYPE", - "RETURN-CLIENT": "EMAIL-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "ID-DOC_TYPE", - "name": "Flow RG or CNH", - "next": { - "1": "CNH-FRONT-GETINFO", - "default": "RG-FRONT-GETINFO" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.profile.document_type.value" - } - } - } - }, - { - "id": "RG-FRONT-GETINFO", - "name": "Submit RG front side", - "next": "RG-FRONT-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "rg_front", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "RG-FRONT-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "RG-BACK-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "RG-BACK-GETINFO", - "NEXT-QUESTION": "RG-BACK-GETINFO", - "RETURN-CLIENT": "ID-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "RG-BACK-GETINFO", - "name": "Submit RG back side", - "next": "RG-BACK-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "rg_back", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "RG-BACK-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CPF-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CPF-GETINFO", - "NEXT-QUESTION": "CPF-GETINFO", - "RETURN-CLIENT": "RG-FRONT-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CPF-GETINFO", - "name": "Submit CPF", - "next": "CPF-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "cpf", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "CPF-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "ADDRESS-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "ADDRESS-GETINFO", - "NEXT-QUESTION": "ADDRESS-GETINFO", - "RETURN-CLIENT": "RG-BACK-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CNH-FRONT-GETINFO", - "name": "Submit CNH front side", - "next": "CNH-FRONT-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "cnh_front", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "CNH-FRONT-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CNH-BACK-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CNH-BACK-GETINFO", - "NEXT-QUESTION": "CNH-BACK-GETINFO", - "RETURN-CLIENT": "ID-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CNH-BACK-GETINFO", - "name": "Submit CNH back side", - "next": "CNH-BACK-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "cnh_back", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "CNH-BACK-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "NATURALNESS-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "NATURALNESS-GETINFO", - "NEXT-QUESTION": "NATURALNESS-GETINFO", - "RETURN-CLIENT": "CNH-FRONT-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "NATURALNESS-GETINFO", - "name": "Submit native", - "next": "NATURALNESS-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "naturalness", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "NATURALNESS-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "ADDRESS-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "ADDRESS-GETINFO", - "NEXT-QUESTION": "ADDRESS-GETINFO", - "RETURN-CLIENT": "CNH-BACK-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "ADDRESS-GETINFO", - "name": "Submit residence proof", - "next": "ADDRESS-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "address_receipt", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "ADDRESS-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CIVIL_STATE-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CIVIL_STATE-GETINFO", - "NEXT-QUESTION": "CIVIL_STATE-GETINFO", - "RETURN-CLIENT": "ID-DOC_TYPE", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CIVIL_STATE-GETINFO", - "name": "Submit civil status", - "next": "CIVIL_STATE-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "civil_state", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "CIVIL_STATE-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CIVIL_STATE_TYPE", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CIVIL_STATE_TYPE", - "NEXT-QUESTION": "CIVIL_STATE_TYPE", - "RETURN-CLIENT": "ADDRESS-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CIVIL_STATE_TYPE", - "name": "Flow civil status", - "next": { - "1": "STABLE_UNION-GETINFO", - "default": "INCOME_PROOF_TYPE-GETINFO" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.profile.civil_state.value" - } - } - } - }, - { - "id": "STABLE_UNION-GETINFO", - "name": "Submit stable union", - "next": "STABLE_UNION-STATUS", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "stable_union", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "STABLE_UNION-STATUS", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "INCOME_PROOF_TYPE-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "INCOME_PROOF_TYPE-GETINFO", - "NEXT-QUESTION": "INCOME_PROOF_TYPE-GETINFO", - "RETURN-CLIENT": "CIVIL_STATE-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "INCOME_PROOF_TYPE-GETINFO", - "name": "Submit proof income type", - "next": "INCOME_PROOF_TYPE-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "income_proof_type", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "INCOME_PROOF_TYPE-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "INCOME_TYPE", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "INCOME_TYPE", - "NEXT-QUESTION": "INCOME_TYPE", - "RETURN-CLIENT": "STABLE_UNION-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "INCOME_TYPE", - "name": "Flow Income Type", - "next": { - "1": "PAYCHECK-GETINFO", - "2": "BALANCE-GETINFO", - "3": "PRO_LABORE-GETINFO", - "default": "FGTS-ELEGIBLE", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "NEXT-QUESTION": "INCOME_TYPE", - "RETURN-CLIENT": "STABLE_UNION-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.profile.income_proof_type.value" - } - } - } - }, - { - "id": "PAYCHECK-GETINFO", - "name": "Submit contracheque", - "next": "PAYCHECK-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "income_proof_paycheck", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "PAYCHECK-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "ADMISSION-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "ADMISSION-GETINFO", - "NEXT-QUESTION": "ADMISSION-GETINFO", - "RETURN-CLIENT": "INCOME_PROOF_TYPE-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "ADMISSION-GETINFO", - "name": "Submit admission date", - "next": "ADMISSION-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "admission_date", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "ADMISSION-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CAREER_TIME-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CAREER_TIME-GETINFO", - "NEXT-QUESTION": "CAREER_TIME-GETINFO", - "RETURN-CLIENT": "PAYCHECK-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "BALANCE-GETINFO", - "name": "Submit bank statement", - "next": "BALANCE-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "income_proof_balance", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "BALANCE-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "PROFESSION-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "PROFESSION-GETINFO", - "NEXT-QUESTION": "PROFESSION-GETINFO", - "RETURN-CLIENT": "INCOME_PROOF_TYPE-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "PROFESSION-GETINFO", - "name": "Submit profession", - "next": "PROFESSION-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "profession_title", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "PROFESSION-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "ACTIVITY_START-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "ACTIVITY_START-GETINFO", - "NEXT-QUESTION": "ACTIVITY_START-GETINFO", - "RETURN-CLIENT": "BALANCE-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "ACTIVITY_START-GETINFO", - "name": "Submit admission date", - "next": "ACTIVITY_START-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "activity_start_date", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "ACTIVITY_START-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CAREER_TIME-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CAREER_TIME-GETINFO", - "NEXT-QUESTION": "CAREER_TIME-GETINFO", - "RETURN-CLIENT": "PROFESSION-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "PRO_LABORE-GETINFO", - "name": "Submit pro-labore", - "next": "PRO_LABORE-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "income_proof_prolabore", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "PRO_LABORE-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "COMPANY_FOUNDATION-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "COMPANY_FOUNDATION-GETINFO", - "NEXT-QUESTION": "COMPANY_FOUNDATION-GETINFO", - "RETURN-CLIENT": "INCOME_PROOF_TYPE-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "COMPANY_FOUNDATION-GETINFO", - "name": "Submit income proof document", - "next": "COMPANY_FOUNDATION-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "company_foundation_date", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "COMPANY_FOUNDATION-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "SOCIAL_CONTRACT-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "SOCIAL_CONTRACT-GETINFO", - "NEXT-QUESTION": "SOCIAL_CONTRACT-GETINFO", - "RETURN-CLIENT": "PRO_LABORE-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "SOCIAL_CONTRACT-GETINFO", - "name": "Submit admission date", - "next": "SOCIAL_CONTRACT-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "income_proof_social_contract", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "SOCIAL_CONTRACT-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CAREER_TIME-GETINFO", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CAREER_TIME-GETINFO", - "NEXT-QUESTION": "CAREER_TIME-GETINFO", - "RETURN-CLIENT": "COMPANY_FOUNDATION-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CAREER_TIME-GETINFO", - "name": "Submit contribution time", - "next": "CAREER_TIME-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "career_time", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "CAREER_TIME-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "FGTS-ELEGIBLE", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "FGTS-ELEGIBLE", - "NEXT-QUESTION": "FGTS-ELEGIBLE", - "RETURN-CLIENT": "SOCIAL_CONTRACT-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "FGTS-ELEGIBLE", - "name": "Flow has FGTS", - "next": { - "1": "FGTS_VALUE-GETINFO", - "default": "PROFILE_TYPE", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "NEXT-QUESTION": "FGTS-ELEGIBLE", - "RETURN-CLIENT": "SOCIAL_CONTRACT-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.profile.career_time.value" - } - } - } - }, - { - "id": "FGTS_VALUE-GETINFO", - "name": "Submit FGTS value", - "next": "FGTS_VALUE-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "fgts_value", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "FGTS_VALUE-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "PROFILE_TYPE", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "PROFILE_TYPE", - "NEXT-QUESTION": "PROFILE_TYPE", - "RETURN-CLIENT": "CAREER_TIME-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "PROFILE_TYPE", - "name": "Guard for questions we ask about the main profile only", - "next": { - "main": "DONT_HAVE_SECOND_YET", - "default": "SECOND_BUYER-PROFILE-BAG" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.profile_type" - } - } - } - }, - { - "id": "DONT_HAVE_SECOND_YET", - "name": "Check if the profile doesnt qualify for second yet", - "next": { - "default": "SECOND_BUYER-KEY", - "divorced": "CHOOSE_SECOND-GETINFO", - "windower": "CHOOSE_SECOND-GETINFO", - "single_with_not_marriage": "CHOOSE_SECOND-GETINFO" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => result.data.profile.civil_state.value === '1' && result.data.profile.stable_union.value === '2' ? 'single_with_not_marriage' : result.data.profile.civil_state.value === '3' ? 'divorced' : result.data.profile.civil_state.value === '4' ? 'windower' : false" - } - } - } - }, - { - "id": "CHOOSE_SECOND-GETINFO", - "name": "Submit dependents", - "next": "CHOOSE_SECOND-STATUS", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "choose_second_buyer", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "CHOOSE_SECOND-STATUS", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CHOOSE_SECOND-RESPONSE", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "CHOOSE_SECOND-RESPONSE", - "NEXT-QUESTION": "CHOOSE_SECOND-RESPONSE", - "RETURN-CLIENT": "PROFILE_TYPE", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CHOOSE_SECOND-RESPONSE", - "name": "Flow civil status", - "next": { - "1": "SECOND_BUYER-KEY", - "default": "ADD_DEPENDANTS-GETINFO", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "NEXT-QUESTION": "CHOOSE_SECOND-RESPONSE", - "RETURN-CLIENT": "PROFILE_TYPE", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.profile.choose_second_buyer.value" - } - } - } - }, - { - "id": "ADD_DEPENDANTS-GETINFO", - "name": "Submit dependents", - "next": "ADD_DEPENDANTS-STATUS", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "add_dependants", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "result.data.profile" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "ADD_DEPENDANTS-STATUS", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "MAIN-PROFILE-BAG", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-QUIT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "FAIL-TIMEOUT": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "RESET-CLIENT": "START-SUBPROCESS-TO-RESET-CLIENT", - "SUCCESS-NOOP": "MAIN-PROFILE-BAG", - "NEXT-QUESTION": "MAIN-PROFILE-BAG", - "RETURN-CLIENT": "CHOOSE_SECOND-GETINFO", - "FINISH-PROCESS": "TRIGGER-TO-FINISH" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "MAIN-PROFILE-BAG", - "name": "Set profile to bag", - "next": "ALL_DOCS_RECEIVED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "$js": "({bag, result}) => ({ ...bag.profiles, [bag.profile_type]: result.data.profile })" - } - } - } - }, - { - "id": "SECOND_BUYER-KEY", - "name": "Bag profile and set key to BAG", - "next": "NAME-GETINFO-SECOND_BUYER", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "$js": "({bag, result}) => ({ ...bag.profiles, [bag.profile_type]: result.data.profile })" - }, - "profile_type": "second" - } - } - }, - { - "id": "SECOND_BUYER-PROFILE-BAG", - "name": "Set second buyer profiles to bag", - "next": "ALL_DOCS_RECEIVED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "$js": "({bag, result}) => ({ ...bag.profiles, [bag.profile_type]: result.data.profile })" - } - } - } - }, - { - "id": "ALL_DOCS_RECEIVED", - "name": "Notify that all documents were received", - "next": "UPDATE-REQUEST-STATUS-DOCS-RECEIVED-ON-DB", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Muito bem!!! O Grande passo foi dado para compra da sua Casa Própria! Deixa eu te falar, agora nosso Time vai correr para analisar seus documentos e trazer uma resposta logo logo, ok? Obrigada!\nMe aguarde que eu não demoro!" - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "UPDATE-REQUEST-STATUS-DOCS-RECEIVED-ON-DB", - "name": "Update request status to docs received on database", - "next": "UPDATE-REQUEST-STATUS-DOCS-RECEIVED-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "DOCUMENTS_RECEIVED" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-DOCS-RECEIVED-TO-BAG", - "name": "update request status to docs received to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-DOCS-RECEIVED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'DOCUMENTS_RECEIVED' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-DOCS-RECEIVED", - "name": "Notify status to realtor", - "next": "PROFILE-REVIEW", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "DOCUMENTOS RECEBIDOS", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "PROFILE-REVIEW", - "name": "profile review subprocess", - "next": "PROFILE-REVIEW-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "request": { - "$ref": "bag.request" - }, - "profiles": { - "$ref": "bag.profiles" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "observations": { - "$ref": "bag.observations" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "realtor_number": { - "$ref": "bag.realtor_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "request_review", - "valid_response": "finished" - } - }, - { - "id": "PROFILE-REVIEW-RESPONSE", - "name": "Verify review response", - "next": { - "REJECT": "REJECT-NOTIFY", - "REVIEW": "PROFILE-REVIEW-BAG", - "SUCCESS": "SUCCESS-REQUEST", - "default": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "PROFILE-REVIEW-BAG", - "name": "set profiles to bag", - "next": "REVIEW-PROFILE_TYPE-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "$ref": "result.data.profiles" - }, - "observations": { - "$ref": "result.data.observations" - } - } - } - }, - { - "id": "REVIEW-PROFILE_TYPE-BAG", - "name": "Set profiles type to bag", - "next": "NICKNAME-GETINFO", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profile_type": "main" - } - } - }, - { - "id": "REJECT-NOTIFY", - "name": "Notify rejected request", - "next": "CLOSE-REJECT", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "text": "Bela: Que pena sua análise foi rejeitada, fale com seu corretor para mais detalhes!!!" - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "SUCCESS-REQUEST", - "name": "Notify success request", - "next": "CLOSE", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "text": "Bela: Parabéns!!! Sua análise foi aprovada." - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "GET-MANAGER-ACTOR-ID-BY-REALTOR-ID", - "name": "Get manager actor id by request realtor id", - "next": "SET-CONVERSION-MANAGER-ACTOR-ID-TO-BAG", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "HTTP", - "parameters": { - "input": { - "realtor_id": { - "$ref": "bag.request.realtor.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/get-manager-actor-id-by-realtor-id" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-CONVERSION-MANAGER-ACTOR-ID-TO-BAG", - "name": "set conversion manager actor id to bag", - "next": "REALTOR-HAS-MANAGER", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "SetToBag", - "parameters": { - "input": { - "manager_actor_id": { - "$ref": "result.data.manager_actor_id" - } - } - } - }, - { - "id": "REALTOR-HAS-MANAGER", - "name": "Verify if realtor has manager", - "next": { - "true": "UPDATE-REQUEST-STATUS-RECOVERY-ON-DB", - "default": "SET-DEFAULT-CONVERSION-MANAGER-ACTOR-ID-TO-BAG" - }, - "type": "Flow", - "lane_id": "CONVERSION-MANAGER", - "parameters": { - "input": { - "key": { - "$js": "({ bag }) => !!bag.manager_actor_id" - } - } - } - }, - { - "id": "SET-DEFAULT-CONVERSION-MANAGER-ACTOR-ID-TO-BAG", - "name": "set conversion manager actor id to bag", - "next": "UPDATE-REQUEST-STATUS-RECOVERY-ON-DB", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "SetToBag", - "parameters": { - "input": { - "manager_actor_id": { - "$ref": "environment.DEFAULT_MANAGER_RECOVERY_ANALYSES_ACTOR_ID" - } - } - } - }, - { - "id": "UPDATE-REQUEST-STATUS-RECOVERY-ON-DB", - "name": "Update request status to docs received on database", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-RECOVERY", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "HTTP", - "parameters": { - "input": { - "status": "RECOVERY" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-RECOVERY", - "name": "Notify status to realtor", - "next": "GET-REQUEST-DETAILS", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "startProcess", - "parameters": { - "input": { - "status": "RECUPERAÇÃO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "GET-REQUEST-DETAILS", - "name": "Get request details", - "next": "SET-REQUEST-DETAILS-TO-BAG", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/{{bag.request.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-REQUEST-DETAILS-TO-BAG", - "name": "set request details to bag", - "next": "REQUEST_RECOVERY-SETTINGS", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "main": { - "$js": "({ result }) => !!result.data.metadata?.profiles?.main ? result.data.metadata.profiles.main : {}" - }, - "second": { - "$js": "({ result }) => !!result.data.metadata?.profiles?.second ? result.data.metadata.profiles.second : {}" - } - } - } - } - }, - { - "id": "REQUEST_RECOVERY-SETTINGS", - "name": "Fetch settings for request recovery.", - "next": "REQUEST_RECOVERY-BUILD", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.request_v3_ACTION_SUBMIT_REQUEST_RECOVERY" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - }, - "max_content_length": 100000 - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "REQUEST_RECOVERY-BUILD", - "name": "Build request recovery data", - "next": "REQUEST_RECOVERY", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "SetToBag", - "parameters": { - "input": { - "profileReview": { - "profiles": { - "main": { - "$js": "({ bag }) => { const title = { name: bag.profiles?.main?.name?.value, email: bag.profiles?.main?.email?.value, phone: bag.party_number }; return { ...bag.profiles.main, title }; };" - }, - "second": { - "$js": "({ bag }) => { const title = { name: bag.profiles.second?.name?.value, email: bag.profiles.second?.email?.value }; return { ...bag.profiles.second, title }; };" - } - }, - "ui_schema": { - "$ref": "result.data[0].value.ui_schema" - }, - "activity_schema": { - "type": { - "$ref": "result.data[0].value.activity_schema.type" - }, - "properties": { - "main": { - "$js": "({bag, result}) => { const schema = result.data[0].value.activity_schema.properties.main.properties; const profileKeys = Object.keys(bag.profiles.main); const schemaKeys = Object.keys(result.data[0].value.activity_schema.properties.main.properties); const filteredSchema = schemaKeys.filter(key => profileKeys.includes(key)).reduce((acc, key) => { acc[key] = schema[key]; return acc; }, { title: schema['title'], additional_documents: schema['additional_documents'] }); return { type: 'object', title: '', properties: filteredSchema }; }" - }, - "second": { - "$js": "({ bag, result }) => { const profileKeys = Object.keys(bag.profiles.second); if(profileKeys.length === 0) { return undefined }; const schema = result.data[0].value.activity_schema.properties.second.properties; const schemaKeys = Object.keys(result.data[0].value.activity_schema.properties.second.properties); const filteredSchema = schemaKeys.filter((key) => profileKeys.includes(key)).reduce((acc, key) => { acc[key] = schema[key]; return acc; }, { title: schema['title'], additional_documents: schema['additional_documents'] }); return { type: 'object', title: '', properties: filteredSchema }; };" - }, - "status": { - "$ref": "result.data[0].value.activity_schema.properties.status" - } - }, - "definitions": { - "$ref": "result.data[0].value.activity_schema.definitions" - } - } - } - } - } - }, - { - "id": "REQUEST_RECOVERY", - "name": "Desk request recovery", - "next": "REQUEST_RECOVERY-BAG", - "type": "UserTask", - "lane_id": "CONVERSION-MANAGER", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$ref": "bag.profileReview.activity_schema" - } - }, - "action": "SUBMIT_REQUEST_RECOVERY" - } - }, - { - "id": "REQUEST_RECOVERY-BAG", - "name": "set request recovery to bag", - "next": "REQUEST_RECOVERY-STATUS", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "$ref": "result.activities[0].data.profiles" - }, - "profile_type": "main", - "request_recovery_status": { - "$ref": "result.activities[0].data.status" - } - } - } - }, - { - "id": "REQUEST_RECOVERY-STATUS", - "name": "Verify if the request was recovered", - "next": { - "default": "CLOSE-NOTIFY", - "RECOVERY": "UPDATE-REQUEST-STATUS-AWAITING-DOCUMENTS-ON-DB" - }, - "type": "Flow", - "lane_id": "CONVERSION-MANAGER", - "parameters": { - "input": { - "key": { - "$ref": "bag.request_recovery_status" - } - } - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING-DOCUMENTS-ON-DB", - "name": "Update request status to AWAITING DOCUMENTS on database", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-DOCS-AFTER-RECOVERY", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "HTTP", - "parameters": { - "input": { - "status": "AWAITING_DOCUMENTS" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-DOCS-AFTER-RECOVERY", - "name": "Notify status to realtor", - "next": "NICKNAME-GETINFO", - "type": "SystemTask", - "lane_id": "CONVERSION-MANAGER", - "category": "startProcess", - "parameters": { - "input": { - "status": "AGUARDANDO DOCUMENTOS", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "START-SUBPROCESS-TO-RESET-CLIENT", - "name": "start reset client", - "next": "NOTIFY-RESET-CLIENT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "phone_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "actor_data" - }, - "workflow_name": "resetClient" - } - }, - { - "id": "NOTIFY-RESET-CLIENT", - "name": "Send message notifying reset client", - "next": "SA", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "text": "Bela: Reiniciando pedido de análise..." - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "TRIGGER-TO-FINISH", - "name": "Action trigger to finish process", - "next": "SET-STATUS-CLOSED-ON-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "CLOSED" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-STATUS-CLOSED-ON-BAG", - "name": "Set status to closed on bag", - "next": "REMOVE-CURRENT-REQUEST-ID-ON-PROFILE-BUYER", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'CLOSED' }}" - } - } - } - }, - { - "id": "REMOVE-CURRENT-REQUEST-ID-ON-PROFILE-BUYER", - "name": "Set buyer current request to null", - "next": "INACTIVATE-CLIENT-CHAT-ID-TO-FINISH-PROCESS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "current_request_id": null - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?mobile_phone=eq.{{ bag.party_number }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "INACTIVATE-CLIENT-CHAT-ID-TO-FINISH-PROCESS", - "name": "Inactivate realtor chat id", - "next": "CLOSE-NOTIFY", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "CLOSE-NOTIFY", - "name": "Send message notifying request exit", - "next": "CLOSE-INACTIVE", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "text": "Bela: Que pena, infelizmente vou precisar encerrar o seu atendimento. Mas fique tranquilo(a), estarei aqui quando você estiver pronto para iniciar uma nova análise de crédito! Até mais!!!" - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "CLOSE-REJECT", - "name": "Finish request status REJEITADO", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "CLOSE", - "name": "Finish request", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "CLOSE-INACTIVE", - "name": "Finish request por INATIVIDADE", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - } - ], - "prepare": [], - "environment": { - "XPTO": "BOTAUTHOR", - "CHAT_API": "CHAT_API", - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API", - "DEFAULT_MANAGER_RECOVERY_ANALYSES_ACTOR_ID": "DEFAULT_MANAGER_RECOVERY_ANALYSES_ACTOR_ID" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/request_review.json b/samples/blueprints/approva/request_review.json deleted file mode 100644 index cf3eb500..00000000 --- a/samples/blueprints/approva/request_review.json +++ /dev/null @@ -1,2629 +0,0 @@ -{ - "name": "request_review", - "description": "fluxo para revisar um profile", - "blueprint_spec": { - "lanes": [ - { - "id": "ANYONE", - "name": "Anyone", - "rule": [ - "fn", - [ - "&", - "args" - ], - true - ] - }, - { - "id": "REVIEWER-LATCHED", - "name": "selected reviewer", - "rule": { - "$js": "({actor_data, bag}) => bag.reviewer_id === actor_data.actor_id" - } - }, - { - "id": "BACKOFFICE-LATCHED", - "name": "any backoffice user latched", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('adminRequests')" - } - }, - { - "id": "REQUESTBOT", - "name": "Buyer", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('requestBot')" - } - } - ], - "nodes": [ - { - "id": "0", - "name": "Start Request Review", - "next": "BUYER-BAG", - "type": "Start", - "lane_id": "REQUESTBOT", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "party_number", - "chat_id", - "profiles", - "request" - ], - "properties": { - "chat_id": { - "type": "string" - }, - "request": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "status:": { - "type": "string" - }, - "created_at": { - "type": "string" - } - } - }, - "profiles": { - "type": "object", - "required": [ - "main" - ], - "properties": { - "main": { - "type": "object" - }, - "second": { - "type": "object" - } - } - }, - "party_number": { - "type": "string" - }, - "realtor_number": { - "type": "string" - } - } - } - } - }, - { - "id": "BUYER-BAG", - "name": "set reviewer to bag", - "next": "PICK-FOR-REVIEW", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "buyer": { - "$ref": "actor_data" - }, - "BASE_URL": "aprova_services:3000" - } - } - }, - { - "id": "PICK-FOR-REVIEW", - "name": "Pick profile for review", - "next": "REVIEWER-BAG", - "type": "UserTask", - "lane_id": "BACKOFFICE-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - }, - "profiles": { - "$ref": "bag.profiles" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - } - }, - "action": "PICK_FOR_REVIEW" - } - }, - { - "id": "REVIEWER-BAG", - "name": "set reviewer to bag", - "next": "UPDATE-REQUEST-STATUS-AWAITING-ANALYSIS-ON-DB", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "reviewer_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING-ANALYSIS-ON-DB", - "name": "Update request status to awaiting analysis on database", - "next": "UPDATE-REQUEST-STATUS-AWAITING-ANALYSIS-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "AWAITING_ANALYSIS" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING-ANALYSIS-TO-BAG", - "name": "update request status to awaiting analysis to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-ANALYSIS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'AWAITING_ANALYSIS' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-ANALYSIS", - "name": "Notify status to realtor", - "next": "CEF-INPUT-SETTINGS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "AGUARDANDO ANÁLISE", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "CEF-INPUT-SETTINGS", - "name": "Fetch settings for cef input", - "next": "CEF-INPUT-SETTINGS-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.request_review_CEF_SETTINGS" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - }, - "max_content_length": 10000 - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "CEF-INPUT-SETTINGS-BAG", - "name": "bag cef response", - "next": "PROFILE-REVIEW-SETTINGS", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "cefSettings": { - "$ref": "result.data[0].value" - } - } - } - }, - { - "id": "PROFILE-REVIEW-SETTINGS", - "name": "Fetch settings for profile review", - "next": "PROFILE-REVIEW-BUILD", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.request_review_ACTION_SUBMIT_PROFILE_REVIEW" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - }, - "max_content_length": 100000 - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "PROFILE-REVIEW-BUILD", - "name": "Build profile review data", - "next": "PROFILE-REVIEW", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "profileReview": { - "profiles": { - "main": { - "$js": "({ bag }) => { const title = { name: bag.profiles.main.name.value, email: bag.profiles.main.email.value, phone: bag.party_number }; return { ...bag.profiles.main, title }; };" - }, - "second": { - "$js": "({ bag }) => { const title = { name: bag.profiles.second?.name?.value, email: bag.profiles.second?.email?.value }; return { ...bag.profiles.second, title }; };" - } - }, - "ui_schema": { - "$ref": "result.data[0].value.ui_schema" - }, - "activity_schema": { - "type": { - "$ref": "result.data[0].value.activity_schema.type" - }, - "properties": { - "main": { - "$js": "({bag, result}) => { const schema = result.data[0].value.activity_schema.properties.main.properties; const profileKeys = Object.keys(bag.profiles.main); const schemaKeys = Object.keys(result.data[0].value.activity_schema.properties.main.properties); const filteredSchema = schemaKeys.filter(key => profileKeys.includes(key)).reduce((acc, key) => { acc[key] = schema[key]; return acc; }, { title: schema['title'], additional_documents: schema['additional_documents'] }); return { type: 'object', title: '', properties: filteredSchema }; }" - }, - "second": { - "$js": "({ bag, result }) => { const profileKeys = Object.keys(bag.profiles.second); if(profileKeys.length === 0) { return undefined }; const schema = result.data[0].value.activity_schema.properties.second.properties; const schemaKeys = Object.keys(result.data[0].value.activity_schema.properties.second.properties); const filteredSchema = schemaKeys.filter((key) => profileKeys.includes(key)).reduce((acc, key) => { acc[key] = schema[key]; return acc; }, { title: schema['title'], additional_documents: schema['additional_documents'] }); return { type: 'object', title: '', properties: filteredSchema }; };" - }, - "status": { - "$ref": "result.data[0].value.activity_schema.properties.status" - }, - "description": { - "$ref": "result.data[0].value.activity_schema.properties.description" - } - }, - "definitions": { - "$ref": "result.data[0].value.activity_schema.definitions" - } - } - } - } - } - }, - { - "id": "PROFILE-REVIEW", - "name": "Desk review", - "next": "PROFILE-REVIEW-BAG", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "activity_schema": { - "$ref": "bag.profileReview.activity_schema" - } - }, - "action": "SUBMIT_PROFILE_REVIEW" - } - }, - { - "id": "PROFILE-REVIEW-BAG", - "name": "set reviewer to bag", - "next": "REVIEW-STATUS", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "falses": { - "$js": "({ result }) => { const profiles = result.activities[0].data.profiles; const keys = Object.keys(profiles.main).filter(i => i !== 'choose_second_buyer'); const falses = keys.reduce((acc, key) => { const main = profiles.main[key] && !profiles.main[key].valid && profiles.main[key].value ? 1 : 0; const second = profiles.second[key] && !profiles.second[key].valid && profiles.second[key].value ? 1 : 0; return acc + main + second; }, 0); return falses };" - }, - "profiles": { - "$ref": "result.activities[0].data.profiles" - }, - "observations": { - "$js": "({bag, result}) => !!bag.observations ? ([...bag.observations, { status: result.activities[0].data.status, obs: result.activities[0].data.obs }]) : ([{ status: result.activities[0].data.status, obs: result.activities[0].data.obs }])" - }, - "profiles_review_status": { - "$ref": "result.activities[0].data.status" - } - } - } - }, - { - "id": "REVIEW-STATUS", - "name": "Review status", - "next": { - "REJECT": "REJEITADO-NOTIFY", - "SUCCESS": "UPDATE-STATUS-REQUEST-PROFILE-REVIEW-ON-DB", - "default": "ADDITIONAL_DOCS-BAG", - "RESTRICTION": "UPDATE-REQUEST-STATUS-RESTRICTION-ON-DB" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.profiles_review_status" - } - } - } - }, - { - "id": "UPDATE-STATUS-REQUEST-PROFILE-REVIEW-ON-DB", - "name": "Update request after profile review", - "next": "REVIEW-FALSES", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "REVIEW-FALSES", - "name": "Review status", - "next": { - "0": "REQUEST-DETAILS-SETTINGS", - "default": "NOTIFY-FALSES" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.falses" - } - } - } - }, - { - "id": "NOTIFY-FALSES", - "name": "notify reviewer of invalid fields", - "next": "PROFILE-REVIEW-SETTINGS", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "activity_schema": { - "title": "Erro na Revisão do Profile", - "properties": {}, - "description": { - "$mustache": "Há {{bag.falses}} campos não aprovados no perfil enviado" - } - } - }, - "action": "NOTIFY_FALSES", - "timeout": 60 - } - }, - { - "id": "REQUEST-DETAILS-SETTINGS", - "name": "Fetch settings for CEF hiding status of client profile review and readonly fields", - "next": "CEF-INPUT", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.request_details" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - }, - "max_content_length": 100000 - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "CEF-INPUT", - "name": "Contact CEF and fulfill its response", - "next": "CEF-BAG", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "request": { - "$ref": "bag.request" - }, - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "ui_schema": { - "$ref": "result.data[0].value.ui_schema" - }, - "activity_schema": { - "$ref": "result.data[0].value.activity_schema" - } - }, - "activity_schema": { - "$ref": "bag.cefSettings['CEF_INPUT'].schema" - } - }, - "action": "CEF_INPUT" - } - }, - { - "id": "CEF-BAG", - "name": "bag cef response", - "next": "CEF-NOTIFY", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "cefFormData": { - "$ref": "result.activities[0].data" - }, - "observations": { - "$js": "({bag, result}) => !!bag.observations ? ([...bag.observations, { status: result.activities[0].data.status, obs: result.activities[0].data.obs }]) : ([{ status: result.activities[0].data.status, obs: result.activities[0].data.obs }])" - } - } - } - }, - { - "id": "CEF-NOTIFY", - "name": "Notify rejected request", - "next": "CEF-STATUS", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": { - "$js": "({bag}) => bag.cefSettings[bag.cefFormData.status].messages" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "CEF-STATUS", - "name": "cef status", - "next": { - "ERROR": "UPDATE-REQUEST-STATUS-ERRO-ON-DB", - "default": "PROFILE-REVIEW", - "APPROVED": "CREATE-NEGOTIATION-CHAT", - "REPROVED": "UPDATE-REQUEST-STATUS-REPROVED-ON-DB", - "CANCELLED": "UPDATE-REQUEST-STATUS-AWAITING-CANCELLATION-ON-DB", - "WAITING_QV": "UPDATE-REQUEST-STATUS-AWAITING-QV-ON-DB", - "CONDITIONED": "CREATE-NEGOTIATION-CHAT", - "DIFFERENTIATED": "UPDATE-REQUEST-STATUS-DIFFERENTIATED-ON-DB" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.cefFormData.status" - } - } - } - }, - { - "id": "CREATE-NEGOTIATION-CHAT", - "name": "Create negotiation chat", - "next": "SET-NEGOTIATION-CHAT-AS-MAIN-CHAT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "origin": "WORKFLOW", - "request_id": { - "$ref": "bag.request.id" - }, - "buyer_phone_number": { - "$ref": "bag.party_number" - }, - "realtor_phone_number": { - "$ref": "bag.realtor_number" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/create-negotiation-chat" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-NEGOTIATION-CHAT-AS-MAIN-CHAT", - "name": "Set new chat id on bag", - "next": "SET-UNIQUE-ACTIVE-NEGOTIATION-CHAT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "chat_id": { - "$ref": "result.data.chat_id" - } - } - } - }, - { - "id": "SET-UNIQUE-ACTIVE-NEGOTIATION-CHAT", - "name": "Set unique active negotiation chat", - "next": "LAUDO-FORM", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/set-unique-active-negotiation-chat-on-request" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING-CANCELLATION-ON-DB", - "name": "Update request status to AWAITING CANCELLATION on database", - "next": "UPDATE-REQUEST-STATUS-AWAITING-CANCELLATION-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "AWAITING_CANCELLATION", - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING-CANCELLATION-TO-BAG", - "name": "update request status to awaiting cancellation to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-CANCELLATION", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'AWAITING_CANCELLATION' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-CANCELLATION", - "name": "Notify status to realtor", - "next": "PROFILE-TYPE-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "AGUARDANDO CANCELAMENTO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "PROFILE-TYPE-BAG", - "name": "Set profiles type to bag", - "next": "CANCELAMENTO-GETINFO", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profile_type": "main" - } - } - }, - { - "id": "CANCELAMENTO-GETINFO", - "name": "getInfo carta cancelamento", - "next": "CANCELAMENTO-RESPONSE", - "type": "SubProcess", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": "cancellation_letter", - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$ref": "bag.profileReview.profiles" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "CANCELAMENTO-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "CANCELAMENTO-RESPONSE-BAG", - "default": "CLOSE-INACTIVE", - "FAIL-QUIT": "CLOSE-QUIT", - "FAIL-TIMEOUT": "CLOSE-INACTIVE", - "SUCCESS-NOOP": "CANCELAMENTO-RESPONSE-BAG" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "CANCELAMENTO-RESPONSE-BAG", - "name": "Set task settings to bag", - "next": "CANCELAMENTO", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "$ref": "result.data.profiles" - } - } - } - }, - { - "id": "CANCELAMENTO", - "name": "review CANCELAMENTO", - "next": "CANCEL-STATUS", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "request": { - "$ref": "bag.request" - }, - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => {const r = bag.profileReview.activity_schema; delete r['definitions']; delete r['status']; return r;}" - } - }, - "activity_schema": { - "$ref": "bag.cefSettings['CANCELLED'].schema" - } - }, - "action": "CANCELAMENTO_FORM" - } - }, - { - "id": "CANCEL-STATUS", - "name": "Verify status", - "next": { - "SOLVED": "PROFILE-REVIEW", - "default": "CANCELAMENTO", - "NEW_CANCEL_LETTER": "CANCELAMENTO-GETINFO" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.status" - } - } - } - }, - { - "id": "CANCEL-TIMER", - "name": "Timer CANCELAMENTO FORM", - "next": "CANCELAMENTO", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "timer", - "parameters": { - "input": {}, - "timeout": 10800 - } - }, - { - "id": "LAUDO-FORM", - "name": "review LAUDO", - "next": "SET-CREDIT-LIMIT-TO-BAG", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "ui_schema": { - "$ref": "bag.cefSettings['APPROVED'].ui_schema" - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "request": { - "$ref": "bag.request" - }, - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => {const r = bag.profileReview.activity_schema; delete r['definitions']; delete r['status']; return r;}" - } - }, - "activity_schema": { - "$ref": "bag.cefSettings['APPROVED'].schema" - } - }, - "action": "LAUDO_FORM" - } - }, - { - "id": "SET-CREDIT-LIMIT-TO-BAG", - "name": "Set credit limit to bag", - "next": "LAUDO-CREATE", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag, result}) => ({ ...bag.request, credit_limit: result.activities[0].data.analysis_value})" - } - } - } - }, - { - "id": "LAUDO-CREATE", - "name": "criar laudo", - "next": "VERIFY-LAUDO-RESPONSE-CODE", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "http", - "parameters": { - "input": { - "client": { - "$js": "({bag, result}) => ({ ...result.activities[0].data, request_id: bag.request.id })" - }, - "template": { - "siric": "G30", - "table": "G35", - "title": "D3", - "analyst": "F43", - "indexer": "O40", - "category": "G34", - "feedback": "M39", - "protocol": "R20", - "bank_name": "N13", - "client_CPF": "E14", - "client_FGTS": "E15", - "client_name": "E13", - "pending_one": "B47", - "pending_six": "B52", - "pending_two": "B48", - "bank_account": "R19", - "client_quota": "I15", - "feedback_two": "O43", - "pending_five": "B51", - "pending_four": "B50", - "total_income": "G29", - "approval_date": "D38", - "client_income": "J13", - "client_status": "N16", - "income_report": "G32", - "interest_rate": "R38", - "pending_eight": "B54", - "pending_seven": "B53", - "pending_three": "B49", - "analysis_value": "O34", - "has_dependents": "G33", - "financing_quota": "R36", - "analysis_subsidy": "O32", - "evaluation_value": "M36", - "third_client_CPF": "E29", - "analysis_deadline": "O29", - "client_birth_date": "I14", - "commitment_income": "G31", - "second_client_CPF": "E17", - "third_client_FGTS": "E21", - "third_client_name": "E19", - "analysis_financing": "O33", - "buy_and_sell_value": "M38", - "project_properties": "B24", - "second_client_FGTS": "E18", - "second_client_name": "E16", - "third_client_quota": "I21", - "analysis_total_FGTS": "O31", - "client_civil_status": "R17", - "second_client_quota": "I18", - "third_client_income": "J19", - "second_client_income": "J16", - "analysis_first_payment": "O30", - "third_client_birth_date": "I20", - "approval_expiration_date": "D40", - "second_client_birth_date": "I17" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/credit_analysis_form" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - }, - "max_content_length": 50000 - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "VERIFY-LAUDO-RESPONSE-CODE", - "name": "laudo status", - "next": { - "400": "NOTIFY-LAUDO-RESPONSE-STATUS", - "default": "SET-LAUDO-TO-BAG" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.status" - } - } - } - }, - { - "id": "NOTIFY-LAUDO-RESPONSE-STATUS", - "name": "Notify laudo status", - "next": "LAUDO-FORM", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "messages": [ - { - "message": "Laudo Inválido!" - } - ] - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "SET-LAUDO-TO-BAG", - "name": "Set laudo to bag", - "next": "LAUDO-SHOW", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "laudo_id": { - "$ref": "result.data.id" - }, - "profiles": { - "main": { - "$js": "({bag, result}) => ({ ...bag.profiles.main, laudo: { value: result.data.id, valid: true }})" - }, - "second": { - "$js": "({bag, result}) => ({ ...bag.profiles.second })" - } - }, - "laudo_storage_path": { - "$ref": "result.data.storage_path" - } - } - } - }, - { - "id": "LAUDO-SHOW", - "name": "review DIFERENCIADO", - "next": "VERIFY-LAUDO-STATUS", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "laudo_id": { - "$ref": "bag.profiles.main.laudo_id" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "request": { - "$ref": "bag.request" - }, - "profiles": { - "$ref": "bag.profiles" - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => {const r = bag.profileReview.activity_schema; delete r['definitions']; delete r['status']; return r;}" - } - }, - "laudo_storage_path": { - "$ref": "bag.laudo_storage_path" - } - }, - "action": "LAUDO_SHOW" - } - }, - { - "id": "VERIFY-LAUDO-STATUS", - "name": "laudo status", - "next": { - "default": "LAUDO-FORM", - "APPROVED": "UPDATE-REQUEST" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.activities[0].data.status" - } - } - } - }, - { - "id": "UPDATE-REQUEST-STATUS-DIFFERENTIATED-ON-DB", - "name": "Update request status to differentiated on database", - "next": "UPDATE-REQUEST-STATUS-DIFFERENTIATED-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "DIFFERENTIATED", - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-DIFFERENTIATED-TO-BAG", - "name": "update request status to differentiated to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-DIFF", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'DIFFERENTIATED' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-DIFF", - "name": "Notify status to realtor", - "next": "DIFERENCIADO", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "DIFERENCIADO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "DIFERENCIADO", - "name": "review DIFERENCIADO", - "next": "SET-DIFERENCIADO-OBS-TO-BAG", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => {const r = bag.profileReview.activity_schema; delete r['definitions']; delete r['status']; return r;}" - } - }, - "activity_schema": { - "$ref": "bag.cefSettings['DIFFERENTIATED'].schema" - } - }, - "action": "DIFERENCIADO_FORM" - } - }, - { - "id": "SET-DIFERENCIADO-OBS-TO-BAG", - "name": "Set diferenciado obs to bag", - "next": "DIF-STATUS", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "difStatus": { - "$ref": "result.activities[0].data.status" - }, - "observations": { - "$js": "({bag, result}) => !!bag.observations ? ([...bag.observations, { status: result.activities[0].data.status, obs: result.activities[0].data.obs }]) : ([{ status: result.activities[0].data.status, obs: result.activities[0].data.obs }])" - } - } - } - }, - { - "id": "DIF-STATUS", - "name": "Verify status", - "next": { - "SOLVED": "PROFILE-REVIEW", - "default": "DIFERENCIADO" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.difStatus" - } - } - } - }, - { - "id": "DIF-TIMER", - "name": "Timer DIFERENCIADO FORM", - "next": "DIFERENCIADO", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "timer", - "parameters": { - "input": {}, - "timeout": 10800 - } - }, - { - "id": "UPDATE-REQUEST-STATUS-RESTRICTION-ON-DB", - "name": "Update request status to restriction on database", - "next": "UPDATE-REQUEST-STATUS-RESTRICTION-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "RESTRICTION", - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-RESTRICTION-TO-BAG", - "name": "update request status to RESTRICTION to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-RESTRICTION", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'RESTRICTION' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-RESTRICTION", - "name": "Notify status to realtor", - "next": "RESTRICTION", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "RESTRIÇÃO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "RESTRICTION", - "name": "review RESTRICAO", - "next": "SET-RESTRICTION-OBS-TO-BAG", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => {const r = bag.profileReview.activity_schema; delete r['definitions']; delete r['status']; return r;}" - } - }, - "activity_schema": { - "$ref": "bag.cefSettings['RESTRICTION'].schema" - } - }, - "action": "RESTRICTION_FORM" - } - }, - { - "id": "SET-RESTRICTION-OBS-TO-BAG", - "name": "Set restriction obs to bag", - "next": "RESTRICTION-STATUS", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "resStatus": { - "$ref": "result.activities[0].data.status" - }, - "observations": { - "$js": "({bag, result}) => !!bag.observations ? ([...bag.observations, { status: result.activities[0].data.status, obs: result.activities[0].data.obs }]) : ([{ status: result.activities[0].data.status, obs: result.activities[0].data.obs }])" - } - } - } - }, - { - "id": "RESTRICTION-STATUS", - "name": "Verify status", - "next": { - "SOLVED": "PROFILE-REVIEW", - "default": "RESTRICTION" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.resStatus" - } - } - } - }, - { - "id": "RESTRICTION-TIMER", - "name": "Timer RESTRICTION FORM", - "next": "RESTRICTION", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "timer", - "parameters": { - "input": {}, - "timeout": 10800 - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING-QV-ON-DB", - "name": "Update request status to awaiting qv on database", - "next": "UPDATE-REQUEST-STATUS-AWAITING-QV-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "AWAITING_QV", - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-AWAITING-QV-TO-BAG", - "name": "update request status to awaiting qv to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-QV", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'AWAITING_QV' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-AW-QV", - "name": "Notify status to realtor", - "next": "AGUARDANDO_QV", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "AGUARDANDO Q.V", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "AGUARDANDO_QV", - "name": "review AGUARDANDO_QV", - "next": "SET-AGUARD-QV-OBS-TO-BAG", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => {const r = bag.profileReview.activity_schema; delete r['definitions']; delete r['status']; return r;}" - } - }, - "activity_schema": { - "$ref": "bag.cefSettings['WAITING_QV'].schema" - } - }, - "action": "AGUARDANDO_QV_FORM" - } - }, - { - "id": "SET-AGUARD-QV-OBS-TO-BAG", - "name": "Set aguardando qv obs to bag", - "next": "QV-STATUS", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "qvStatus": { - "$ref": "result.activities[0].data.status" - }, - "observations": { - "$js": "({bag, result}) => !!bag.observations ? ([...bag.observations, { status: result.activities[0].data.status, obs: result.activities[0].data.obs }]) : ([{ status: result.activities[0].data.status, obs: result.activities[0].data.obs }])" - } - } - } - }, - { - "id": "QV-STATUS", - "name": "Verify status", - "next": { - "SOLVED": "PROFILE-REVIEW", - "default": "AGUARDANDO_QV" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.qvStatus" - } - } - } - }, - { - "id": "QV-TIMER", - "name": "Timer QV FORM", - "next": "AGUARDANDO_QV", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "timer", - "parameters": { - "input": {}, - "timeout": 10800 - } - }, - { - "id": "UPDATE-REQUEST-STATUS-REPROVED-ON-DB", - "name": "Update request status to reproved qv on database", - "next": "UPDATE-REQUEST-STATUS-REPROVED-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "REPROVED", - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-REPROVED-TO-BAG", - "name": "update request status to reproved to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-REPROVED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'REPROVED' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-REPROVED", - "name": "Notify status to realtor", - "next": "REPROVADO", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "REPROVADO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "REPROVADO", - "name": "review REPROVADO", - "next": "SET-REPROVADO-OBS-TO-BAG", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => {const r = bag.profileReview.activity_schema; delete r['definitions']; delete r['status']; return r;}" - } - }, - "activity_schema": { - "$ref": "bag.cefSettings['REPROVED'].schema" - } - }, - "action": "REPROVADO_FORM" - } - }, - { - "id": "SET-REPROVADO-OBS-TO-BAG", - "name": "Set reprovado obs to bag", - "next": "REPROVADO-STATUS", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "repStatus": { - "$ref": "result.activities[0].data.status" - }, - "observations": { - "$js": "({bag, result}) => !!bag.observations ? ([...bag.observations, { status: result.activities[0].data.status, obs: result.activities[0].data.obs }]) : ([{ status: result.activities[0].data.status, obs: result.activities[0].data.obs }])" - } - } - } - }, - { - "id": "REPROVADO-STATUS", - "name": "Verify status", - "next": { - "SOLVED": "PROFILE-REVIEW", - "default": "REPROVADO" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.repStatus" - } - } - } - }, - { - "id": "REPROVADO-TIMER", - "name": "Timer REPROVADO FORM", - "next": "REPROVADO", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "timer", - "parameters": { - "input": {}, - "timeout": 10800 - } - }, - { - "id": "UPDATE-REQUEST-STATUS-ERRO-ON-DB", - "name": "Update request status to erro on database", - "next": "UPDATE-REQUEST-STATUS-ERRO-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "ERRO", - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-ERRO-TO-BAG", - "name": "update request status to erro to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-ERRO", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'ERRO' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-ERRO", - "name": "Notify status to realtor", - "next": "ERRO", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "ERRO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "ERRO", - "name": "review ERRO", - "next": "SET-ERRO-OBS-TO-BAG", - "type": "UserTask", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "request": { - "$ref": "bag.request" - }, - "card_data": { - "date": { - "$ref": "bag.request.created_at" - }, - "name": { - "$ref": "bag.profileReview.profiles.main.name.value" - }, - "phone": { - "$ref": "bag.party_number" - } - }, - "observations": { - "$js": "({bag}) => !!bag.observations ? bag.observations : []" - }, - "profile_data": { - "profiles": { - "$ref": "bag.profileReview.profiles" - }, - "ui_schema": { - "$ref": "bag.profileReview.ui_schema" - }, - "activity_schema": { - "$js": "({bag}) => {const r = bag.profileReview.activity_schema; delete r['definitions']; delete r['status']; return r;}" - } - }, - "activity_schema": { - "$ref": "bag.cefSettings['ERROR'].schema" - } - }, - "action": "ERRO_FORM" - } - }, - { - "id": "SET-ERRO-OBS-TO-BAG", - "name": "Set erro obs to bag", - "next": "ERRO-STATUS", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "erroStatus": { - "$ref": "result.activities[0].data.status" - }, - "observations": { - "$js": "({bag, result}) => !!bag.observations ? ([...bag.observations, { status: result.activities[0].data.status, obs: result.activities[0].data.obs }]) : ([{ status: result.activities[0].data.status, obs: result.activities[0].data.obs }])" - } - } - } - }, - { - "id": "ERRO-STATUS", - "name": "Verify status", - "next": { - "SOLVED": "PROFILE-REVIEW", - "default": "ERRO" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.erroStatus" - } - } - } - }, - { - "id": "ERRO-TIMER", - "name": "Timer ERRO FORM", - "next": "ERRO", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "timer", - "parameters": { - "input": {}, - "timeout": 10800 - } - }, - { - "id": "ADDITIONAL_DOCS-BAG", - "name": "Set task settings to bag", - "next": "UPDATE-REQUEST-STATUS-ADDITIONAL-DOCUMENTS-ON-DB", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "$ref": "result.activities[0].data.profiles" - }, - "remaining_additional_docs": { - "$js": "({result}) => { const profiles = result.activities[0]?.data?.profiles; if(profiles) { const keys = Object.keys(profiles); return keys.flatMap(key => { if(profiles[key].additional_documents) { return profiles[key].additional_documents.reduce((acc,doc) => [...acc, { profile_type: key, key: doc }], [])}}).filter(Boolean)} }" - } - } - } - }, - { - "id": "UPDATE-REQUEST-STATUS-ADDITIONAL-DOCUMENTS-ON-DB", - "name": "Update request status to additional documents on database", - "next": "UPDATE-REQUEST-STATUS-ADDITIONAL-DOCUMENTS-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "ADDITIONAL_DOCUMENTS", - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-ADDITIONAL-DOCUMENTS-TO-BAG", - "name": "update request status to additional documents to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-ADD-DOCS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'ADDITIONAL_DOCUMENTS' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-ADD-DOCS", - "name": "Notify status to realtor", - "next": "ADDITIONAL_DOCS-LENGTH", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "DOCUMENTOS ADICIONAIS", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "ADDITIONAL_DOCS-LENGTH", - "name": "cef status", - "next": { - "0": "PROFILES-BAG", - "default": "ADDITIONAL_DOCS-TAKE-FIRST", - "undefined": "PROFILES-BAG" - }, - "type": "Flow", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.remaining_additional_docs.length" - } - } - } - }, - { - "id": "ADDITIONAL_DOCS-TAKE-FIRST", - "name": "bag first doc", - "next": "ADDITIONAL_DOCS-GETINFO", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "setToBag", - "parameters": { - "input": { - "current_doc": { - "$js": "({bag}) => bag.remaining_additional_docs.shift()" - }, - "remaining_additional_docs": { - "$js": "({bag}) => { let result = bag.remaining_additional_docs; result.shift(); return result; }" - } - } - } - }, - { - "id": "ADDITIONAL_DOCS-GETINFO", - "name": "Submit ADDITIONAL_DOCS", - "next": "ADDITIONAL_DOCS-RESPONSE", - "type": "SubProcess", - "lane_id": "REVIEWER-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.current_doc.key" - }, - "chat_id": { - "$ref": "bag.chat_id" - }, - "profile": { - "$js": "({bag}) => bag.profiles[bag.current_doc.profile_type]" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - }, - "profile_type": { - "$ref": "bag.current_doc.profile_type" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "getInfo", - "valid_response": "finished" - } - }, - { - "id": "ADDITIONAL_DOCS-RESPONSE", - "name": "Verify getInfo response", - "next": { - "SUCCESS": "ADDITIONAL_DOCS-RESPONSE-BAG", - "default": "CLOSE-INACTIVE", - "FAIL-QUIT": "CLOSE-QUIT", - "FAIL-TIMEOUT": "CLOSE-INACTIVE", - "SUCCESS-NOOP": "ADDITIONAL_DOCS-RESPONSE-BAG" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.status" - } - } - } - }, - { - "id": "ADDITIONAL_DOCS-RESPONSE-BAG", - "name": "Set task settings to bag", - "next": "ADDITIONAL_DOCS-LENGTH", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "profiles": { - "main": { - "$js": "({bag,result}) => (bag.current_doc.profile_type === 'main') ? result.data.profile : bag.profiles.main" - }, - "second": { - "$js": "({bag,result}) => (bag.current_doc.profile_type === 'second') ? result.data.profile : bag.profiles.second" - } - } - } - } - }, - { - "id": "PROFILES-BAG", - "name": "update profiles, set profiles to main", - "next": "CLOSE-REVIEW", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "profile_type": "main" - } - } - }, - { - "id": "REJEITADO-NOTIFY", - "name": "Notify rejected request", - "next": "UPDATE-REQUEST-STATUS-REJECTED-ON-DB", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "message": "Bela: Que pena, infelizmente vou precisar encerrar o seu atendimento. Até mais!!" - } - ], - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_MESSAGE", - "timeout": 1 - } - }, - { - "id": "UPDATE-REQUEST-STATUS-REJECTED-ON-DB", - "name": "Update request status to rejected on database", - "next": "UPDATE-REQUEST-STATUS-REJECTED-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "REJECTED", - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-REJECTED-TO-BAG", - "name": "update request status to rejected to bag", - "next": "CLOSE-REJECT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: 'rejected' }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-REJECT", - "name": "Notify status to realtor", - "next": "CLOSE-REJECT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": "REJEITADO", - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "CLOSE-REVIEW", - "name": "Finish request status REJEITADO", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "REVIEW", - "profiles": { - "$ref": "bag.profiles" - }, - "observations": { - "$ref": "bag.observations" - }, - "profile_type": "main" - } - } - }, - { - "id": "CLOSE-REJECT", - "name": "Finish request status REJEITADO", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "REJECT", - "profiles": { - "$ref": "bag.profiles" - }, - "observations": { - "$ref": "bag.observations" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - } - } - }, - { - "id": "UPDATE-REQUEST", - "name": "Update Request", - "next": "UPDATE-REQUEST-STATUS-APPROVED-OR-CONDITIONED-ON-DB", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "status": { - "$ref": "bag.request.status" - }, - "profiles": { - "$ref": "bag.profiles" - }, - "request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/create-request-from-metadata" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "UPDATE-REQUEST-STATUS-APPROVED-OR-CONDITIONED-ON-DB", - "name": "Update request status to approved on database", - "next": "UPDATE-REQUEST-STATUS-APPROVED-OR-CONDITIONED-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": { - "$ref": "bag.cefFormData.status" - }, - "description": { - "$ref": "bag.observations" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-REQUEST-STATUS-APPROVED-OR-CONDITIONED-TO-BAG", - "name": "update request status to approved to bag", - "next": "NOTIFY-STATUS-HAS-CHANGED-TO-APPROVED-OR-COND", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, status: bag.cefFormData.status }}" - } - } - } - }, - { - "id": "NOTIFY-STATUS-HAS-CHANGED-TO-APPROVED-OR-COND", - "name": "Notify status to realtor", - "next": "SET-CREDIT-LIMIT-ON-DB", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "status": { - "$js": "({bag}) => bag.cefFormData.status === 'APPROVED' ? 'APROVADO' : bag.cefFormData.status === 'CONDITIONED' ? 'CONDICIONADO' : null " - }, - "request": { - "$ref": "bag.request" - }, - "author_id": { - "$ref": "bag.author_id" - }, - "buyer_number": { - "$ref": "bag.party_number" - } - }, - "actor_data": { - "$ref": "bag.buyer" - }, - "workflow_name": "notifyMessage" - } - }, - { - "id": "SET-CREDIT-LIMIT-ON-DB", - "name": "Update Request", - "next": "UPDATE-PROFILE-ON-DB", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "description": { - "$ref": "bag.observations" - }, - "credit_limit": { - "$ref": "bag.request.credit_limit" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{ bag.request.id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-PROFILE-ON-DB", - "name": "Update profile on database", - "next": "CLOSE-SUCCESS", - "type": "SystemTask", - "lane_id": "REVIEWER-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "credit_limit": { - "$ref": "bag.request.credit_limit" - }, - "current_request_id": { - "$ref": "bag.request.id" - }, - "documents_review_status": "VERIFIED" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{ bag.buyer.profile_id }}" - }, - "verb": "PATCH", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CLOSE-SUCCESS", - "name": "Finish request", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "SUCCESS", - "laudo_id": { - "$ref": "bag.laudo_id" - }, - "profiles": { - "$ref": "bag.profiles" - }, - "observations": { - "$ref": "bag.observations" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - } - } - }, - { - "id": "CLOSE-INACTIVE", - "name": "Finish request", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "INACTIVE", - "profiles": { - "$ref": "bag.profiles" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - } - } - }, - { - "id": "CLOSE-QUIT", - "name": "Finish request", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "status": "QUIT", - "profiles": { - "$ref": "bag.profiles" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - } - } - } - ], - "prepare": [], - "environment": { - "JWT_KEY": "JWT_KEY_BP", - "CHAT_API": "CHAT_API", - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/resetClient.json b/samples/blueprints/approva/resetClient.json deleted file mode 100644 index f76d3c24..00000000 --- a/samples/blueprints/approva/resetClient.json +++ /dev/null @@ -1,422 +0,0 @@ -{ - "name": "resetClient", - "description": "Workflow para para resetar cliente", - "blueprint_spec": { - "lanes": [ - { - "id": "RESET_CLIENT", - "name": "resetClient", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('resetClient') || actor_data.claims.includes('requestBot');" - } - }, - { - "id": "RESET_CLIENT_BACKOFFICE_ID", - "name": "resetClient and backoffice", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('resetClient') && actor_data.actor_id === bag.actor_id;" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start", - "next": "SET-ACTOR-ID-TO-BAG", - "type": "Start", - "lane_id": "RESET_CLIENT", - "parameters": { - "input_schema": { - "type": "object", - "properties": { - "phone_number": { - "type": "string" - } - } - } - } - }, - { - "id": "SET-ACTOR-ID-TO-BAG", - "name": "Set actor_id to Bag", - "next": "THERE-IS-PHONE-NUMBER-IN-BAG", - "type": "SystemTask", - "lane_id": "RESET_CLIENT", - "category": "SetToBag", - "parameters": { - "input": { - "actor_id": { - "$ref": "actor_data.actor_id" - } - } - } - }, - { - "id": "THERE-IS-PHONE-NUMBER-IN-BAG", - "name": "Verify if exist phone_number on bag", - "next": { - "true": "VALIDATE-PHONE-NUMBER", - "default": "SUBMIT-PHONE-NUMBER" - }, - "type": "Flow", - "lane_id": "RESET_CLIENT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !!bag?.phone_number" - } - } - } - }, - { - "id": "SUBMIT-PHONE-NUMBER", - "name": "Backoffice submit phone_number", - "next": "SET-PHONE-NUMBER-TO-BAG", - "type": "UserTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "parameters": { - "input": {}, - "action": "BACKOFFICE_SUBMIT_PHONE_NUMBER", - "timeout": 360, - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - }, - "phone_number": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "SET-PHONE-NUMBER-TO-BAG", - "name": "Set phone_number to Bag", - "next": "VALIDATE-PHONE-NUMBER", - "type": "SystemTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "category": "SetToBag", - "parameters": { - "input": { - "phone_number": { - "$ref": "result.activities[0].data.phone_number" - } - } - } - }, - { - "id": "VALIDATE-PHONE-NUMBER", - "name": "Validate IF is a valid PHONE NUMBER", - "next": "IS-VALID-PHONE-NUMBER", - "type": "SystemTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "category": "HTTP", - "parameters": { - "input": { - "value": { - "$ref": "bag.phone_number" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/validate/phone_number" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "IS-VALID-PHONE-NUMBER", - "name": "Verify if phone_number is a valid format.", - "next": { - "true": "GET-CURRENT-REQUEST-BY-PHONE-NUMBER", - "default": "NOTIFY-INVALID-PHONE-NUMBER" - }, - "type": "Flow", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "parameters": { - "input": { - "key": { - "$ref": "result.data.is_valid" - } - } - } - }, - { - "id": "NOTIFY-INVALID-PHONE-NUMBER", - "name": "Send message notifying invalid phone_number", - "next": "FINISH-INVALID-PHONE-NUMBER", - "type": "UserTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "parameters": { - "input": { - "message": "Número de Telefone Inválido", - "toggleModal": true - }, - "action": "NOTIFY_INVALID_PHONE_NUMBER", - "timeout": 120 - } - }, - { - "id": "FINISH-INVALID-PHONE-NUMBER", - "name": "Finish invalid phone_number", - "next": null, - "type": "Finish", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID" - }, - { - "id": "GET-CURRENT-REQUEST-BY-PHONE-NUMBER", - "name": "Get current_request by phone_number", - "next": "WAS-CURRENT-REQUEST-FOUND", - "type": "SystemTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?mobile_phone=eq.55{{bag.phone_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "WAS-CURRENT-REQUEST-FOUND", - "name": "Verify if current_request was found.", - "next": { - "true": "SET-CURRENT-REQUEST-ID-AND-PROFILE-ID-TO-BAG", - "default": "CUSTOM-NODE-ABORT-REQUEST-PROCESS-BY-ACTOR" - }, - "type": "Flow", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result?.data[0]?.current_request_id" - } - } - } - }, - { - "id": "SET-CURRENT-REQUEST-ID-AND-PROFILE-ID-TO-BAG", - "name": "Set current_request_id and profile_id to bag", - "next": "UPDATE-RESQUEST-STATUS-TO-CLOSED-BY-CURRENT-REQUEST-ID", - "type": "SystemTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "category": "SetToBag", - "parameters": { - "input": { - "actor": { - "$ref": "result.data[0].mobile_phone" - }, - "profile_id": { - "$ref": "result.data[0].id" - }, - "current_request_id": { - "$ref": "result.data[0].current_request_id" - } - } - } - }, - { - "id": "UPDATE-RESQUEST-STATUS-TO-CLOSED-BY-CURRENT-REQUEST-ID", - "name": "Update resquest status to CLOSED by current_request_id", - "next": "UPDATE-CURRENT-REQUEST-ID-TO-NULL-BY-PROFILE-ID", - "type": "SystemTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "category": "HTTP", - "parameters": { - "input": { - "status": "CLOSED" - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{bag.current_request_id}}" - }, - "verb": "PATCH", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-CURRENT-REQUEST-ID-TO-NULL-BY-PROFILE-ID", - "name": "Update current_request_id to NULL by profile_id", - "next": "SET-CHAT-TO-INACTIVE-BY-PHONE-NUMBER", - "type": "SystemTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "category": "HTTP", - "parameters": { - "input": { - "current_request_id": null - }, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{bag.profile_id}}" - }, - "verb": "PATCH", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-CHAT-TO-INACTIVE-BY-PHONE-NUMBER", - "name": "Set chat to inactive by phone_number", - "next": "CUSTOM-NODE-ABORT-REQUEST-PROCESS-BY-ACTOR", - "type": "SystemTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "category": "HTTP", - "parameters": { - "input": { - "status": "inactive" - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_POSTGREST}}}/chat?request_id=eq.{{bag.current_request_id }}" - }, - "verb": "PATCH", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CUSTOM-NODE-ABORT-REQUEST-PROCESS-BY-ACTOR", - "name": "Custom node to abort request process by actor", - "next": "VERIFY-CLIENT-RESET", - "type": "SystemTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "category": "AbortRequestProcessTask", - "parameters": { - "input": { - "actor": { - "$mustache": "55{{bag.phone_number}}" - }, - "actor_data": { - "$ref": "actor_data" - } - } - } - }, - { - "id": "VERIFY-CLIENT-RESET", - "name": "Verify if client reset successfully", - "next": { - "SUCESS": "NOTIFY-CLIENT-RESET-SUCCESSFULLY", - "default": "NOTIFY-RESET-CLIENT-FAIL" - }, - "type": "Flow", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "parameters": { - "input": { - "key": { - "$ref": "result.status" - } - } - } - }, - { - "id": "NOTIFY-CLIENT-RESET-SUCCESSFULLY", - "name": "Send message notifying reset client successfully", - "next": "FINISH-CLIENT-RESET-SUCCESSFULLY", - "type": "UserTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "parameters": { - "input": { - "message": "Cliente resetado com sucesso", - "toggleModal": true - }, - "action": "NOTIFY_CLIENT_RESET_SUCCESSFULLY", - "timeout": 120 - } - }, - { - "id": "FINISH-CLIENT-RESET-SUCCESSFULLY", - "name": "Finish client reset successfully", - "next": null, - "type": "Finish", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID" - }, - { - "id": "NOTIFY-RESET-CLIENT-FAIL", - "name": "Send message notifying reset client fail", - "next": "FINISH-RESET-CLIENT-FAIL", - "type": "UserTask", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID", - "parameters": { - "input": { - "message": "Falha ao resetar o cliente", - "toggleModal": true - }, - "action": "NOTIFY_RESET_CLIENT_FAIL", - "timeout": 120 - } - }, - { - "id": "FINISH-RESET-CLIENT-FAIL", - "name": "Finish reset client fail", - "next": null, - "type": "Finish", - "lane_id": "RESET_CLIENT_BACKOFFICE_ID" - } - ], - "prepare": [], - "environment": { - "JWT_KEY": "JWT_KEY_BP", - "CHAT_API": "CHAT_API", - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API", - "CHAT_POSTGREST": "CHAT_POSTGREST" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/resetPassword.json b/samples/blueprints/approva/resetPassword.json deleted file mode 100644 index a6d4b333..00000000 --- a/samples/blueprints/approva/resetPassword.json +++ /dev/null @@ -1,459 +0,0 @@ -{ - "name": "resetPassword", - "description": "Workflow para recuperar senha", - "blueprint_spec": { - "lanes": [ - { - "id": "ANONYMOUS", - "name": "Anonymous", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('anonymous')" - } - }, - { - "id": "VALID-ACTOR", - "name": "ValidActor", - "rule": { - "$js": "({actor_data, bag}) => actor_data.session_id == bag.session_id" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "RESET-PASSWORD-1", - "type": "Start", - "lane_id": "ANONYMOUS", - "parameters": { - "input_schema": {} - } - }, - { - "id": "RESET-PASSWORD-1", - "name": "Verify if phone number is provided", - "next": { - "true": "RESET-PASSWORD-5", - "default": "RESET-PASSWORD-2" - }, - "type": "Flow", - "lane_id": "ANONYMOUS", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "RESET-PASSWORD-2", - "name": "Submit phone number", - "next": "RESET-PASSWORD-3", - "type": "UserTask", - "lane_id": "ANONYMOUS", - "parameters": { - "input": {}, - "action": "SUBMIT_ACTOR", - "activity_schema": { - "type": "object", - "required": [ - "actor" - ], - "properties": { - "actor": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "RESET-PASSWORD-3", - "name": "Set phone number to bag", - "next": "RESET-PASSWORD-4", - "type": "SystemTask", - "lane_id": "ANONYMOUS", - "category": "SetToBag", - "parameters": { - "input": { - "actor": { - "$ref": "result.activities[0].data.actor" - } - } - } - }, - { - "id": "RESET-PASSWORD-4", - "name": "Get account settings", - "next": "RESET-PASSWORD-5", - "type": "SystemTask", - "lane_id": "ANONYMOUS", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?mobile_phone=eq.{{bag.actor}}&role=eq.BACKOFFICE&status=eq.active" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "RESET-PASSWORD-5", - "name": "Verify if phone number exists", - "next": { - "true": "RESET-PASSWORD-5-1", - "default": "RESET-PASSWORD-5-B-1" - }, - "type": "Flow", - "lane_id": "ANONYMOUS", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !result.data[0] ? null : !!result.data[0].mobile_phone" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-B-1", - "name": "Notify invalid phone number", - "next": "RESET-PASSWORD-2", - "type": "UserTask", - "lane_id": "ANONYMOUS", - "parameters": { - "input": { - "message": "Não é possivel continuar!", - "toggleModal": true - }, - "action": "NOTIFY_FAILURE", - "timeout": 2 - } - }, - { - "id": "RESET-PASSWORD-5-1", - "name": "Set session id to bag", - "next": "RESET-PASSWORD-5-A-1", - "type": "SystemTask", - "lane_id": "VALID-ACTOR", - "category": "SetToBag", - "parameters": { - "input": { - "session_id": { - "$ref": "actor_data.session_id" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-A-1", - "name": "Saves phone generate Token and Set To Bag", - "next": "RESET-PASSWORD-5-A-2", - "type": "SystemTask", - "lane_id": "VALID-ACTOR", - "category": "SetToBag", - "parameters": { - "input": { - "token": { - "$js": "() => `${Math.floor(1000 + Math.random() * 9000)}`" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-A-2", - "name": "Send token sms", - "next": "RESET-PASSWORD-5-A-3", - "type": "SystemTask", - "lane_id": "VALID-ACTOR", - "category": "HTTP", - "parameters": { - "input": { - "phone": { - "$ref": "bag.actor" - }, - "message": { - "$mustache": "Utilize o token {{bag.token}} para realizar sua requisição" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_services:3000/rpc/token/send" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200 - ] - } - }, - { - "id": "RESET-PASSWORD-5-A-3", - "name": "Submit token received", - "next": "RESET-PASSWORD-5-A-4", - "type": "UserTask", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "toggleModal": true, - "activity_schema": { - "type": "object", - "properties": { - "token": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "SUBMIT_TOKEN", - "timeout": 300 - } - }, - { - "id": "RESET-PASSWORD-5-A-4", - "name": "Set submited token to bag", - "next": "RESET-PASSWORD-5-A-5", - "type": "SystemTask", - "lane_id": "VALID-ACTOR", - "category": "SetToBag", - "parameters": { - "input": { - "submited_token": { - "$ref": "result.activities[0].data.token" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-A-5", - "name": "Check if timeout is expired", - "next": { - "true": "FINISH", - "default": "RESET-PASSWORD-5-A-6" - }, - "type": "Flow", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "$js": "({result}) => result.is_continous" - } - } - }, - { - "id": "RESET-PASSWORD-5-A-6", - "name": "Verify to submited token", - "next": { - "true": "FINISH", - "default": "RESET-PASSWORD-5-A-7" - }, - "type": "Flow", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "$js": "({bag}) => bag.submited_token" - } - } - }, - { - "id": "RESET-PASSWORD-5-A-7", - "name": "verify token is valid", - "next": { - "true": "RESET-PASSWORD-5-A-8", - "default": "RESET-PASSWORD-5-C-1" - }, - "type": "Flow", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.token == bag.submited_token" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-C-1", - "name": "Notify token is invalid", - "next": "FINISH", - "type": "UserTask", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "toggleModal": true, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "message": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "NOTIFY_FAILURE", - "timeout": 2 - } - }, - { - "id": "RESET-PASSWORD-5-A-8", - "name": "Submit new password", - "next": "RESET-PASSWORD-5-A-9", - "type": "UserTask", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "toggleModal": true, - "activity_schema": { - "type": "object", - "required": [ - "new_password", - "confirm_password" - ], - "properties": { - "new_password": { - "type": "string" - }, - "confirm_password": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "SUBMIT_PASSWORD" - } - }, - { - "id": "RESET-PASSWORD-5-A-9", - "name": "Set password to bag", - "next": "RESET-PASSWORD-5-A-10", - "type": "SystemTask", - "lane_id": "VALID-ACTOR", - "category": "SetToBag", - "parameters": { - "input": { - "new_password": { - "$ref": "result.activities[0].data.new_password" - }, - "confirm_password": { - "$ref": "result.activities[0].data.confirm_password" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-A-10", - "name": "Validate Password", - "next": "RESET-PASSWORD-5-A-11", - "type": "SystemTask", - "lane_id": "VALID-ACTOR", - "category": "ValidatePasswordTask", - "parameters": { - "input": { - "new_password": { - "$ref": "bag.new_password" - }, - "confirm_password": { - "$ref": "bag.confirm_password" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-A-11", - "name": "verify password is valid", - "next": { - "true": "RESET-PASSWORD-5-A-12", - "default": "RESET-PASSWORD-5-D-1" - }, - "type": "Flow", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "key": { - "$ref": "result.is_valid" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-D-1", - "name": "Notify password invalid", - "next": "RESET-PASSWORD-5-A-8", - "type": "UserTask", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "message": "Senha inválida!", - "toggleModal": true - }, - "action": "NOTIFY_WARNING", - "timeout": 2 - } - }, - { - "id": "RESET-PASSWORD-5-A-12", - "name": "Change Password", - "next": "RESET-PASSWORD-5-A-13", - "type": "SystemTask", - "lane_id": "VALID-ACTOR", - "category": "ChangePasswordTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.actor" - }, - "new_password": { - "$ref": "bag.new_password" - } - } - } - }, - { - "id": "RESET-PASSWORD-5-A-13", - "name": "Notify success", - "next": "FINISH", - "type": "UserTask", - "lane_id": "VALID-ACTOR", - "parameters": { - "input": { - "message": "Senha alterada com sucesso!", - "toggleModal": true - }, - "action": "NOTIFY_SUCCESS", - "timeout": 2 - } - }, - { - "id": "FINISH", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "VALID-ACTOR" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/salesManagement.json b/samples/blueprints/approva/salesManagement.json deleted file mode 100644 index 5c5728b0..00000000 --- a/samples/blueprints/approva/salesManagement.json +++ /dev/null @@ -1,570 +0,0 @@ -{ - "name": "salesManagement", - "description": "Fluxo para gestão de vendas", - "blueprint_spec": { - "lanes": [ - { - "id": "GENERAL", - "name": "General access", - "rule": { - "$js": "({actor_data, bag}) => (actor_data.claims).includes('salesManagement')" - } - }, - { - "id": "LIST-READ", - "name": "List and read claims", - "rule": { - "$js": "({actor_data, bag}) => ((actor_data.claims).includes('salesManagement') && actor_data.actor_id == bag.actor_id)" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start unit CRUD", - "next": "GET-DEV-CONTRACTS", - "type": "Start", - "lane_id": "GENERAL", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "intent", - "key" - ], - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "intent": { - "type": "string" - } - } - } - } - }, - { - "id": "GET-DEV-CONTRACTS", - "name": "Get dev contracts", - "next": "SET-DEV-CONTRACTS-TO-BAG", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.{{bag.key}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-DEV-CONTRACTS-TO-BAG", - "name": "Set task settings to bag", - "next": "VALIDATE-INPUT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "filter": { - "$js": "({bag}) => {let filter = ''; if (bag.filters) {const f = bag.filters; Object.entries(f).forEach(([key, value]) => {filter += key + '=eq.' + value + '&';});}; return filter;}" - }, - "schema": { - "$ref": "result.data[0].value" - }, - "key_url": { - "$js": "({bag}) => {return (bag.key).substring(7,(bag.key.length))}" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - }, - "pagination": { - "$js": "({bag}) => bag.offset && bag.limit ? bag.offset * bag.limit : null" - } - } - } - }, - { - "id": "VALIDATE-INPUT", - "name": "Validade input", - "next": "VERIFY-INTENT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/units?id=*" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400, - 404 - ] - } - }, - { - "id": "CHECK-INPUT", - "name": "Check input", - "next": { - "true": "VERIFY-INTENT", - "default": "FINISH-DEV-CONTRACTS" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.status" - } - } - } - }, - { - "id": "VERIFY-INTENT", - "name": "Verify user intent", - "next": { - "READ": "GET-REQUEST", - "default": "LIST-REQUESTS-FOR-KANBAN" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$ref": "bag.intent" - } - } - } - }, - { - "id": "LIST-REQUESTS-FOR-KANBAN", - "name": "List requests for kanban", - "next": "SET-REQUEST-LIST-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": { - "is_team": { - "$ref": "bag.is_team" - }, - "actor_id": { - "$ref": "bag.actor_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests_management/list-requests-for-kanban" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-REQUEST-LIST-TO-BAG", - "name": "Set request list to bag", - "next": "GET-INTERACTION-INFORMATION-BY-REQUEST", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "requests": { - "$ref": "result.data" - } - } - } - }, - { - "id": "GET-INTERACTION-INFORMATION-BY-REQUEST", - "name": "Get interaction information by request", - "next": "LIST", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": { - "requests": { - "$ref": "bag.requests" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/message/get-interaction-information-by-request" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "LIST", - "name": "Show units to user", - "next": "CHECK-TIMEOUT-LIST", - "type": "UserTask", - "lane_id": "LIST-READ", - "parameters": { - "input": { - "list": { - "$ref": "result.data" - }, - "interactions": { - "$ref": "bag.interactions" - }, - "last_message": { - "$ref": "bag.last_message" - }, - "activity_schema": { - "$ref": "bag.schema.LIST" - } - }, - "action": "LIST", - "timeout": 360 - } - }, - { - "id": "CHECK-TIMEOUT-LIST", - "name": "Check timeout", - "next": { - "true": "FINISH-LIST", - "default": "SET-OFFSET-LIMIT-TO-BAG" - }, - "type": "Flow", - "lane_id": "LIST-READ", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "SET-OFFSET-LIMIT-TO-BAG", - "name": "Set value offset and limit to bag", - "next": "LIST", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "limit": { - "$js": "({result}) => result.activities[0]?.data?.limit ? result.activities[0].data.limit : 10" - }, - "filter": { - "$js": "({result}) => {let filter = ''; if (result.activities[0]?.data?.filters) {const f = result.activities[0].data.filters; Object.entries(f).forEach(([key, value]) => {filter += key + '=eq.' + value + '&';});}; return filter;}" - }, - "offset": { - "$js": "({result}) => result.activities[0]?.data?.offset ? result.activities[0].data.offset : 0" - }, - "filters": { - "$js": "({result}) => result.activities[0]?.data?.filters ? result.activities[0].data.filters : {}" - }, - "pagination": { - "$js": "({result}) => result.activities[0]?.data?.limit && result.activities[0]?.data?.offset ? result.activities[0].data.limit * result.activities[0].data.offset : 0" - } - } - } - }, - { - "id": "GET-REQUEST", - "name": "Get request", - "next": "SET-REQUEST-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{bag.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204, - 400, - 404, - 408, - 409 - ] - } - }, - { - "id": "SET-REQUEST-TO-BAG", - "name": "Set request to bag", - "next": "GET-PROFILE-CLIENT", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "GET-PROFILE-CLIENT", - "name": "Get profile", - "next": "SET-PROFILE-CLIENT-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{bag.request.buyer_id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-PROFILE-CLIENT-TO-BAG", - "name": "Set profile to bag", - "next": "GET-PROFILE-REALTOR", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "profile": { - "$js": "({result}) => result.data[0] ? result.data[0] : null" - } - } - } - }, - { - "id": "GET-PROFILE-REALTOR", - "name": "Get profile", - "next": "SET-PROFILE-REALTOR-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{bag.request.realtor}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204, - 400, - 404, - 408, - 409 - ] - } - }, - { - "id": "SET-PROFILE-REALTOR-TO-BAG", - "name": "Set profile to bag", - "next": "GET-PROOFS", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "realtor": { - "$js": "({result}) => result.data[0] ? result.data[0] : null" - } - } - } - }, - { - "id": "GET-PROOFS", - "name": "Get proofs", - "next": "SET-PROOFS-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/{{bag.request.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-PROOFS-TO-BAG", - "name": "Set proofs to bag", - "next": "SEND-DATA-TO-READ", - "type": "SystemTask", - "lane_id": "LIST-READ", - "category": "SetToBag", - "parameters": { - "input": { - "proofs": { - "$ref": "result.data.proofs" - } - } - } - }, - { - "id": "SEND-DATA-TO-READ", - "name": "Send data to read", - "next": "FINISH-READ", - "type": "UserTask", - "lane_id": "LIST-READ", - "parameters": { - "input": { - "proofs": { - "$ref": "bag.proofs" - }, - "realtor": { - "$ref": "bag.realtor" - }, - "request": { - "$ref": "bag.request" - }, - "profiles": { - "main": { - "$js": "({ bag }) => { const title = { name: bag?.request?.metadata?.profiles?.main?.name?.value, email: bag?.request?.metadata?.profiles?.main?.email?.value, phone: bag?.party_number }; return { ...bag?.request?.metadata?.profiles?.main, title }; };" - }, - "second": { - "$js": "({ bag }) => { const title = { name: bag?.request?.metadata?.profiles?.second?.name?.value, email: bag?.request?.metadata?.profiles.second?.email?.value }; return { ...bag?.request?.metadata?.profiles?.second, title }; };" - } - }, - "card_data": { - "date": { - "$ref": "bag.profile.created_at" - }, - "name": { - "$ref": "bag.profile.name" - }, - "phone": { - "$ref": "bag.profile.mobile_phone" - } - }, - "ui_schema": { - "$ref": "bag.schema.READ.ui_schema" - }, - "activity_schema": { - "$ref": "bag.schema.READ.activity_schema" - }, - "additionalProperties": false - }, - "action": "READ", - "timeout": 360 - } - }, - { - "id": "FINISH-LIST", - "name": "Finish salesManagement", - "next": null, - "type": "Finish", - "lane_id": "LIST-READ" - }, - { - "id": "FINISH-READ", - "name": "Finish salesManagement", - "next": null, - "type": "Finish", - "lane_id": "LIST-READ" - }, - { - "id": "FINISH-DEV-CONTRACTS", - "name": "Finish salesManagement", - "next": null, - "type": "Finish", - "lane_id": "GENERAL" - } - ], - "prepare": [], - "environment": { - "XPTO": "BOTAUTHOR", - "JWT_KEY": "JWT_KEY_BP", - "CHAT_API": "CHAT_API", - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API", - "CHAT_POSTGREST": "CHAT_POSTGREST" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/setupInfo.json b/samples/blueprints/approva/setupInfo.json deleted file mode 100644 index 84bcbf88..00000000 --- a/samples/blueprints/approva/setupInfo.json +++ /dev/null @@ -1,1939 +0,0 @@ -{ - "name": "setupInfo", - "description": "Fluxo para capturar ou criar actor/profile/request/chat de um cliente.", - "blueprint_spec": { - "lanes": [ - { - "id": "REQUESTBOT", - "name": "Buyer", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('requestBot')" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start checkUserInfo", - "next": "CAPTURE-FIRST-MESSAGE", - "type": "Start", - "lane_id": "REQUESTBOT", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "party_number" - ], - "properties": { - "chat_id": { - "type": "string" - }, - "party_number": { - "type": "string" - } - } - } - } - }, - { - "id": "CAPTURE-FIRST-MESSAGE", - "name": "Capturing message content", - "next": "BAG-FIRST-MESSAGE", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "activity_schema": { - "type": "object", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "object", - "properties": { - "id": { - "type": "string", - "format": "uuid" - }, - "order": { - "type": "number" - }, - "chat_id": { - "type": "string", - "format": "uuid" - }, - "content": { - "type": "object" - }, - "author_id": { - "type": "string", - "format": "uuid" - } - } - } - }, - "additionalProperties": false - } - }, - "action": "SUBMIT_MESSAGE" - } - }, - { - "id": "BAG-FIRST-MESSAGE", - "name": "Set message to bag", - "next": "CHECK-FIRST-MESSAGE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "message": { - "$ref": "result.activities[0].data.message" - }, - "author_id": { - "$ref": "environment.XPTO" - } - } - } - }, - { - "id": "CHECK-FIRST-MESSAGE", - "name": "Verify link first message", - "next": { - "true": "SET-REALTOR-NUMBER-LINK-MESSAGE", - "default": "VALIDATE-PARTY-NUMBER" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.message.content.text.length === 61" - } - } - } - }, - { - "id": "SET-REALTOR-NUMBER-LINK-MESSAGE", - "name": "Set whatsapp validated party number to bag", - "next": "VALIDATE-PARTY-NUMBER", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "realtor_number": { - "$js": "({bag}) => bag.message.content.text.slice(17,30)" - } - } - } - }, - { - "id": "VALIDATE-PARTY-NUMBER", - "name": "Set whatsapp validated party number to bag", - "next": "GET-PROFILE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "party_number": { - "$js": "({bag}) => bag.party_number.length === 12 ? bag.party_number.substring(0,4) + '9' + bag.party_number.substring(4,12) : bag.party_number" - }, - "profile_type": "main" - } - } - }, - { - "id": "GET-PROFILE", - "name": "Get or create Profile", - "next": "PROFILE-EXIST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "PROFILE-EXIST", - "name": "Verify if profile exist on database.", - "next": { - "true": "BAG-PROFILE", - "default": "GET-ACCOUNT" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.status && result.status === 200" - } - } - } - }, - { - "id": "GET-ACCOUNT", - "name": "Get account settings", - "next": "BAG-CLAIMS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "BAG-CLAIMS", - "name": "Set default claims to bag, account_id and files phrases", - "next": "GET-ACTOR", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "account_id": { - "$ref": "result.data[0].id" - }, - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "GET-ACTOR", - "name": "Get actor", - "next": "ACTOR-EXIST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "GetActorTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - } - } - } - }, - { - "id": "ACTOR-EXIST", - "name": "Verify if actor exist on database.", - "next": { - "true": "BAG-ACTOR", - "default": "CREATE-ACTOR" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.is_active" - } - } - } - }, - { - "id": "CREATE-ACTOR", - "name": "Create actor", - "next": "BAG-ACTOR", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "CreateActorTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.party_number" - }, - "claims": { - "$ref": "bag.default_claims" - }, - "account_id": { - "$ref": "bag.account_id" - } - } - } - }, - { - "id": "BAG-ACTOR", - "name": "Set actor to bag", - "next": "CREATE-PROFILE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "actor": { - "$ref": "result.actor" - } - } - } - }, - { - "id": "CREATE-PROFILE", - "name": "Create profile", - "next": "BAG-PROFILE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "role": "CLIENT", - "actor_id": { - "$ref": "bag.actor.id" - }, - "mobile_phone": { - "$ref": "bag.party_number" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/create" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "BAG-PROFILE", - "name": "Set profile to bag", - "next": "CHECK-PROFILE-ROLE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_profile": { - "$ref": "result.data" - } - } - } - }, - { - "id": "CHECK-PROFILE-ROLE", - "name": "Check if profile is client or realtor", - "next": { - "CLIENT": "HAS-REQUEST-ID", - "default": "VALIDATE-MESSAGE-CONTENT" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.buyer_profile.role" - } - } - } - }, - { - "id": "VALIDATE-MESSAGE-CONTENT", - "name": "Validate IF MESSAGE IS A PHONE NUMBER", - "next": "IS-PHONE-NUMBER", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/chat/{{bag.message.content.text}}/phone-number-validator" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "IS-PHONE-NUMBER", - "name": "Verify if message is a phone number sent from the realtor", - "next": { - "true": "BAG-REALTOR-NUMBER", - "default": "NOTIFY-REALTOR-INVALID-PHONE-NUMBER" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.data.is_valid" - } - } - } - }, - { - "id": "BAG-REALTOR-NUMBER", - "name": "Set request to bag", - "next": "CREATE-OR-SETUP-PARTY-NUMBER-CHAT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "party_number": { - "$mustache": "55{{bag.message.content.text}}" - }, - "realtor_number": { - "$ref": "bag.party_number" - }, - "realtor_profile": { - "$ref": "bag.buyer_profile" - } - } - } - }, - { - "id": "CREATE-OR-SETUP-PARTY-NUMBER-CHAT", - "name": "Create or setup party number chat", - "next": "BAG-CREATED-SETUP-CHAT-ID-FROM-BUYER", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "buyer_phone_number": { - "$ref": "bag.party_number" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/create-setup-chat" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "BAG-CREATED-SETUP-CHAT-ID-FROM-BUYER", - "name": "Set request to bag", - "next": "INACTIVATE-REALTOR-CHAT-ID", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "chat_id": { - "$ref": "result.data.id" - }, - "message": {}, - "realtor_chat_id": { - "$ref": "bag.chat_id" - } - } - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID", - "name": "Inactivate realtor chat id", - "next": "VALIDATE-BUYER-PARTY-NUMBER", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "VALIDATE-BUYER-PARTY-NUMBER", - "name": "Set whatsapp validated party number to bag", - "next": "GET-BUYER-PROFILE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "party_number": { - "$js": "({bag}) => bag.party_number.length === 12 ? bag.party_number.substring(0,4) + '9' + bag.party_number.substring(4,12) : bag.party_number" - }, - "profile_type": "main" - } - } - }, - { - "id": "GET-BUYER-PROFILE", - "name": "Get or create buyer Profile", - "next": "BUYER-PROFILE-EXIST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/{{bag.party_number}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "BUYER-PROFILE-EXIST", - "name": "Verify if profile exist on database.", - "next": { - "true": "BAG-PROFILE", - "default": "GET-ACCOUNT" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.status && result.status === 200" - } - } - } - }, - { - "id": "BAG-BUYER-PROFILE", - "name": "Set profile to bag", - "next": "HAS-CURRENT-REQUEST-ID", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "buyer_profile": { - "$ref": "result.data" - } - } - } - }, - { - "id": "HAS-REQUEST-ID", - "name": "Verify if client has older request order", - "next": "CHECK-HAS-LAST-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?buyer_id=eq.{{bag.buyer_profile.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CHECK-HAS-LAST-REQUEST", - "name": "Verify if request exist on database.", - "next": { - "true": "SET-LAST-REQUEST-ID-TO-BAG", - "default": "CREATE-REQUEST" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result?.data?.length" - } - } - } - }, - { - "id": "SET-LAST-REQUEST-ID-TO-BAG", - "name": "Set profile to bag", - "next": "GET-REALTOR-ON-LAST-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "last_request": { - "$ref": "result.data[0]" - } - } - } - }, - { - "id": "GET-REALTOR-ON-LAST-REQUEST", - "name": "Set realtor info on bag", - "next": "SET-LAST-REALTOR-DATA-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?id=eq.{{bag.last_request.realtor}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-LAST-REALTOR-DATA-TO-BAG", - "name": "Add realtor info on request object", - "next": "CREATE-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "realtor_number": { - "$ref": "result.data[0].mobile_phone" - }, - "realtor_profile": { - "id": { - "$ref": "result.data[0].id" - }, - "name": { - "$ref": "result.data[0].name" - }, - "email": { - "$ref": "result.data[0].email" - }, - "actor_id": { - "$ref": "result.data[0].actor_id" - }, - "username": { - "$ref": "result.data[0].username" - }, - "mobile_phone": { - "$ref": "result.data[0].mobile_phone" - } - } - } - } - }, - { - "id": "HAS-CURRENT-REQUEST-ID", - "name": "Verify if client has current request id", - "next": { - "true": "GET-REQUEST", - "default": "CREATE-REQUEST" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !!bag.buyer_profile.current_request_id" - } - } - } - }, - { - "id": "CREATE-REQUEST", - "name": "Create Request", - "next": "REQUEST-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "buyer_profile_id": { - "$ref": "bag.buyer_profile.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "REQUEST-BAG", - "name": "Set request to bag", - "next": "SET-CHAT-TO-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$ref": "result.data" - } - } - } - }, - { - "id": "SET-CHAT-TO-REQUEST", - "name": "Set chat to Request", - "next": "HAS-REALTOR-ON-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "request_id": { - "$ref": "bag.request.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/set-request-on-chat" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "HAS-REALTOR-ON-REQUEST", - "name": "Verify if request has realtor", - "next": { - "true": "ASSIGN-REALTOR", - "default": "ASSIGN-RANDOM-REALTOR" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !!bag.realtor_number ? true : false" - } - } - } - }, - { - "id": "ASSIGN-RANDOM-REALTOR", - "name": "Assign Realtor to Request", - "next": "GET-REALTOR-BY-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "realtor_number": null - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/assign" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "GET-REALTOR-BY-REQUEST", - "name": "get realtor by request id", - "next": "SET-REALTOR-PROFILE-TO-BAG", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/{{bag.request.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-REALTOR-PROFILE-TO-BAG", - "name": "Set realtor profile to bag", - "next": "ADD-REALTOR-INFO-ON-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "realtor_number": { - "$ref": "result.data.realtor.mobile_phone" - }, - "realtor_profile": { - "$ref": "result.data.realtor" - } - } - } - }, - { - "id": "ASSIGN-REALTOR", - "name": "Assign Realtor to Request", - "next": "GET-REALTOR-BY-LINK-MESSAGE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "request_id": { - "$ref": "bag.request.id" - }, - "realtor_number": { - "$ref": "bag.realtor_number" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/assign" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "GET-REALTOR-BY-LINK-MESSAGE", - "name": "get realtor by mobile phone", - "next": "SET-REALTOR-BY-LINK-MESSAGE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/profiles?mobile_phone=eq.{{bag.realtor_number}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-REALTOR-BY-LINK-MESSAGE", - "name": "Add realtor info on request object", - "next": "ADD-REALTOR-INFO-ON-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "realtor_profile": { - "id": { - "$ref": "result.data[0].id" - }, - "name": { - "$ref": "result.data[0].name" - }, - "email": { - "$ref": "result.data[0].email" - }, - "actor_id": { - "$ref": "result.data[0].actor_id" - }, - "username": { - "$ref": "result.data[0].username" - }, - "mobile_phone": { - "$ref": "result.data[0].mobile_phone" - } - } - } - } - }, - { - "id": "ADD-REALTOR-INFO-ON-REQUEST", - "name": "Add realtor info on request object", - "next": "NOTIFY-REALTOR-PROCESS-STARTED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$js": "({bag}) => { return { ...bag.request, realtor: bag.realtor_profile } }" - } - } - } - }, - { - "id": "GET-REQUEST", - "name": "Get request", - "next": "BAG-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/requests?id=eq.{{bag.buyer_profile.current_request_id}}" - }, - "verb": "GET", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400 - ] - } - }, - { - "id": "BAG-REQUEST", - "name": "Set request to bag", - "next": "VERIFY-STATUS-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "request": { - "$ref": "result.data[0]" - }, - "request_status": { - "$ref": "result.data[0].status" - } - } - } - }, - { - "id": "VERIFY-STATUS-REQUEST", - "name": "Check request status", - "next": { - "CLOSED": "HAS-REALTOR-NUMBER", - "default": "EXIST-REALTOR-NUMBER", - "APPROVED": "HAS-REALTOR-NUMBER", - "RECOVERY": "HAS-REALTOR-NUMBER", - "REPROVED": "HAS-REALTOR-NUMBER", - "NO_CONSENT": "HAS-REALTOR-NUMBER", - "AWAITING_CONSENT": "HAS-REALTOR-NUMBER", - "AWAITING_ANALYSIS": "HAS-REALTOR-NUMBER", - "AWAITING_DOCUMENTS": "HAS-REALTOR-NUMBER", - "DOCUMENTS_RECEIVED": "HAS-REALTOR-NUMBER" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.request.status" - } - } - } - }, - { - "id": "EXIST-REALTOR-NUMBER", - "name": "Check if bag has realtor number", - "next": { - "default": "NOTIFY-REALTOR-PROCESS-RUNNING", - "undefined": "NOTIFY-CLIENT-PROCESS-RUNNING" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.realtor_number" - } - } - } - }, - { - "id": "HAS-REALTOR-NUMBER", - "name": "Check if bag has realtor number", - "next": { - "true": "SAME-REALTOR", - "default": "INACTIVATE-CLIENT-CHAT-ID-IF-PROCESS-RUNNING" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => !!bag.realtor_number" - } - } - } - }, - { - "id": "SAME-REALTOR", - "name": "Check if bag has realtor number", - "next": { - "true": "NOTIFY-REALTOR-FEEDBACK", - "default": "NOTIFY-REALTOR-UNMATCHED" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => (!!bag.realtor_number && !bag.buyer_profile.current_request_id) || (!!bag.realtor_number && bag.request.realtor === bag.realtor_profile.id)" - } - } - } - }, - { - "id": "NOTIFY-REALTOR-FEEDBACK", - "name": "Check request status", - "next": { - "default": "EXIST-REALTOR-NUMBER", - "APPROVED": "NOTIFY-REALTOR-CLIENT-APPROVED", - "RECOVERY": "NOTIFY-REALTOR-CLIENT-RECOVERY", - "NO_CONSENT": "NOTIFY-REALTOR-CLIENT-NO-CONSENT", - "AWAITING_CONSENT": "NOTIFY-REALTOR-CLIENT-SEND-DOCS", - "AWAITING_ANALYSIS": "NOTIFY-REALTOR-CLIENT-AWAITING-ANALYSIS", - "AWAITING_DOCUMENTS": "NOTIFY-REALTOR-CLIENT-SEND-DOCS", - "DOCUMENTS_RECEIVED": "NOTIFY-REALTOR-CLIENT-DOCS-RECEIVED" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "bag.request_status" - } - } - } - }, - { - "id": "NOTIFY-REALTOR-CLIENT-RECOVERY", - "name": "Send message notifying client recovery", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-RECOVERY", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Corretor, o seu cliente não finalizou a análise de pedido e acabou entrando em fase de recuperação." - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_REALTOR_CLIENT_RECOVERY", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-RECOVERY", - "name": "Inactivate realtor chat id", - "next": "EXIT-REALTOR-CLIENT-RECOVERY", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-CLIENT-NO-CONSENT", - "name": "Send message notifying client refuse consent", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-NO-CONSENT", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Corretor, o seu cliente não deu consentimento para iniciar uma análise." - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_REALTOR_CLIENT_NO_CONSENT", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-NO-CONSENT", - "name": "Inactivate realtor chat id", - "next": "EXIT-REALTOR-CLIENT-NO-CONSENT", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-CLIENT-APPROVED", - "name": "Send message notifying client approved", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-APPROVED", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Corretor, o seu cliente já possui um pedido aprovado. Fale com um de nossos analistas!" - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_REALTOR_CLIENT_APPROVED", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-APPROVED", - "name": "Inactivate realtor chat id", - "next": "EXIT-REALTOR-CLIENT-APPROVED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-CLIENT-AWAITING-ANALYSIS", - "name": "Send message notifying client awaiting analysis", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-AWAITING-ANALYSIS", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Corretor, o seu cliente ja possui um pedido em análise!" - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_REALTOR_CLIENT_AWAITING_ANALYSIS", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-AWAITING-ANALYSIS", - "name": "Inactivate realtor chat id", - "next": "EXIT-REALTOR-CLIENT-AWAITING-ANALYSIS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-CLIENT-DOCS-RECEIVED", - "name": "Send message notifying client docs received", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-DOCS-RECEIVED", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Corretor, o seu cliente já possui um pedido em análise!" - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_REALTOR_CLIENT_DOCS_RECEIVED", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-DOCS-RECEIVED", - "name": "Inactivate realtor chat id", - "next": "EXIT-REALTOR-CLIENT-DOC-RECEIVED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-CLIENT-SEND-DOCS", - "name": "Send message notifying client send docs", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-SENDING-DOCS", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Corretor, o seu cliente está com um pedido em andamento!" - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_REALTOR_CLIENT_SEND_DOCS", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-CLIENT-SENDING-DOCS", - "name": "Inactivate realtor chat id", - "next": "EXIT-REALTOR-CLIENT-SEND-DOCS", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-UNMATCHED", - "name": "Send message notifying request exit", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-UNMATCHED", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Você não é o corretor deste cliente." - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_INVALID_REALTOR", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-UNMATCHED", - "name": "Inactivate realtor chat id", - "next": "EXIT-REALTOR-UNMATCHED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-INVALID-PHONE-NUMBER", - "name": "Send message notifying request exit", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-INVALID-PHONE-NUMBER", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "text": "Bela: Corretor, envie um número de telefone válido." - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_REALTOR_INVALID_PHONE_NUMBER", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-INVALID-PHONE-NUMBER", - "name": "Inactivate realtor chat id", - "next": "EXIT-INVALID-PHONE-NUMBER", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-PROCESS-RUNNING", - "name": "Send message notifying request exit", - "next": "INACTIVATE-REALTOR-CHAT-ID-IF-PROCESS-RUNNING", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Corretor, o cliente informado já possui um pedido em andamento.." - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_PROCESS_RUNNING", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-REALTOR-CHAT-ID-IF-PROCESS-RUNNING", - "name": "Inactivate realtor chat id", - "next": "EXIT-PROCESS-RUNNING", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-CLIENT-PROCESS-RUNNING", - "name": "Send message notifying request exit", - "next": "INACTIVATE-CLIENT-CHAT-ID-IF-PROCESS-RUNNING", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Você já possui um pedido em andamento." - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.party_number" - } - }, - "action": "NOTIFY_PROCESS_RUNNING", - "timeout": 1 - } - }, - { - "id": "INACTIVATE-CLIENT-CHAT-ID-IF-PROCESS-RUNNING", - "name": "Inactivate realtor chat id", - "next": "EXIT-PROCESS-RUNNING", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.CHAT_API}}}/rpc/chat/inactivate-by-chat-id" - }, - "verb": "POST", - "headers": { - "Prefer": "return=representation", - "ContentType": "application/json", - "Authorization": { - "$mustache": "Bearer {{{environment.JWT_KEY}}}" - } - } - }, - "valid_response_codes": [ - 201, - 200, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-REALTOR-PROCESS-STARTED", - "name": "Send message notifying request exit", - "next": "START-REQUEST", - "type": "UserTask", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.realtor_chat_id" - }, - "messages": [ - { - "text": { - "$mustache": "Bela: Lead cadastrado com sucesso!" - } - } - ], - "author_id": { - "$ref": "bag.author_id" - }, - "party_number": { - "$ref": "bag.realtor_number" - } - }, - "action": "NOTIFY_PROCESS_STARTED", - "timeout": 1 - } - }, - { - "id": "START-REQUEST", - "name": "Start process to client submit documentation", - "next": "EXIT-PROCESS-STARTED", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "startProcess", - "parameters": { - "input": { - "chat_id": { - "$ref": "bag.chat_id" - }, - "request": { - "$ref": "bag.request" - }, - "party_number": { - "$ref": "bag.party_number" - }, - "realtor_number": { - "$ref": "bag.realtor_number" - } - }, - "actor_data": { - "claims": { - "$ref": "actor_data.claims" - }, - "actor_id": { - "$ref": "bag.actor.id" - }, - "account_id": { - "$ref": "bag.actor.account_id" - }, - "profile_id": { - "$ref": "bag.buyer_profile.id" - }, - "session_id": { - "$ref": "actor_data.session_id" - } - }, - "workflow_name": "requestV3" - } - }, - { - "id": "EXIT-INVALID-PHONE-NUMBER", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-PROCESS-RUNNING", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-REALTOR-UNMATCHED", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-REALTOR-CLIENT-DOC-RECEIVED", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-REALTOR-CLIENT-AWAITING-ANALYSIS", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-REALTOR-CLIENT-SEND-DOCS", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-REALTOR-CLIENT-NO-CONSENT", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-REALTOR-CLIENT-RECOVERY", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-REALTOR-CLIENT-APPROVED", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "EXIT-PROCESS-STARTED", - "name": "Finish getUserInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - } - ], - "prepare": [], - "environment": { - "XPTO": "BOTAUTHOR", - "JWT_KEY": "JWT_KEY_BP", - "CHAT_API": "CHAT_API", - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/test_workflow.json b/samples/blueprints/approva/test_workflow.json deleted file mode 100644 index fce1076c..00000000 --- a/samples/blueprints/approva/test_workflow.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "name": "test_workflow", - "description": "Workflow para rodar testes sobre a aplicação", - "blueprint_spec": { - "lanes": [ - { - "id": "1", - "name": "the_only_lane", - "rule": [ - "fn", - [ - "&", - "args" - ], - true - ] - } - ], - "nodes": [ - { - "id": "1", - "name": "Start node", - "next": "2", - "type": "Start", - "lane_id": "1", - "parameters": { - "input_schema": {} - } - }, - { - "id": "2", - "name": "User Task", - "next": "3", - "type": "UserTask", - "lane_id": "1", - "parameters": { - "input": { - "dates": { - "$ref": "bag.dates" - }, - "uuids": { - "$ref": "bag.uuids" - } - }, - "action": "do something" - } - }, - { - "id": "3", - "name": "Set To Bag Task", - "next": "4", - "type": "SystemTask", - "lane_id": "1", - "category": "SetToBag", - "parameters": { - "input": { - "n_js": { - "$ref": "result.n_js" - }, - "keyword": { - "$ref": "result.keyword" - }, - "n_interp": { - "$ref": "result.n_interp" - } - } - } - }, - { - "id": "4", - "name": "Scripted Task", - "next": "5", - "type": "ScriptTask", - "lane_id": "1", - "parameters": { - "input": { - "n_interp": { - "$ref": "bag.n_interp" - } - }, - "script": { - "type": "js", - "package": "test_workflow_package", - "function": "lisp_test_task" - } - } - }, - { - "id": "5", - "name": "Set To Bag Task", - "next": "6", - "type": "SystemTask", - "lane_id": "1", - "category": "SetToBag", - "parameters": { - "input": { - "dates": { - "$ref": "result.dates" - } - } - } - }, - { - "id": "6", - "name": "JS task node", - "next": "7", - "type": "SystemTask", - "lane_id": "1", - "category": "JsTestTask", - "parameters": { - "input": { - "n_js": { - "$ref": "bag.n_js" - } - } - } - }, - { - "id": "7", - "name": "Set To Bag Task", - "next": "8", - "type": "SystemTask", - "lane_id": "1", - "category": "SetToBag", - "parameters": { - "input": { - "uuids": { - "$ref": "result.uuids" - } - } - } - }, - { - "id": "8", - "name": "Flow node", - "next": { - "end": "9", - "default": "2" - }, - "type": "Flow", - "lane_id": "1", - "parameters": { - "input": { - "keyword": { - "$ref": "bag.keyword" - } - } - } - }, - { - "id": "9", - "name": "Finish node", - "next": null, - "type": "Finish", - "lane_id": "1" - } - ], - "prepare": [], - "environment": {}, - "requirements": [ - "core", - "test_workflow_package" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/unitCRUD.json b/samples/blueprints/approva/unitCRUD.json deleted file mode 100644 index 4b677d04..00000000 --- a/samples/blueprints/approva/unitCRUD.json +++ /dev/null @@ -1,555 +0,0 @@ -{ - "name": "unitCRUD", - "description": "Fluxo para cadastro de unidades", - "blueprint_spec": { - "lanes": [ - { - "id": "GENERAL", - "name": "General access", - "rule": { - "$js": "({actor_data, bag}) => ((actor_data.claims).includes('admin') || (actor_data.claims).includes('list') || (actor_data.claims).includes('overwrite'))" - } - }, - { - "id": "LIST", - "name": "List", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('list')) && actor_data.actor_id == bag.actor_id)" - } - }, - { - "id": "OVERWRITE", - "name": "Overwrite", - "rule": { - "$js": "({actor_data, bag}) => (((actor_data.claims).includes('admin') || (actor_data.claims).includes('overwrite')) && actor_data.actor_id == bag.actor_id)" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start unit CRUD", - "next": "GET-DEV-CONTRACTS", - "type": "Start", - "lane_id": "GENERAL", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "intent", - "key" - ], - "properties": { - "id": { - "type": "string" - }, - "key": { - "type": "string" - }, - "intent": { - "type": "string" - } - } - } - } - }, - { - "id": "GET-DEV-CONTRACTS", - "name": "Get dev contracts", - "next": "SET-DEV-CONTRACTS-TO-BAG", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/dev_contracts?key=eq.{{bag.key}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-DEV-CONTRACTS-TO-BAG", - "name": "Set task settings to bag", - "next": "VALIDATE-INPUT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "SetToBag", - "parameters": { - "input": { - "limit": { - "$js": "({bag}) => bag.limit ? bag.limit : 10" - }, - "filter": { - "$js": "({bag}) => {let filter = ''; if (bag.filters) {const f = bag.filters; Object.entries(f).forEach(([key, value]) => {filter += key + '=eq.' + value + '&';});}; return filter;}" - }, - "offset": { - "$js": "({bag}) => bag.offset ? bag.offset : 0" - }, - "schema": { - "$ref": "result.data[0].value" - }, - "filters": { - "$js": "({bag}) => bag.filters ? bag.filters : {}" - }, - "key_url": { - "$js": "({bag}) => {return (bag.key).substring(5,(bag.key.length))}" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - }, - "pagination": { - "$js": "({bag}) => bag.offset && bag.limit ? bag.offset * bag.limit : 0" - } - } - } - }, - { - "id": "VALIDATE-INPUT", - "name": "Validade input", - "next": "VERIFY-INTENT", - "type": "SystemTask", - "lane_id": "GENERAL", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/units?id=*" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204, - 400, - 404 - ] - } - }, - { - "id": "CHECK-INPUT", - "name": "Check input", - "next": { - "true": "VERIFY-INTENT", - "default": "FINISH-DEV-CONTRACTS" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.status" - } - } - } - }, - { - "id": "VERIFY-INTENT", - "name": "Verify user intent", - "next": { - "default": "GET-COUNT", - "OVERWRITE": "GET-UUID" - }, - "type": "Flow", - "lane_id": "GENERAL", - "parameters": { - "input": { - "key": { - "$ref": "bag.intent" - } - } - } - }, - { - "id": "GET-COUNT", - "name": "Get count", - "next": "SET-COUNT-TO-BAG", - "type": "SystemTask", - "lane_id": "LIST", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/{{bag.key_url}}?select=total_items:count('*')&properties_projects_id=eq.{{bag.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SET-COUNT-TO-BAG", - "name": "Set count to bag", - "next": "GET-UNITS", - "type": "SystemTask", - "lane_id": "LIST", - "category": "SetToBag", - "parameters": { - "input": { - "total_items": { - "$ref": "result.data[0].total_items" - } - } - } - }, - { - "id": "GET-UNITS", - "name": "Get units", - "next": "LIST", - "type": "SystemTask", - "lane_id": "LIST", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/{{bag.key_url}}?properties_projects_id=eq.{{bag.id}}&offset={{bag.pagination}}&limit={{bag.limit}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "LIST", - "name": "Show units to user", - "next": "CHECK-TIMEOUT-LIST", - "type": "UserTask", - "lane_id": "LIST", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - }, - "list": { - "$ref": "result.data" - }, - "limit": { - "$ref": "bag.limit" - }, - "offset": { - "$ref": "bag.offset" - }, - "total_items": { - "$ref": "bag.total_items" - }, - "activity_schema": { - "$ref": "bag.schema.LIST" - } - }, - "action": "LIST", - "timeout": 3600 - } - }, - { - "id": "CHECK-TIMEOUT-LIST", - "name": "Check timeout", - "next": { - "true": "FINISH-LIST", - "default": "SET-OFFSET-LIMIT-TO-BAG" - }, - "type": "Flow", - "lane_id": "LIST", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue" - } - } - } - }, - { - "id": "SET-OFFSET-LIMIT-TO-BAG", - "name": "Set value offset and limit to bag", - "next": "GET-COUNT", - "type": "SystemTask", - "lane_id": "LIST", - "category": "SetToBag", - "parameters": { - "input": { - "limit": { - "$js": "({result}) => result.activities[0]?.data?.limit ? result.activities[0].data.limit : 10" - }, - "filter": { - "$js": "({result}) => {let filter = ''; if (result.activities[0]?.data?.filters) {const f = result.activities[0].data.filters; Object.entries(f).forEach(([key, value]) => {filter += key + '=eq.' + value + '&';});}; return filter;}" - }, - "offset": { - "$js": "({result}) => result.activities[0]?.data?.offset ? result.activities[0].data.offset : 0" - }, - "filters": { - "$js": "({result}) => result.activities[0]?.data?.filters ? result.activities[0].data.filters : {}" - }, - "pagination": { - "$js": "({result}) => result.activities[0]?.data?.limit && result.activities[0]?.data?.offset ? result.activities[0].data.limit * result.activities[0].data.offset : 0" - } - } - } - }, - { - "id": "GET-UUID", - "name": "Get uuid", - "next": "IMPORT-NEW-SHEET", - "type": "SystemTask", - "lane_id": "OVERWRITE", - "category": "CreateIdTask", - "parameters": { - "input": { - "form_data": { - "resource_id": { - "$ref": "bag.id" - }, - "resource_type": { - "$ref": "bag.key_url" - } - } - } - } - }, - { - "id": "IMPORT-NEW-SHEET", - "name": "User send sheet", - "next": "VALIDATE-NEW-SHEEET", - "type": "UserTask", - "lane_id": "OVERWRITE", - "parameters": { - "input": {}, - "action": "IMPORT_NEW_SHEET", - "timeout": 3600 - } - }, - { - "id": "VALIDATE-NEW-SHEEET", - "name": "Validate new sheets", - "next": { - "true": "SET-NEW-SHEET-TO-BAG", - "default": "NOTIFY-REFUSE" - }, - "type": "Flow", - "lane_id": "OVERWRITE", - "parameters": { - "input": { - "key": { - "$js": "({result}) => result.activities[0]?.data?.units?.length > 0 ? true : false" - } - } - } - }, - { - "id": "SET-NEW-SHEET-TO-BAG", - "name": "Set new sheet to bag", - "next": "VALIDATE-SHEET-AND-SHOW-DIFF", - "type": "SystemTask", - "lane_id": "OVERWRITE", - "category": "SetToBag", - "parameters": { - "input": { - "units": { - "$ref": "result.activities[0].data.units" - } - } - } - }, - { - "id": "VALIDATE-SHEET-AND-SHOW-DIFF", - "name": "Verify if sheet is valid", - "next": "SHEET-REVIEW", - "type": "SystemTask", - "lane_id": "OVERWRITE", - "category": "HTTP", - "parameters": { - "input": { - "units": { - "$ref": "bag.units" - }, - "properties_projects_id": { - "$ref": "bag.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/validate/units-list" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SHEET-REVIEW", - "name": "User send sheet", - "next": "CONFIRM-OVERWRITE", - "type": "UserTask", - "lane_id": "OVERWRITE", - "parameters": { - "input": { - "diff": { - "$ref": "result.data" - }, - "activity_schema": { - "$ref": "bag.schema.OVERWRITE" - } - }, - "action": "SHEET_REVIEW", - "timeout": 3600 - } - }, - { - "id": "CONFIRM-OVERWRITE", - "name": "Confirm overwrite", - "next": { - "CONFIRM": "OVERWRITE", - "default": "NOTIFY-REFUSE" - }, - "type": "Flow", - "lane_id": "OVERWRITE", - "parameters": { - "input": { - "key": { - "$js": "({result}) => !!result.is_continue ? 'CANCEL' : result.activities[0].data.action" - } - } - } - }, - { - "id": "NOTIFY-REFUSE", - "name": "Notify review refuse", - "next": "FINISH", - "type": "UserTask", - "lane_id": "OVERWRITE", - "parameters": { - "input": { - "message": "Requisição cancelada!", - "toggleModal": true - }, - "action": "NOTIFY_SHEET_REFUSE", - "timeout": 1 - } - }, - { - "id": "OVERWRITE", - "name": "Overwrite", - "next": "NOTIFY-SUCCESS", - "type": "SystemTask", - "lane_id": "OVERWRITE", - "category": "HTTP", - "parameters": { - "input": { - "units": { - "$ref": "bag.units" - }, - "properties_projects_id": { - "$ref": "bag.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/unit/create-units-from-list" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "NOTIFY-SUCCESS", - "name": "Notify review refuse", - "next": "FINISH", - "type": "UserTask", - "lane_id": "OVERWRITE", - "parameters": { - "input": { - "message": "Sucesso!", - "toggleModal": true - }, - "action": "NOTIFY_SUCCESS", - "timeout": 1 - } - }, - { - "id": "FINISH-REFUSE", - "name": "Finish unitCRUD if review refuse", - "next": null, - "type": "Finish", - "lane_id": "OVERWRITE" - }, - { - "id": "FINISH-LIST", - "name": "Finish unitCRUD", - "next": null, - "type": "Finish", - "lane_id": "LIST" - }, - { - "id": "FINISH", - "name": "Finish unitCRUD", - "next": null, - "type": "Finish", - "lane_id": "OVERWRITE" - }, - { - "id": "FINISH-DEV-CONTRACTS", - "name": "Finish unitCRUD", - "next": null, - "type": "Finish", - "lane_id": "GENERAL" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/updateRequestV3.json b/samples/blueprints/approva/updateRequestV3.json deleted file mode 100644 index 69031f79..00000000 --- a/samples/blueprints/approva/updateRequestV3.json +++ /dev/null @@ -1,201 +0,0 @@ -{ - "name": "updateRequestV3", - "description": "process to update request", - "blueprint_spec": { - "lanes": [ - { - "id": "REQUESTBOT", - "name": "Buyer", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('requestBot');" - } - } - ], - "nodes": [ - { - "id": "START", - "name": "Start updateRequestV3", - "next": "CONFIG", - "type": "Start", - "lane_id": "REQUESTBOT", - "parameters": { - "input_schema": { - "type": "object", - "required": [ - "profile", - "profile_type" - ], - "properties": { - "key": { - "type": "string" - }, - "profile": { - "type": "object" - }, - "request_id": { - "type": "string" - }, - "party_number": { - "type": "string" - }, - "profile_type": { - "type": "string" - } - } - } - } - }, - { - "id": "CONFIG", - "name": "Set basic parameters", - "next": "UPDATE-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "retries": 0, - "BASE_URL": "aprova_services:3000", - "codeRetries": { - "403": 2, - "502": 3 - } - } - } - }, - { - "id": "UPDATE-REQUEST", - "name": "Update Request", - "next": "RESPONSE", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "HTTP", - "parameters": { - "input": { - "status": "AWAITING_DOCUMENTS", - "profiles": { - "$js": "({bag}) => {return{[bag.profile_type]:bag.profile}}" - }, - "request_id": { - "$ref": "bag.request_id" - }, - "current_get_info": { - "key": { - "$ref": "bag.key" - }, - "profile_type": { - "$ref": "bag.profile_type" - } - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/requests/create-request-from-metadata" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - } - } - }, - { - "id": "RESPONSE", - "name": "Verify response code", - "next": { - "200": "END-SUCCESS", - "201": "END-SUCCESS", - "202": "END-SUCCESS", - "204": "END-SUCCESS", - "default": "RETRY" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$ref": "result.status" - } - } - } - }, - { - "id": "RETRY", - "name": "use mock", - "next": { - "default": "RETRY-COUNT", - "undefined": "END-ERROR" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.codeRetries[result.status]" - } - } - } - }, - { - "id": "RETRY-COUNT", - "name": "Verify count", - "next": { - "true": "END-MAX-RETRIES", - "default": "RETRY-INCREASE" - }, - "type": "Flow", - "lane_id": "REQUESTBOT", - "parameters": { - "input": { - "key": { - "$js": "({bag}) => bag.retries >= bag.codeRetries[result.status]" - } - } - } - }, - { - "id": "RETRY-INCREASE", - "name": "increase retry counter", - "next": "UPDATE-REQUEST", - "type": "SystemTask", - "lane_id": "REQUESTBOT", - "category": "SetToBag", - "parameters": { - "input": { - "acquisition_counter": { - "$js": "({bag}) => bag.retries + 1" - } - } - } - }, - { - "id": "END-SUCCESS", - "name": "Finish updateRequestV3", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "END-ERROR", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - }, - { - "id": "END-MAX-RETRIES", - "name": "Finish getInfo", - "next": null, - "type": "Finish", - "lane_id": "REQUESTBOT" - } - ], - "prepare": [], - "environment": { - "SERVICE_API": "SERVICE_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file diff --git a/samples/blueprints/approva/userCRUD.json b/samples/blueprints/approva/userCRUD.json deleted file mode 100644 index f66b42cf..00000000 --- a/samples/blueprints/approva/userCRUD.json +++ /dev/null @@ -1,975 +0,0 @@ -{ - "name": "userCRUD", - "description": "Workflow para CRUD de Usuarios", - "blueprint_spec": { - "lanes": [ - { - "id": "B", - "name": "Backoffice", - "rule": { - "$js": "({actor_data}) => actor_data.claims.includes('adminUsers')" - } - }, - { - "id": "B-LATCHED", - "name": "Backoffice-LATCHED", - "rule": { - "$js": "({actor_data, bag}) => actor_data.claims.includes('adminUsers') && bag.actor_id === actor_data.actor_id" - } - } - ], - "nodes": [ - { - "id": "S", - "name": "Start Workflow", - "next": "ST1", - "type": "Start", - "lane_id": "B", - "parameters": { - "input_schema": {} - } - }, - { - "id": "ST1", - "name": "Get users", - "next": "SB1", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/list/backoffice" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB1", - "name": "Set users to Bag", - "next": "ST2", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "users": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST2", - "name": "Get account settings", - "next": "SB2", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.POSTGREST}}}/accounts" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB2", - "name": "Save default claims to bag", - "next": "ST3", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "account_id": { - "$ref": "result.data[0].id" - }, - "default_claims": { - "$ref": "result.data[0].settings.default_user_claims" - } - } - } - }, - { - "id": "ST3", - "name": "Get claims", - "next": "SB7", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.WORKFLOW_API}}}/claims" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 203, - 204 - ] - } - }, - { - "id": "SB7", - "name": "Set claims to bag", - "next": "U1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "totalClaims": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U1", - "name": "User selects what wanna to do", - "next": "SB3", - "type": "UserTask", - "lane_id": "B", - "parameters": { - "input": { - "users": { - "$ref": "bag.users" - }, - "claims": { - "$ref": "bag.totalClaims" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "action": { - "type": "string" - }, - "mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_USERS_CRUD" - } - }, - { - "id": "SB3", - "name": "Set activity information to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - }, - "name": { - "$ref": "result.activities[0].data.name" - }, - "actor": { - "$ref": "result.activities[0].data.mobile_phone" - }, - "email": { - "$ref": "result.activities[0].data.email" - }, - "action": { - "$ref": "result.activities[0].data.action" - }, - "claims": { - "$ref": "result.activities[0].data.claims" - }, - "option": { - "$ref": "result.activities[0].data.option" - }, - "actor_id": { - "$ref": "actor_data.actor_id" - }, - "password": { - "$ref": "result.activities[0].data.password" - }, - "mobile_phone": { - "$ref": "result.activities[0].data.mobile_phone" - } - } - } - }, - { - "id": "F1", - "name": "Check action", - "next": { - "LIST": "ST1", - "CREATE": "ST8", - "DELETE": "F4", - "UPDATE": "F3", - "DETAILS": "ST11", - "default": "E", - "CHANGE_PASSWORD": "F7", - "UPDATE_NEW_PHONE": "ST9", - "UPDATE_PHONE_PASSWORD": "ST1", - "VERIFICATION_NUMBER_PHONE": "ST1" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.action" - } - } - } - }, - { - "id": "ST8", - "name": "Verification number phone", - "next": "F5", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "email": { - "$ref": "bag.email" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/verify/{{bag.mobile_phone}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "F5", - "name": "Check number phone verification", - "next": { - "true": "F2", - "default": "U2" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST9", - "name": "Verification number phone update realtor", - "next": "F6", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "email": { - "$ref": "bag.email" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/verify/{{bag.mobile_phone}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "F6", - "name": "Check number phone verification update realtor", - "next": { - "true": "F3", - "default": "U2" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "result.data" - } - } - } - }, - { - "id": "U2", - "name": "Open cellular number duplication modal", - "next": "SB4", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "users": { - "$ref": "bag.users" - }, - "toggleModal": true, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "action": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_USERS_VERIFICATION_PHONE" - } - }, - { - "id": "SB4", - "name": "Save action bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "action": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "F2", - "name": "Check payload to create", - "next": { - "return": "ST1", - "default": "ST10" - }, - "type": "Flow", - "lane_id": "B", - "parameters": { - "input": { - "key": { - "$ref": "bag.option" - } - } - } - }, - { - "id": "ST10", - "name": "Create actor on workflow", - "next": "ST5", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.actor" - }, - "claims": { - "$ref": "bag.claims" - }, - "password": { - "$ref": "bag.password" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.WORKFLOW_API}}}/actor" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST5", - "name": "Create profile", - "next": "CREATE-PARTY", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "role": "BACKOFFICE", - "email": { - "$ref": "bag.email" - }, - "actor_id": { - "$ref": "result.data.id" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/create" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CREATE-PARTY", - "name": "Create party on CHAT Service.", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "role": "BACKOFFICE", - "actor": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_chat:3000/rpc/chat/create-party-by-actor" - }, - "verb": "POST", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST11", - "name": "Get user details", - "next": "SB5", - "type": "SystemTask", - "lane_id": "B", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/details/{{bag.id}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "SB5", - "name": "Set user to Bag", - "next": "ST12", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "user": { - "$ref": "result.data" - } - } - } - }, - { - "id": "ST12", - "name": "Get claims user", - "next": "U3", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": {}, - "request": { - "url": { - "$mustache": "{{{environment.WORKFLOW_API}}}/claims/{{bag.user.mobile_phone}}" - }, - "verb": "GET", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "U3", - "name": "User select details", - "next": "SB6", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "user": { - "$ref": "bag.user" - }, - "claims": { - "$ref": "bag.totalClaims" - }, - "claimsUser": { - "$ref": "result.data" - }, - "activity_schema": { - "type": "object", - "required": [ - "action" - ], - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "email": { - "type": "string" - }, - "action": { - "type": "string" - }, - "mobile_phone": { - "type": "string" - } - }, - "additionalProperties": false - } - }, - "action": "USER_CHOOSE_ACTION_USER_DETAIL" - } - }, - { - "id": "SB6", - "name": "Set to bag action", - "next": "F1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "id": { - "$ref": "result.activities[0].data.id" - }, - "name": { - "$ref": "result.activities[0].data.name" - }, - "actor": { - "$ref": "result.activities[0].data.mobile_phone" - }, - "email": { - "$ref": "result.activities[0].data.email" - }, - "action": { - "$ref": "result.activities[0].data.action" - }, - "claims": { - "$ref": "result.activities[0].data.claims" - }, - "password": { - "$ref": "result.activities[0].data.password" - }, - "mobile_phone": { - "$ref": "result.activities[0].data.mobile_phone" - } - } - } - }, - { - "id": "F3", - "name": "Check option to update", - "next": { - "return": "ST1", - "default": "ST6" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.option" - } - } - } - }, - { - "id": "F7", - "name": "Check option to update", - "next": { - "return": "ST1", - "default": "ST14" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.option" - } - } - } - }, - { - "id": "ST14", - "name": "update password", - "next": "ST6", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "ChangePasswordTask", - "parameters": { - "input": { - "actor": { - "$ref": "bag.actor" - }, - "new_password": { - "$ref": "bag.password" - } - } - } - }, - { - "id": "ST6", - "name": "update profile", - "next": "ST13", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "name": { - "$ref": "bag.name" - }, - "email": { - "$ref": "bag.email" - }, - "mobile_phone": { - "$ref": "bag.mobile_phone" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/{{bag.id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST13", - "name": "update actor", - "next": "UPDATE-PARTY", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.actor" - }, - "claims": { - "$ref": "bag.claims" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.WORKFLOW_API}}}/actor/update/{{bag.user.actor_id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "UPDATE-PARTY", - "name": "Update Party on CHAT Service.", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.user.mobile_phone" - }, - "new_actor": { - "$ref": "bag.actor" - } - }, - "request": { - "url": { - "$mustache": "http://aprova_chat:3000/rpc/chat/update-party-by-actor" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "F4", - "name": "Check option to inactivate", - "next": { - "return": "ST1", - "default": "ST7" - }, - "type": "Flow", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "key": { - "$ref": "bag.option" - } - } - } - }, - { - "id": "ST7", - "name": "inactivate profile", - "next": "ST15", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "id": { - "$ref": "bag.id" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.SERVICE_API}}}/rpc/profiles/disable/{{bag.id}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "ST15", - "name": "inactivate actor", - "next": "CONFIRMATION-MESSAGE", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "HTTP", - "parameters": { - "input": { - "actor": { - "$ref": "bag.actor" - } - }, - "request": { - "url": { - "$mustache": "{{{environment.WORKFLOW_API}}}/actor/inactive/{{bag.actor}}" - }, - "verb": "PUT", - "headers": { - "ContentType": "application/json" - } - }, - "valid_response_codes": [ - 200, - 201, - 203, - 204 - ] - } - }, - { - "id": "CONFIRMATION-MESSAGE", - "name": "Request made message", - "next": "SET-ACTION-TO-BAG", - "type": "UserTask", - "lane_id": "B-LATCHED", - "parameters": { - "input": { - "action": { - "$ref": "bag.action" - }, - "confirm_message": true - }, - "action": "CONFIRMATION_MESSAGE_TO_USER_ON_USER_CRUD", - "activity_schema": { - "type": "object", - "properties": { - "action": { - "type": "string" - } - }, - "additionalProperties": false - } - } - }, - { - "id": "SET-ACTION-TO-BAG", - "name": "Set action information to bag", - "next": "F1", - "type": "SystemTask", - "lane_id": "B-LATCHED", - "category": "SetToBag", - "parameters": { - "input": { - "action": { - "$ref": "result.activities[0].data.action" - } - } - } - }, - { - "id": "E", - "name": "Finish", - "next": null, - "type": "Finish", - "lane_id": "B" - } - ], - "prepare": [], - "environment": { - "POSTGREST": "POSTGREST", - "SERVICE_API": "SERVICE_API", - "WORKFLOW_API": "WORKFLOW_API" - }, - "requirements": [ - "core" - ] - } -} \ No newline at end of file