IggyIgz is Transposit's debugging Slack bot. Send @IggyIgz a DM on Slack and ask it to search AWS CloudWatch.
Hey @IggyIgz, find me logs for request id 536afde6-a0ba-4772-b9dc-aebe6e7e9b3d on prod
Fork this app and modify it to work for your own infrastructure.
IggyIgz uses Dialogflow for natural language processing.
Create a new account on Dialogflow's console and create an agent for IggyIgz.
Train the agent to understand an intent: "Search by Request Id". Parameterize the intent with an instance
("staging" or "prod") and a requestId
(a UUID).
Optionally, tell Dialogflow more about your parameters:
instance
so that synonyms are understood ("stage", "production", etc.)instance
so that providing a value is optionalrequestId
so that your bot follows up if a value is missingSend your agent test input in the Dialogflow UI. Correct mistakes to improve your agent.
Enable Dialogflow's Slack integration. You will need to create a new Slack app, grant it chat scopes, and configure it to send events to Dialogflow. Exact instructions are part of the Dialogflow UI.
Send a welcome message to your bot to test it out!
To fulfill the "Search by Request Id" intent, implement a webhook in Transposit.
In this Transposit app, navigate to the deployed fulfillment
endpoint and copy its URL.
In Dialogflow, configure fulfillment via webhook. Paste in the URL copied from Transposit. Remove the api_key query parameter and put its value in a header X-API-KEY
instead. Last, edit your intent and enable webhook calls for fulfillment.
To check that your bot is working, change fulfillment
to simply echo its payload into Slack. Commit and DM your bot.
({ http_event }) => {
return {
status_code: 200,
headers: { "Content-Type": "application/json" },
body: {
payload: {
slack: {
text: `\`\`\`${JSON.stringify(http_event.parsed_body, null, 2)}\`\`\``
}
}
}
};
};
Dialogflow gives you very little control over what your bot posts in Slack. To take over the conversation, use Transposit's Slack data connector instead.
In fulfillment
, respond to Dialogflow with a HTTP 200 and an empty body. Call setImmediate
and post messages from there instead.
({ http_event }) => {
const slackRequest =
http_event.parsed_body.originalDetectIntentRequest.payload.data;
setImmediate(() => {
api.run("slack.post_chat_message", {
$body: {
channel: slackRequest.event.channel,
text: "Hello, World!"
}
});
});
return {
status_code: 200,
headers: { "Content-Type": "application/json" },
body: {}
};
};