The new crown epidemic broke out in February 2020. The response and maintenance of business data of a large multinational pharmaceutical company increased rapidly with the outbreak of the epidemic. For a time, the response demands of data demanders rose rapidly. Finding a suitable open source solution has become a life-saving straw for now and for a long time to come.
Problems that wechatfordata hopes to solve
- Fragmented data response: The data demanders are all over the country, and the data demand is very fragmented. It is difficult to respond to every demand in time.
- BAU routine operation and maintenance: The data demand is very large, and the data demanders are all over the country. It is difficult to respond to every demand in time.
The Solution
We decided to use Wechaty to build a chatbot that can help us solve these problems. We used Wechaty to build a chatbot that can:
- Collect data demands: The chatbot can collect data demands from data demanders.
- Respond to data demands: The chatbot can respond to data demands in time.
- BAU routine operation and maintenance: The chatbot can help us to do BAU routine operation and maintenance.
The Implementation
We used the following code to implement this solution:
import { Wechaty } from 'wechaty'
const bot = new Wechaty()
bot.on('scan', (qrcode, status) => {
console.log(`Scan QR Code to login: ${status}\nhttps://wechaty.js.org/qrcode/${encodeURIComponent(qrcode)}`)
})
bot.on('login', (user) => {
console.log(`User ${user} logged in`)
})
bot.on('message', async (message) => {
if (message.text() === 'ding') {
await message.say('dong')
}
})
bot.start()
Conclusion
Wechaty is a powerful tool for building WeChat bots. It can be used to solve the problems of fragmented data response and BAU routine operation and maintenance. I believe that in the future, Wechaty will become more and more popular.