Code Monkey home page Code Monkey logo

gaslacker's Introduction

Hi there 👋

For work-related or any other requests, please feel free to contact [email protected]

I have these experiences and am willing to

  • write Python, React or some other languages and create good developer experience repositories
  • think scalable and maintenance-easy architectures with AWS
  • and manage/organize teams.

Articles

https://zenn.dev/yhay81

Profile

https://www.linkedin.com/in/yhay81/

Stats

Yusuke Hayashi's github stats trophy GitHub Streak Top Langs

gaslacker's People

Contributors

nunukim avatar yhay81 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gaslacker's Issues

postのAuthorizationで失敗する

headers: { Authorization: this._token },

ここらへんに、Bearer が無いので失敗するような気がします。
_post だけは付けて通るようになったことを確認済みですが、プルリクしてよいか迷ったので
issueで挙げさせていただきました。

サンプル通りの最小構成でもエラーが発生する

Qiita 及び Readme に記載されている通りに実行を行ってもエラーが出てしまう。

1. サンプルの最小構成で実行

下記のコードを実行

var token = PropertiesService.getScriptProperties().getProperty('xoxp-自分のトークン');
var slack = GASlacker.methods(token);

function doPost(e){
  var event = JSON.parse(e.postData.contents).event;
  if(event.text.match(/hello/)){
    var text = "Hello," + event.message.username;
    slack.chat.postMessage(event.channel, text);
  }
}

下記のエラーが発生

SyntaxError: Unexpected token: t at doPost(コード:5)

doPost の e の中身を見ると、既にparseされたものが入っていた。
parseが不要と判断し、プログラムを修正。

2. parse処理を抜いたプログラムを実行

下記のコードを実行

var token = PropertiesService.getScriptProperties().getProperty('xoxp-自分のトークン');
var slack = GASlacker.methods(token);

function doPost(e){
  if(e.parameter.text.match(/hello/)){
    var text = "Hello," + e.parameter.user_name;
    slack.chat.postMessage(e.parameter.channel_id, text);
  }
}

下記のエラーが発生

Exception: Attribute provided with invalid value: Header:null at [unknown function](コード:547) at [unknown function](コード:524) at [unknown function](コード:849) at doPost(コード:7)

3. 他に試したこと

別のメソッドが使えないか確認するため、user.profile.get関数を試しました。

slack.user.profile.get(false, e.parameter.user_id);

結果、以下が返ってきた。

{ok=false, error=not_authed}

勉強不足で、これ以上の事は分かりませんでした。
tokenが誤っているなど使い方の間違いかもしれませんが、何かご存知でしたら教えてください。
よろしくお願いします。

実行するとエラー ReferenceError: 「GASlacker」が定義されていません。

この記事を読んで試してみました。
https://qiita.com/yhay81/items/edf74af8efe3d3d1a1b5

試したコードは以下です。

var token = PropertiesService.getScriptProperties().getProperty('xoxp-自分のトークン');
var slack = GASlacker.methods(token);

function doPost(e){
  var event = JSON.parse(e.postData.contents).event;
  if(event.text.match(/hello/)){
    var text = "Hello," + event.message.username;
    slack.chat.postMessage(event.channel, text);
  }
}

実行すると以下のエラーメッセージが表示されました。

ReferenceError: 「GASlacker」が定義されていません。(行 2、ファイル「コード」)

ライブラリに入力したプロジェクトキーは M3W5Ut3Q39AaIwLquryEPMwV62A3znfOOで、ライブラリのバージョンは22です。

間違っている箇所があれば教えていただきたいです。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.