Search code examples
apiintegrationslackslack-api

Slack workspace bot to bot communication


i am trying to send messages through Amazon alexa via a bot-user to an already created chat bot that is within the workspace already.

after using webhooks i realised the chatbot does not recognize the messages i am posting through my bot-user.

my problem solving attempts included:

using the "as_user" method set as true. so messages are sent by the user but it seems to only visually change the name of the bot-user and my chat bot still does not respond to my messages.

is it even possible for a bot-user using slack web API to communicate to an App-bot that is within a channel on a workspace? I am using Postman to test. i suspect it has something to do with he scopes of the bot-user and the chatbot within the workspace just not being able to see the bot-user scope. This is all within the slack web api and this is how i am communicating with the workspace through the bot user.

see images to illustrate.

thanks alot hope you can help! :)

First image of postman:

First image of postman

second image of slack intentions:

second image of slack intentions


Solution

  • Messages from real users look slightly different then message from bots / apps.

    Apparently your chatbot is ignoring messages that are not coming form a real user. So the only way to "fix" that would be to modify the chatbot logic.

    Example for message from real user:

     {
          "type": "message",
          "user": "U12345467",
          "text": "Good read for some of guys",
          "ts": "1531745292.000021"
     }
    

    Example for a bot message:

     {
          "text": "Hey guys",
          "bot_id": "B12345678",          
          "type": "message",
          "subtype": "bot_message",
          "ts": "1531700187.000049"
     }