-
-
Save megaya/99e0372d5e902d1bb747eb3459c5033d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Alexa = require('ask-sdk-core'); | |
const { | |
WebClient | |
} = require('@slack/web-api'); | |
const TOKEN = 'Slack botのトークンをここに入れる'; | |
const LaunchRequestHandler = { | |
canHandle(handlerInput) { | |
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest'; | |
}, | |
handle(handlerInput) { | |
const speakOutput = '何をメモしますか?'; | |
return handlerInput.responseBuilder.speak(speakOutput).reprompt(speakOutput).getResponse(); | |
} | |
}; | |
const SlackIntentHandler = { | |
canHandle(handlerInput) { | |
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' | |
}, | |
handle(handlerInput) { | |
const channel = '#声メモ'; | |
const text = handlerInput.requestEnvelope.request.intent.slots.memo.value; | |
const client = new WebClient(TOKEN); | |
client.chat.postMessage({ | |
channel, | |
text | |
}); | |
return handlerInput.responseBuilder.speak('投稿しました').getResponse(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment