dongpang4470 2017-11-05 17:18
浏览 17
已采纳

应用程序名称未在传出的webhook请求中显示

when ever I try to get the username from slack outgoing hook its showing default username as slackbot.it doesn't show the username of the actual person in this case Nawaf. as u can see it should save the name "Nawaf" or "test" but it's saving "slackbot" what am I doing wrong?

IMAGE 1

IMAGE 2

IMAGE 3

slack outgoing webhook documentation https://api.slack.com/custom-integrations/outgoing-webhooks

  • 写回答

1条回答 默认 最新

  • drz49609 2017-11-06 12:20
    关注

    The reason you don't get the username of the app message in your outgoing webhook request is most likely that this is not supported. Outgoing webhooks is a legacy feature of Slack and replaced by the Events API, which provide a similar functionality, but is way more powerful.

    I tested it to verify your requirement and can confirm that you get the name of the app sending a message with the Events API from message events.

    Here is an example of the message event you receive from a message posted by incoming webhooks (as PHP array):

    array (
      'token' => 'XXX',
      'team_id' => 'T12345678',
      'api_app_id' => 'A12345678',
      'event' => 
      array (
        'text' => 'This is a line of text.
    And this is another one.',
        'username' => 'magic-webhook',
        'bot_id' => 'B12345678',
        'type' => 'message',
        'subtype' => 'bot_message',
        'ts' => '1509969916.000102',
        'channel' => 'G12345678',
        'event_ts' => '1509969916.000102',
      ),
      'type' => 'event_callback',
      'event_id' => 'Ev12345678',
      'event_time' => 1509969916,
      'authed_users' => 
      array (
        0 => 'U12345678',
      ),
    )
    

    For messages posted by Slack apps you won't get the username in the message event directly, but you can then call the API method bots.info with bot_id to get the app name.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题