Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
interface SlackSlashCommandResponse {
response_type?: SlackSlashCommandResponseType;
text: string;
attachments?: SlackSlashCommandResponseAttachment[];
}
interface SlackSlashCommandResponseAttachment {
text: string;
}
// Create an API endpoint
let endpoint = new cloud.HttpEndpoint("echo");
endpoint.get("/test", async (req, res) => {
const now = Date.now();
console.log(now);
res.status(200).end(now.toString());
});
endpoint.post("/echo", async (req, res) => {
const data = parseUrlEncodedBody(req.body);
const response: SlackSlashCommandResponse = {
response_type: "in_channel",
text: data.text,
};
res.status(200).json(response);