1.3.0 • Published 1 year ago

autozap v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Autozap

Single session

import { createInstance, sendMessage, getChats } from 'autozap'

async function main() {
  const instance = await createInstance({
    id: 'zap',
    // more configs...
  })

  const chats = await getChats(instance, {
    onlyMyContact: true,
    // more params...
  })

  const chatId = '...'
  const response = await sendMessage(instance, chatId, {
    text: 'bla bla bla...',
    simulateTyping: true,
    // more params...
  })
}

main()
  .then(() => process.exit(0))
  .catch((err) => console.error(err))

Multiple sessions

import {
  createInstance,
  sendMessage,
  getChats,
  onMessage,
  WhatsApp,
} from 'autozap'

const makeInstance = (id) =>
  createInstance({
    id,
    // more configs...
  })

async function main() {
  const instances: Record<string, WhatsApp> = {
    zap1: await makeInstance('zap1'),
    zap2: await makeInstance('zap2'),
  }

  const chatId = '...'
  const response = await sendMessage(instances.zap1, chatId, {
    text: 'bla bla bla...',
    simulateTyping: true,
    // more params...
  })

  const chats = await getChats(instances.zap2, {
    onlyMyContact: true,
    // more params...
  })

  onMessage(instances.zap1, (chat, message) => {
    console.log(message)
  })
}

main()
  .then(() => process.exit(0))
  .catch((err) => console.error(err))
1.2.0

1 year ago

1.3.0

1 year ago

1.1.12

1 year ago

1.1.9

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.11

1 year ago

1.1.10

1 year ago

1.1.1

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago