Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8835

AWS LAMBDAでLINE BEACON動かしたいが、どうするの?

$
0
0

AWS LAMBDAでLINE BEACON動かしたいが、どうするの?
誰か教えて〜!!!!

今BOTまで完成し、次はビーコンをやってみようとしてるのだがうまくいかない。。。

LAMBDAの中身はこんな感じです!

どうやったらビーコンってから返事帰ってくるの〜???

'use strict'

const line = require('@line/bot-sdk')

var event
var context
var callback

exports.handler = (_event, _context, _callback) => {
event = _event
context = _context
callback = _callback
main();
};

var main = function () {
const client = new line.Client({
channelAccessToken: ''
})

// define default response when we don't want to return anything.
var message = {
    type: 'text',
    text: `FAQからご希望の質問を選択していただくか、Line@よりお問い合わせください。`
}

// catch which menu item out client clicked
var inqueryText = event.events[0].message.text

switch (inqueryText) {
case "営業時間を知りたい":
    message = [
        {
            type: 'text',
            text: `営業時間を知りたい\n

`
            },
            {
                type: "template",
                altText: "ご確認",
                template: {
                    type: "confirm",
                    text: "問題は解決されましたか?",
                    actions: [
                        {
                            "type": "message",
                            "label": "はい",
                            "text": "はい"
                        },
                        {
                            "type": "message",
                            "label": "いいえ",
                            "text": "いいえ"
                        }
                    ]
                }
            }

        ]

        break

case "定休日はありますか?":
    message = [
        {
            type: 'text',
            text: `定休日はありますか?\n

`
            },
            {
                type: "template",
                altText: "ご確認",
                template: {
                    type: "confirm",
                    text: "問題は解決されましたか?",
                    actions: [
                        {
                            "type": "message",
                            "label": "はい",
                            "text": "はい"
                        },
                        {
                            "type": "message",
                            "label": "いいえ",
                            "text": "いいえ"
                        }
                    ]
                }
            }

        ]

        break

case "入場料金を知りたい":
    message = [
        {
            type: 'text',
            text: `入場料金を知りたい\n

<平日>\n
女性:無料
男性:¥1500/1Drink

<週末>\n
女性:¥1500/2Drink
男性:¥2000/2Drink

<日曜日>\n
女性:¥1000/1Drink
男性:¥1500/2Drink

【ご注意】\n
0時までにお来店されますと女性の方は飲み放題無料となります。\n\n

【お支払い方法】\n
現金もしくはクレジットカードにて受け付けます。\n\n
`
},
{
type: "template",
altText: "ご確認",
template: {
type: "confirm",
text: "問題は解決されましたか?",
actions: [
{
"type": "message",
"label": "はい",
"text": "はい"
},
{
"type": "message",
"label": "いいえ",
"text": "いいえ"
}
]
}
}

        ]

        break


    default:
        break

}


client.replyMessage(event.events[0].replyToken, message)
    .then(() => {
        callback(null, {})
    })
    .catch((err) => {
        callback(null, {})
    })

}


Viewing all articles
Browse latest Browse all 8835

Trending Articles