
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Janis helps teams train and monitor bots and fix problems fast. Build a bot in Ruby and integrate Janis with just a few lines of code to ensure delightful conversational experiences in every messaging channel.
Collaborate on what users say and your responses in a dedicated training channel. Experience exactly what your users will experience when they message you.
Janis alerts you in Slack when your bot needs your help. Use our smart alerts, or create your own alerts to bring humans in the loop.
Take over for your bot and chat live to retain your users, while training your AI to learn from the conversation. Hand control back to your bot when you're done.
To learn more about Janis' capabilities, visit Janis.ai
Note: This module has been tested with Messenger, Slack, Skype, and Microsoft Webchat. Please see our examples.
$ gem install janis
Set your environmental variables for JANIS_API_KEY
, JANIS_CLIENT_KEY
, ACCESS_TOKEN
.
$ export JANIS_API_KEY=xxxxxxxxxxxxxxxxxxxx
$ export JANIS_CLIENT_KEY=xxxxxxxxxxxxxxxxxxxx
$ export ACCESS_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Add the janis class to your code and set the required parameter values.
require 'janis'
# janis Api Key
janis.apikey = ENV['JANIS_API_KEY']
# Unique janis Client Key for your bot
janis.clientkey = ENV['JANIS_CLIENT_KEY']
# possible values: "messenger" or "slack"
janis.platform = "messenger"
# Page Access Token (only required for Messenger bots)
janis.token = ENV['ACCESS_TOKEN']
Throughout this documentation, you will see references to incomingMessage
. Depending on whether you have a Messenger or Slack bot, the schema will be different. The value of incomingMessage
should be equal to the message you receive directly from either the Messenger webhook response, or from the Slack RTM event response.
# Example of a Slack Incoming Message
{
"type": "message",
"channel": "D024BE91L",
"user": "U2147483697",
"text": "Hello world",
"ts": "1355517523.000005"
}
# Example of a Messenger Incoming Message
{
"sender":{
"id":"USER_ID"
},
"recipient":{
"id":"PAGE_ID"
},
"timestamp":1458692752478,
"message":{
"mid":"mid.1457764197618:41d102a3e1ae206a38",
"seq":73,
"text":"hello, world!",
"quick_reply": {
"payload": "DEVELOPER_DEFINED_PAYLOAD"
}
}
}
Throughout this documentation, you will see references to outgoingMessage
. Depending on whether you have a Messenger or Slack bot, the schema, as defined by each platform, will be different. Every time you track an outgoing message, the schema requirements match the respective platform.
# Example of Slack Outgoing Message
{
"channel": "C024BE91L",
"text": "Hello world"
}
# Exmaple of Messenger Outgoing Message
{
"recipient":{
"id":"USER_ID"
},
"message":{
"text":"hello, world!"
}
}
When your bot receives an incoming message, you'll need to log the data with janis by calling to janis.hopIn
.
Note: janis can pause your bot so that it doesn't auto response while a human has taken over. The server response from your hopIn
request will pass the paused
state. Use that to stop your bot from responding to an incoming message. Here is an example:
hopInResponse = janis.hopIn(incomingMessage)
if hopInResponse['paused'] != true
# proceed to process incoming message
...
Each time your bot sends a message, make sure to log that with janis by calling to janis.hopOut
. Here is an example of a function that we're calling sendIt
that tracks an outgoing message and at the same time, has the bot say the message:
def sendIt(channel, text)
# schema matches Messenger
outgoingMessage = {recipient: {id: channel},message: {text: text}}
janis.hopOut(outgoingMessage)
client.say({'text': text, 'channel': channel}) # <= example of bot sending reply
...
Find the spot in your code your bot processes incoming messages it does not understand. Within that block of code, call to janis.logUnkownIntent
to capture these conversational ‘dead-ends’. Here's an example:
# let the user know that the bot does not understand
sendIt(recipient_id, 'Huh?')
# capture conversational dead-ends.
janis.logUnknownIntent(incomingMessage)
janis can trigger alerts to suggest when a human should take over for your Chatbot. To enable this, create an intent such as when a customer explicitly requests live assistance, and then include the following lines of code where your bot listens for this intent:
# match an intent to talk to a real human
if text == 'help'
# let the user know that they are being routed to a human
sendIt(recipient_id, 'Hang tight. Let me see what I can do.')
# send a janis alert to your slack channel
# that the user could use assistance
janis.assistanceRequested(incomingMessage);
To enable the ability to have a human take over your bot, add the code below to subscribe to the 'chat response' event. Alternatively, if you'd prefer to use a webhook to receive the payload, please get in touch with us at support@janis.ai and we can enable that for you.
# Handle forwarding the messages sent by a human through your bot
janis.on :'chat response' do |data|
text = data['text']
channel = data['channel']
client.say({'text': text, 'channel': channel}) # <= example of bot sending message
end
Go back to Slack and wait for alerts. That's it! Be sure to check out our examples.
FAQs
Unknown package
We found that janis-ai demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.