# API's Webhook As API's de Webhook são usadas para integrar os sistemas de clientes ao Neppo Omnichannel. ## Informações sobre os Eventos Ao cadastrar o webhook, nosso sistema irá fazer uma chamada POST com os seguintes dados baseados no tipo de webhook cadastrado. ``` { "component": "exampleComponent", "content": "{}", "entity": "exampleEntity", "action": "exampleAction", "logLevel": "INFO", "timestamp": 1693081600000, "tenant": "exampleTenant", "error": "exampleError" } ``` Sendo: |Operador |Descrição| |--------|--------------------| |component |Tipo do evento (MESSAGE, STATUS, VOICE, SESSION, BOT, ENTITY ou CHAT_API) | |content |Conteudo do evento em json escapado | |entity |Entidade do modelo caso evento for de criação/atualização de entidades | |action |Ação que gerou o evento para caso de criação/atualização de entidades | |logLevel |Nível do evento podendo ser INFO ou ERROR | |timestamp |Data que o evento aconteceu | |tenant |Identificador do cliente | |error |Descrição do erro caso houver | ## Tipos de evento ### MESSAGE - mensagens trocadas pelo sistema Exemplo de payload: ``` { "component": "MESSAGE", "content": "{ "message": "olá", "fromUser": "botcomercial", "fromUserResource": "9431120a", "toUserResource": "203cbd4f", "command": "REDIRECT_TO_QUEUE", "group": "Telegram", "sessionId": 70021, "sessionOn": true, "createdAt": 1724673241210 }", "entity": null, "action": null, "logLevel": "INFO", "timestamp": 1724673241210, "tenant": "comercial", "error": "" } ``` ### STATUS - informações sobre agentes(login, loggout, pausa) Exemplo de payload: ``` { "component": "STATUS", "content": "{ "id": 102825, "agent": { "id": 167, "maxChatChannels": 5, "status": "ONLINE", "loginAttendance": "", "extensionAttendance": "230", "paused": false }, "status": "ONLINE", "maxChatChannels": 5, "createdAt": 1724673132437, "descriptionOfChange": "LOGIN", "user": { "id": 9256, "userName": "fernanda_agente", "displayName": "Fernanda Leal", "email": "fernanda.leal@demo.com.br", "firstAccess": false, "typeUser": "AGENT", "birthDate": 1675652400000, "phone": "5534991506555", "country": "br", "active": true, "visible": true, "formal": true, "priority": 2, "defaultLocale": "pt-Br", "botActive": false, "botSurvey": false, "botExternal": false, "connectTimeStamp": 1724673132440, "loginAgentTimeStamp": 0, "user": false } }", "entity": null, "action": null, "logLevel": "INFO", "timestamp": 1724673132440, "tenant": "comercial", "error": "" } ``` ### SESSION - informação sobre as sessões(criação, redirecionamentos, fechamento..) Exemplo de payload: ``` { "component": "SESSION", "content": "{ "id": 70017, "protocol": "WA00000070017", "user": { "updatedBy": "comercial_ploomes", "updatedAt": 1723659001000, "createdAt": 1520451837000, "id": 61, "userName": "whatsapp_5534999610600", "name": "rafael@neppo.com.br", "displayName": "rafael@neppo.com.br", "cpf": "", "email": "rafael@neppo.com.br", "firstAccess": false, "typeUser": "USER", "originUser": "WHATSAPP", "birthDate": 1536202800000, "phone": "5534999610600", "country": "br", "active": true, "visible": true, "formal": true, "priority": 0, "externalCode": "414981529", "defaultLocale": "pt-Br", "tm2": false, "usingMFA": false, "createdFromSurvey": false, "botActive": false, "botSurvey": false, "botExternal": false, "connectTimeStamp": 1724629477179, "loginAgentTimeStamp": 0, "user": true }, "status": "CLOSED", "groupConf": { "updatedBy": "Adm_ploomes", "updatedAt": 1721136924000, "createdBy": "paulaadm", "createdAt": 1681397640000, "id": 103, "name": "Comercial Oficial Novo", "offlineAttendance": true, "defaultAgent": { "createdBy": "SYSTEM", "createdAt": 1713524720000, "id": 15329, "userName": "Apresentação Teste Neppo@botserver", "displayName": "Apresentação Teste Neppo@botserver", "typeUser": "BOT", "active": true, "visible": true, "botActive": false, "botSurvey": false, "botExternal": false, "connectTimeStamp": 1724629477176, "loginAgentTimeStamp": 0, "user": false }, "survey": 1, "finalAgent": { "updatedBy": "alisson_sadmin", "updatedAt": 1723578482000, "createdAt": 1557757791000, "id": 3574, "userName": "Pesquisa_Comercial", "name": "Pesquisa Comercial", "displayName": "Pesquisa_Comercial", "firstAccess": false, "typeUser": "BOT", "active": true, "visible": true, "defaultLocale": "pt-Br", "tm2": false, "usingMFA": false, "createdFromSurvey": true, "botActive": false, "botSurvey": false, "botExternal": false, "connectTimeStamp": 1724629477177, "loginAgentTimeStamp": 0, "user": false }, "mandatoryFinalAgent": true, "classificationTree": { "createdAt": 1558550630000, "id": 25, "value": "ÁREA DE VENDAS", "active": true, "children": [] }, "channels": [ { "id": 1, "name": "WHATSAPP", "createdAt": 1703031948000 }, { "id": 5, "name": "FACEBOOK", "createdAt": 1703031948000 } ], "mandatoryClassificationTree": true, "active": true, "visible": true, "smsActiveShipping": false, "whatsappActiveShipping": true, "telegramActiveShipping": false, "emailActiveShipping": false, "voiceActiveShipping": false, "uraActiveShipping": false, "wavy": true, "whatsappPartner": true, "whatsappPartnerInactivity": 60, "inngageShipping": false, "scheduleName": "Horario", "operation": { "updatedBy": "ana_sadmin", "updatedAt": 1705065166000, "createdBy": "ADMIN", "createdAt": 1507559184000, "id": 2, "company": { "id": 11, "companyName": "Neppo Tecnologia da Informação Ltda", "tradeName": "Neppo TI", "sku": "11NEPPOTI69COMERCIALTM2", "address": "Avenida Afonso Pena", "number": "1969", "complement": "Sala 201", "neighborhood": "Aparecida", "cep": "38400708", "city": "Uberlândia", "state": "MG", "country": "br", "cnpj": "10884449000113", "stateRegistration": "000000000", "phoneContact": "553432274551", "nameContact": "Leonardo Marques", "site": "www.neppo.com.br", "email": "leonardo@neppo.com.br", "active": true, "timeHistory": 5, "contractSignature": 1, "groupCompany": { "id": 1, "groupCompany": "NEPPO", "active": true }, "defaultLocale": "pt-Br" }, "operationName": "NEPPO", "operationStatus": true, "verifyHoliday": true, "country": "br", "defaultLocale": "pt-Br", "customerPortfolio": true }, "limitTimeWaitingForInteract": 86400, "queueScheduleStrategy": false, "skipQueue": false, "timeMaxAttendance": 30, "sla": 3, "agentExpireSession": false, "redirectAttendanceAgentDisconnect": true, "queueControl": "random", "agentReplyMaxDelay": 60000, "businessUnit": "tm2digital_comercial", "acceptedMedias": "IMAGE,AUDIO,VIDEO,APPLICATION", "configInactivity": false, "messageSentBy": "COMPANY", "pausedTransfer": false, "gatewayQueue": "MULTITENANT_360_CLOUD", "scheduleActiveSendTime": 0, "onlyBot": false, "broker": "360_DIALOG", "priorityEmailSignature": false, "groups": [] }, "createdAt": 1724543135674, "closedAt": 1724629477171, "updatedAt": 1724629477171, "updatedBy": "Apresentação Teste Neppo@botserver", "closedBy": "AUDITOR", "userConnectedInstance": "neppochat-instance-7d90fa71", "userConnectedResource": "00y7puzd", "externalProtocol": "553499610600", "inactivity": "USER_WHATSAPP_INACTIVITY", "lastAgent": "queue", "pending": false, "priority": false, "onlyBot": true, "tme": 86041, "tma": 86341, "tmo": 86341, "groupList": "103-Comercial Oficial Novo", "properties": "{\"timeMaxAttendance\":30, \"sla\":3}" }", "entity": null, "action": null, "logLevel": "INFO", "timestamp": 1724629477183, "tenant": "comercial", "error": "" } ``` ### VOICE - informações sobre chamadas de voz Exemplo de payload: ``` { "component": "VOICE", "content": "{ "startEvent": false, "callerId": "whatsapp-transfere", "callId": "7b7217b9-437b-45bf-8800-a67187daf69a", "groupName": "VOIP", "createdAt": 1724509290310, "userPhone": "5534991792524", "eventType": "HANGUP", "ivrTime": 0, "waitingTime": 0, "attendanceTime": 0, "finishedAt": 1724509317030, "origCallId": "8rhkqskqi8xe7xgrrps8kxi8j0e7sssg@UAC", "startedByAgent": false, "finishedByAgent": true, "audioPath": "https://comercial-pbx.neppo.com.br/archive/2024/08/24/7b7217b9-437b-45bf-8800-a67187daf69a.wav", "callerType": "inbound", "finalHangup": true, "origin": "34991792524", "pendingHangup": false }", "entity": null, "action": null, "logLevel": "INFO", "timestamp": 1724509317059, "tenant": "comercial", "error": "" } ``` ### BOT - informações vindas dos bots(troca de mensagem, chamadas de api...) Exemplo de payload: ``` { "component": "BOT", "content": "{ "message": "#TO_QUEUE", "fromUserResource": "9431120a", "toUserResource": "203cbd4f", "command": "REDIRECT_TO_QUEUE", "sessionId": 70021, "sessionOn": true, "createdAt": 1724673241210 }", "entity": null, "action": null, "logLevel": "INFO", "timestamp": 1724673241210, "tenant": "comercial", "error": "" } ``` ### CHAT_API - eventos customizados vindos da chat api Exemplo de payload: ``` { "component": "CHAT_API", "content": "{ "customEvent": "test" }", "entity": "null", "action": "null", "logLevel": "INFO", "timestamp": 1693081600000, "tenant": "comercial", "error": "" } ``` ### ENTITY - informação sobre criação/atualização de entidades no sistema Exemplo de payload: ``` { "component": "ENTITY", "content": "{ "id": 70017, "protocol": "WA00000070017", "user": { "updatedBy": "comercial_ploomes", "updatedAt": 1723659001000, "createdAt": 1520451837000, "id": 61, "userName": "whatsapp_5534999610600", "name": "rafael@neppo.com.br", "displayName": "rafael@neppo.com.br", "cpf": "", "email": "rafael@neppo.com.br", "firstAccess": false, "typeUser": "USER", "originUser": "WHATSAPP", "birthDate": 1536202800000, "phone": "5534999610600", "country": "br", "active": true, "visible": true, "formal": true, "priority": 0, "externalCode": "414981529", "defaultLocale": "pt-Br", "tm2": false, "usingMFA": false, "createdFromSurvey": false, "botActive": false, "botSurvey": false, "botExternal": false, "connectTimeStamp": 1724629477179, "loginAgentTimeStamp": 0, "user": true }, "status": "CLOSED", "groupConf": { "updatedBy": "Adm_ploomes", "updatedAt": 1721136924000, "createdBy": "paulaadm", "createdAt": 1681397640000, "id": 103, "name": "Comercial Oficial Novo", "offlineAttendance": true, "defaultAgent": { "createdBy": "SYSTEM", "createdAt": 1713524720000, "id": 15329, "userName": "Apresentação Teste Neppo@botserver", "displayName": "Apresentação Teste Neppo@botserver", "typeUser": "BOT", "active": true, "visible": true, "botActive": false, "botSurvey": false, "botExternal": false, "connectTimeStamp": 1724629477176, "loginAgentTimeStamp": 0, "user": false }, "survey": 1, "finalAgent": { "updatedBy": "alisson_sadmin", "updatedAt": 1723578482000, "createdAt": 1557757791000, "id": 3574, "userName": "Pesquisa_Comercial", "name": "Pesquisa Comercial", "displayName": "Pesquisa_Comercial", "firstAccess": false, "typeUser": "BOT", "active": true, "visible": true, "defaultLocale": "pt-Br", "tm2": false, "usingMFA": false, "createdFromSurvey": true, "botActive": false, "botSurvey": false, "botExternal": false, "connectTimeStamp": 1724629477177, "loginAgentTimeStamp": 0, "user": false }, "mandatoryFinalAgent": true, "classificationTree": { "createdAt": 1558550630000, "id": 25, "value": "ÁREA DE VENDAS", "active": true, "children": [] }, "channels": [ { "id": 1, "name": "WHATSAPP", "createdAt": 1703031948000 }, { "id": 5, "name": "FACEBOOK", "createdAt": 1703031948000 } ], "mandatoryClassificationTree": true, "active": true, "visible": true, "smsActiveShipping": false, "whatsappActiveShipping": true, "telegramActiveShipping": false, "emailActiveShipping": false, "voiceActiveShipping": false, "uraActiveShipping": false, "wavy": true, "whatsappPartner": true, "whatsappPartnerInactivity": 60, "inngageShipping": false, "scheduleName": "Horario", "operation": { "updatedBy": "ana_sadmin", "updatedAt": 1705065166000, "createdBy": "ADMIN", "createdAt": 1507559184000, "id": 2, "company": { "id": 11, "companyName": "Neppo Tecnologia da Informação Ltda", "tradeName": "Neppo TI", "sku": "11NEPPOTI69COMERCIALTM2", "address": "Avenida Afonso Pena", "number": "1969", "complement": "Sala 201", "neighborhood": "Aparecida", "cep": "38400708", "city": "Uberlândia", "state": "MG", "country": "br", "cnpj": "10884449000113", "stateRegistration": "000000000", "phoneContact": "553432274551", "nameContact": "Leonardo Marques", "site": "www.neppo.com.br", "email": "leonardo@neppo.com.br", "active": true, "timeHistory": 5, "contractSignature": 1, "groupCompany": { "id": 1, "groupCompany": "NEPPO", "active": true }, "defaultLocale": "pt-Br" }, "operationName": "NEPPO", "operationStatus": true, "verifyHoliday": true, "country": "br", "defaultLocale": "pt-Br", "customerPortfolio": true }, "limitTimeWaitingForInteract": 86400, "queueScheduleStrategy": false, "skipQueue": false, "timeMaxAttendance": 30, "sla": 3, "agentExpireSession": false, "redirectAttendanceAgentDisconnect": true, "queueControl": "random", "agentReplyMaxDelay": 60000, "businessUnit": "tm2digital_comercial", "acceptedMedias": "IMAGE,AUDIO,VIDEO,APPLICATION", "configInactivity": false, "messageSentBy": "COMPANY", "pausedTransfer": false, "gatewayQueue": "MULTITENANT_360_CLOUD", "scheduleActiveSendTime": 0, "onlyBot": false, "broker": "360_DIALOG", "priorityEmailSignature": false, "groups": [] }, "createdAt": 1724543135674, "closedAt": 1724629477171, "updatedAt": 1724629477171, "updatedBy": "Apresentação Teste Neppo@botserver", "closedBy": "AUDITOR", "userConnectedInstance": "neppochat-instance-7d90fa71", "userConnectedResource": "00y7puzd", "externalProtocol": "553499610600", "inactivity": "USER_WHATSAPP_INACTIVITY", "lastAgent": "queue", "pending": false, "priority": false, "onlyBot": true, "tme": 86041, "tma": 86341, "tmo": 86341, "groupList": "103-Comercial Oficial Novo", "properties": "{\"timeMaxAttendance\":30, \"sla\":3}" }", "entity": "ChatSession", "action": "CREATE", "logLevel": "INFO", "timestamp": 1724629477183, "tenant": "comercial", "error": "" } ``` Quais entidades quer receber eventos: Entidades do sistema: [ "Agent", "AgentHist", "AgentHistStatus", "AgentInfo", "AgentInfoAgent", "AgentInfoGroup", "AgentMetadata", "AgentReplyDelay", "Answer", "AppleComponent", "AssociationClientsToAgents", "Attributes", "Bot", "BotNode", "BotProtocol", "BotTree", "BroadcastList", "Campaign", "CampaignDefaultContent", "CampaignDispatch", "CampaignDispatchComponent", "CampaignDispatchContent", "CampaignDispatchParam", "CampaignTemplate", "ChatAccess", "ChatApiCredential", "ChatCallLog", "ChatCallLogHist", "ChatChannel", "ChatConfiguration", "ChatCountry", "ChatDirectMessage", "ChatEmailConfig", "ChatEmailCopy", "ChatError", "ChatExternAgent", "ChatGroupChannel", "ChatGroupCompany", "ChatJob", "ChatLastDirectMessage", "ChatLog", "ChatLogEntity", "ChatMessage", "ChatMessageDeleted", "ChatProfile", "ChatReporterDef", "ChatRule", "ChatSelfService", "ChatSelfServiceTelegram", "ChatSession", "ChatSessionComment", "ChatSessionHist", "ChatSessionTag", "ChatSessionTimePending", "ChatSessionTme", "ChatSettings", "ChatTag", "ChatUserGroupConf", "ChatUserTag", "ChatWAMetadata", "ChatWavy", "ChatWebConf", "ClassificationServices", "ClassificationTree", "Cognition", "Company", "Email", "EmailTemplate", "ExclusionRequest", "FacebookPageToken", "Greetings", "GroupConf", "GroupSLAInfo", "Holiday", "HolidayOperation", "HsmTemplate", "HsmTemplateParam", "InternalChat", "InternalChatMessage", "InternalChatParticipant", "Manual", "MessageBundle", "MessageBundlePatterns", "Mnemonic", "MnemonicGroup", "NoAccess", "Operation", "PasswordResetToken", "PauseReason", "PhotoUser", "ProfileRule", "ProfileWorkSchedule", "Question", "QuestionAnswer", "QuestionSurvey", "Report", "ReporterDefinition", "ReservedWord", "RestrictedWord", "Survey", "SurveyAnswer", "SurveyType", "TableMetadata", "Task", "TaskTemplateParameter", "UseReservedWords", "UseRestrictedWords", "User", "UserAttributes", "UserAttributesHist", "UserGroup", "UserHist", "UserLogStatus", "UserOperation", "UserPasswordHist", "UserWorkSchedule", "UsersToTasks", "WhatsAppPhone", "WhatsAppSession", "WhatsAppSessionProtocol", "WorkSchedule" ] ## Operations - [Exemplo de chamada do Bot usando parâmetros](https://api-docs.neppo.com.br/operation/operation-exemplodechamadadobotusandoparametros.md) [Powered by Bump.sh](https://bump.sh)