Microsoft Bot Framework v4 adapter for Wechat IndividualAccount
- Github: https://github.com/huan/botbuilder-wechaty-adapter
- NPM: https://www.npmjs.com/package/botbuilder-wechaty-adapter

Source: Time to do it differently, build chatbots with streams
If you are finding the Bot Framework v3 version of this adapter, please goto:
- the v3.0 branch, or
- NPM botbuilder-wechaty-connecter@3
FEATURES
- Ready for Microsoft Bot Framework v4
- no need a registered bot on dev.botframework.com, but require a wechat individual(NOT official!) account.
- Powered by wechaty
- Support receiving and sending almost any wechat message types(WIP)
INSTALLATION
npm install botbuilder-wechaty-adapter
Preparation
We assume that, you already have a wechat individual account.
EXAMPLE
An example is located at examples/ directory. Using following command to run it.
git clone git@github.com:huan/botbuilder-wechaty-adapter.git
cd botbuilder-wechaty-adapter
npm install
npm run example
import {
ActivityTypes,
TurnContext,
} from 'botbuilder'
import { WechatyAdapter } from 'botbuilder-wechaty-adapter'
export class EchoBot {
public async onTurn (
turnContext: TurnContext,
): Promise<void> {
console.info('EchoBot', 'onTurn() %s', turnContext)
if (turnContext.activity.type === ActivityTypes.Message) {
const text = turnContext.activity.text
console.info('RECV:', text)
switch (text.toLowerCase()) {
case 'quit':
console.info('Quiting...')
process.exit(0)
break
case 'ding':
console.info('Replying `dong`...')
await turnContext.sendActivity('dong')
console.info('Replied.')
break
default:
console.info('EchoBot', 'onTurn() skip message "%s"', text)
}
}
}
}
const echoBot = new EchoBot()
const adapter = new WechatyAdapter()
adapter.listen(async (turnContext: TurnContext) => {
await echoBot.onTurn(turnContext)
}).catch(console.error)
console.info('> Wechaty EchoBot is online. I will reply `dong` if you send me `ding`!')
console.info('> Say "quit" to end.\n')
Slides
<iframe src="https://docs.google.com/presentation/d/e/2PACX-1vQuR4VQbUXdS4rsVjTs7FDNwWbhRb1voaXBzMBsza62ukwwbppCN1D5DdxMym5PpcCG2lmub6-EQ0KX/embed?start=false&loop=false&delayms=3000" width="1306" height="763" allowfullscreen="" webkitallowfullscreen="true" mozallowfullscreen="true" frameborder="0" style="box-sizing: border-box; position: absolute; top: 0px; left: 0px; width: 636px; height: 387.75px;"></iframe>
Connect to Wechat: Bot Builder Adapter for Wechat Individual Account