A bot that can send email by taking in webex message chat input.
This email bot is built on Webex-Bot-Starter (https://github.com/WebexSamples/webex-bot-starter). Added one more "send-email" command and you can add this function in to start sending email. If you dont have a webex bot yet, refer to the Webex-Bot-Starter instruction. Use the chat function here to add email feature.
Release update
Pre-requisite:-
You only need "email-function-only.txt", the other file "index.js" is for your reference
Here are the steps to prepare and run the script:-
git clone https://github.com/ciscoketcheon/Webex-Email-Bot.git
Configuration - Edit your existing "index.js" file
One more modification needed is to update the x.x.x.x in the "send-email" function with your relay server IP address
...const command = `swaks --server x.x.x.x --from "${sender}...
Example update, say relay server IP address is 192.168.25.25. Relay server configuration server is beyond this guide.
...const command = `swaks --server 192.168.25.25 --from "${sender}...
npm start
If you have never installed a Webex bot before, suggest to follow this full guide -> https://developer.webex.com/blog/from-zero-to-webex-teams-chatbot-in-15-minutes
In summary, here are the steps from scratch:-
git clone https://github.com/WebexSamples/webex-bot-starter.git && cd webex-bot-starter
ngrok http 7001 --region=eu
Optional -- Do explore using a separate screen or terminal for ngrok and npm, try run "screen" from linux to spawn a new one, or do a "screen -r" to show the running screens, and do a "screen -r XXXX" to restore a screen (XXXX is the screen number). If you want to leave current screen session and jump back to main session, do a Ctrl+A+D key combination.
Copy ".env.local" to a new file ".env", update the ".env" file with ngrok webhook URL (from #3) and webex bot auth-token (from #1)
In another folder, clone this repo
git clone https://github.com/ciscoketcheon/Webex-Email-Bot.git
...const command = `swaks --server x.x.x.x --from "${sender}...
Example update, say relay server IP address is 192.168.25.25. Relay server configuration server is beyond this guide.
...const command = `swaks --server 192.168.25.25 --from "${sender}...
npm start
Look for your bot from webex teams, start by sending the bot anything, it shall response with suggested usage, example:-
Usage: • framework: (learn more about the Webex Bot Framework) • info: (get your personal details) • space: (get details about this space) • say hi to everyone: (everyone gets a greeting using a call to the Webex SDK) • card me: (a cool card!) • reply: (have bot reply to your message) • help: (what you are reading now) • send-email: (send-email|Sender email address|Recipient email address|Subject Here|Email body text here) Powered by Webex Node Bot Framework - https://github.com/webex/webex-node-bot-framework
Try to send a email following the syntax, example:-
send-email sender@test.com|recipient@domain.com|any subject|any email body content
You will receive response from the bot if the email sent successfully.
Webex bot -> https://developer.webex.com/blog/from-zero-to-webex-teams-chatbot-in-15-minutes
Webex bot github -> https://github.com/WebexSamples/webex-bot-starter
Owner
Contributors
Categories
Products
WebexEnterprise Chat & EmailProgramming Languages
JavaScriptLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community