1.3.0 • Published 2 years ago

autozap v1.3.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years 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

2 years ago

1.3.0

2 years ago

1.1.12

2 years ago

1.1.9

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.1

3 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.0

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago