🤖
Wire bot API is currently in alpha.
Run manage.sh
from a terminal and reister as Wire Service Provider
Register as Wire Service Provider:
https://
)Create a new service with new-service
command
https://[Your_Public_IP]:8050
)./hello-bot/certs/pubkey.pem
) $ADD?Enable your service with update-service-conn
command
git clone https://github.com/wireapp/bot-sdk-node/
npm install bot-sdk-node
Create service key and certificate:
openssl genrsa -out server.key 4096
openssl req -new -key server.key -out csr.pem
openssl x509 -req -days 7300 -in csr.pem -signkey server.key -out server.crt
openssl rsa -in server.key -pubout -out pubkey.pem
Then proceed to create your first bot (take a look at example/echo_text_bot.js):
const service = require('wire-bot-sdk-node');
service.createService(options, (bot) => {
// add listeners
});
The options
argument has the following options:
The function that is passed to createService
is called when the service is created and is given a bot instance. Bot object is an EventEmitter
and emits the following listeners:
bot.on('message', (from, message) => {}); // message from user
bot.on('join', (members, conversation) => {}); // new user(s) joined the conversation
bot.on('leave', (members, conversation) => {}); // user(s) that left the conversation
bot.on('rename', (name, conversation) => {}); // conversation renamed
Use sendMessage
to send message back to user
bot.sendMessage(message, (sendStatus) => {});