我跟随this Slack tutorial创建了一个入门机器人,为人们提供了一些如何与其他成员互动的技巧。本教程建议使用Postman来测试板载体验,但不清楚如何操作。我对这个问题感到困惑:我在哪里放置授权令牌?
Prereqs:
rackup
已启动以启动服务器我在做什么:
使用Postman macOS客户端将team_join
的此默认JSON事件发送到/events
endpoint:
{
"type": "team_join",
"user": {
"id": "U023BECGF",
"name": "bobby",
"deleted": false,
"color": "9f69e7",
"profile": {
"first_name": "Bobby",
"last_name": "Tables",
"real_name": "Bobby Tables",
"email": "bobby@slack.com"
},
"is_admin": true,
"is_owner": true,
"is_primary_owner": true,
"is_restricted": false,
"is_ultra_restricted": false,
"has_2fa": false,
"two_factor_type": "sms"
}
}
我尝试将token
作为参数,标题键/值并在JSON对象中。这些方法似乎都不会这样做,并且会导致授权错误。我得到Invalid Slack verification token received:
或解析问题。
如何使用此设置测试新用户加入的内容?
答案 0 :(得分:2)
令牌在事件信封中可用,因此您需要在JSON中上升一级:
{
"token": "{{verification_token}}",
"team_id": "{{team_id}}",
"api_app_id": "{{app_id}}",
"event": {
"type": "team_join",
"user": {
"id": "{{user_id}}",
"team_id": "{{team_id}}",
"name": "{{user_name}}",
"deleted": false,
"status": null,
"real_name": "{{user_real_name}}",
"profile": {
"first_name": "{{user_first_name}}",
"last_name": "{{user_last_name}}",
"real_name": "{{user_real_name}}",
"real_name_normalized": "{{user_real_name}}"
},
"is_bot": false
}
},
"type": "event_callback",
"authed_users": ["{{authed_user}}"]
}