Adding Logging to an Existing bot
Follow these steps:
Connect to Application Insights
- Create an Application Insights service under your subscription.
- Use the
Instrumentation Key
inside your bot registration page under Instrumentation key. - Uner the App Insights serivce, go to API Access and copy Application ID
- Uner the App Insights serivce, go to API Access >> New Key with Read permissions and copy Api Key.
Connect to Cognitive Services
Create a new Sentiment Analisys Service under Cognitive Services.
When creating the service, make sure to mark Text Analytics - Preview.
Setting Environment Variables
APPINSIGHTS_INSTRUMENTATIONKEY={App Insights Instrumentation Key}
CG_SENTIMENT_KEY={Cognitive Services Text Analytics Key}
Connecting to Code
var logging = require('bot-fmk-logging');
logging.monitor(bot, { transactions: [
{
intent: 'alarm.set',
test: /^(Creating alarm named)/i
}
]});