2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

今日飲むビールはこれで決まり

Posted at

目的

この世には様々なビールがあります。
ですが私たちはその何割を知っているでしょうか
わざわざ世界のビールを調べることはめんどくさいのでbotに解決してもらいましょう

どんなbot?

LINEアカウントのリッチメニューをクリックするとPUNK API から本日のビールが返ってきます

利用環境

  • Node-RED
  • Messaging API
  • ChatGPT API
  • PUNK API

デモ

unnamed.gif

フローとJSON

image.png

  1. webhookでメッセージを検知する
  2. PUNK APIをたたく
  3. name要素と説明要素を切り出す
  4. Chat GPTに翻訳してもらう
  5. ユーザーにリプライする
[{"id":"341cfe5a48657740","type":"tab","label":"フロー 4","disabled":false,"info":"","env":[]},{"id":"8ba8725f67caf07a","type":"Webhook","z":"341cfe5a48657740","name":"","url":"/webhook","x":140,"y":140,"wires":[["2330db1bcc605b53"]]},{"id":"ca76445e09ae1403","type":"ReplyMessage","z":"341cfe5a48657740","name":"reply","replyMessage":"","credentials":{"channelSecret":"test","channelAccessToken":"test"},"x":930,"y":140,"wires":[]},{"id":"2330db1bcc605b53","type":"http request","z":"341cfe5a48657740","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://api.punkapi.com/v2/beers/random","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":350,"y":140,"wires":[["dff7966b2710be64"]]},{"id":"dff7966b2710be64","type":"function","z":"341cfe5a48657740","name":"function 3","func":"msg.payload = \"[\" + msg.payload[0].name + \"]\" +  \":\" + msg.payload[0].description;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":140,"wires":[["b392f377c689acda"]]},{"id":"b392f377c689acda","type":"simple-chatgpt","z":"341cfe5a48657740","name":"","Token":"test","SystemSetting":"[]の外を日本語に翻訳して","x":760,"y":140,"wires":[["ca76445e09ae1403"]]}]

課題

  • 翻訳するAPIをChatGPTから変更する
  • リッチメニューのデザイン
  • LINE botとの対話感を出したい

まとめ

このbotを作成したことで普段なら飲まない種類のビールと出会うことができます
私は本日 「IPA Is Dead Kohatu」というビールと出会います
https://untappd.com/b/brewdog-ipa-is-dead-kohatu/628623

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?