oex2003/evolution-api
0
1/* eslint-disable @typescript-eslint/no-namespace */2import { JsonValue } from '@prisma/client/runtime/library';3import { AuthenticationState, WAConnectionState } from 'baileys';4 5export enum Events {6 APPLICATION_STARTUP = 'application.startup',7 INSTANCE_CREATE = 'instance.create',8 INSTANCE_DELETE = 'instance.delete',9 QRCODE_UPDATED = 'qrcode.updated',10 CONNECTION_UPDATE = 'connection.update',11 STATUS_INSTANCE = 'status.instance',12 MESSAGES_SET = 'messages.set',13 MESSAGES_UPSERT = 'messages.upsert',14 MESSAGES_EDITED = 'messages.edited',15 MESSAGES_UPDATE = 'messages.update',16 MESSAGES_DELETE = 'messages.delete',17 SEND_MESSAGE = 'send.message',18 SEND_MESSAGE_UPDATE = 'send.message.update',19 CONTACTS_SET = 'contacts.set',20 CONTACTS_UPSERT = 'contacts.upsert',21 CONTACTS_UPDATE = 'contacts.update',22 PRESENCE_UPDATE = 'presence.update',23 CHATS_SET = 'chats.set',24 CHATS_UPDATE = 'chats.update',25 CHATS_UPSERT = 'chats.upsert',26 CHATS_DELETE = 'chats.delete',27 GROUPS_UPSERT = 'groups.upsert',28 GROUPS_UPDATE = 'groups.update',29 GROUP_PARTICIPANTS_UPDATE = 'group-participants.update',30 CALL = 'call',31 TYPEBOT_START = 'typebot.start',32 TYPEBOT_CHANGE_STATUS = 'typebot.change-status',33 LABELS_EDIT = 'labels.edit',34 LABELS_ASSOCIATION = 'labels.association',35 CREDS_UPDATE = 'creds.update',36 MESSAGING_HISTORY_SET = 'messaging-history.set',37 REMOVE_INSTANCE = 'remove.instance',38 LOGOUT_INSTANCE = 'logout.instance',39}40 41export declare namespace wa {42 export type QrCode = {43 count?: number;44 pairingCode?: string;45 base64?: string;46 code?: string;47 };48 49 export type Instance = {50 id?: string;51 qrcode?: QrCode;52 pairingCode?: string;53 authState?: { state: AuthenticationState; saveCreds: () => void };54 name?: string;55 wuid?: string;56 profileName?: string;57 profilePictureUrl?: string;58 token?: string;59 number?: string;60 integration?: string;61 businessId?: string;62 };63 64 export type LocalChatwoot = {65 enabled?: boolean;66 accountId?: string;67 token?: string;68 url?: string;69 nameInbox?: string;70 signMsg?: boolean;71 signDelimiter?: string;72 number?: string;73 reopenConversation?: boolean;74 conversationPending?: boolean;75 mergeBrazilContacts?: boolean;76 importContacts?: boolean;77 importMessages?: boolean;78 daysLimitImportMessages?: number;79 };80 81 export type LocalSettings = {82 rejectCall?: boolean;83 msgCall?: string;84 groupsIgnore?: boolean;85 alwaysOnline?: boolean;86 readMessages?: boolean;87 readStatus?: boolean;88 syncFullHistory?: boolean;89 wavoipToken?: string;90 };91 92 export type LocalEvent = {93 enabled?: boolean;94 events?: JsonValue;95 };96 97 export type LocalWebHook = LocalEvent & {98 url?: string;99 headers?: JsonValue;100 webhookByEvents?: boolean;101 webhookBase64?: boolean;102 };103 104 export type LocalPusher = LocalEvent & {105 appId?: string;106 key?: string;107 secret?: string;108 cluster?: string;109 useTLS?: boolean;110 };111 112 type Session = {113 remoteJid?: string;114 sessionId?: string;115 createdAt?: number;116 };117 118 export type LocalProxy = {119 enabled?: boolean;120 host?: string;121 port?: string;122 protocol?: string;123 username?: string;124 password?: string;125 };126 127 export type StateConnection = {128 instance?: string;129 state?: WAConnectionState | 'refused';130 statusReason?: number;131 };132 133 export type StatusMessage = 'ERROR' | 'PENDING' | 'SERVER_ACK' | 'DELIVERY_ACK' | 'READ' | 'DELETED' | 'PLAYED';134}135 136export const TypeMediaMessage = [137 'imageMessage',138 'documentMessage',139 'audioMessage',140 'videoMessage',141 'stickerMessage',142 'ptvMessage',143];144 145export const MessageSubtype = [146 'ephemeralMessage',147 'documentWithCaptionMessage',148 'viewOnceMessage',149 'viewOnceMessageV2',150];151 152export const Integration = {153 WHATSAPP_BUSINESS: 'WHATSAPP-BUSINESS',154 WHATSAPP_BAILEYS: 'WHATSAPP-BAILEYS',155 EVOLUTION: 'EVOLUTION',156};157 