ChatBot use case validation

Description
I’d like to ask the team to validate a use case I have.

I want the ChatBot to contact any user in my account (and my account only) to run simple surveys and interviews and get feedback. I want to use the imchat:bot scope and the Send Chatbot messages api to be able to send markdown messages and get feedback.

This is what I did so far:

  1. Created a Account level TeamChat app with scopes: app:channel_content:write:admin, imchat:bot, imchat:write:admin
  2. Created the code to implement the client_credentials grant
  3. Managed to get the access_token

The problem is that I’m getting: { code: 7004, message: ‘Not authorized.’ } when calling the send bot message api.

I noticed that if I click on “Add” button in “Local testing” tab and authorize the app for my developer account I’m able to successfully send the message.

I found some mixed statements in dev forum.
For example here: 7004 error when sending message from chatbot its said that installing a chatbot is not a prereq to have the messaging working. This is what I’d expect from an

Account Level app so the question is, will all the users need to “install” the bot for it to be able to send messages to them? Or am I doing something wrong?

@lech.lachowicz

  1. You need to authorize the bot atleast once before you are able to send messages. If you uninstall the bot then you need to authorize again before you can send the message again.

  2. Another reason you can get this error is if you are not generating a new chatbot token after the previous one expires. Tokens expire after 1 hour

Hi @lech.lachowicz,

Did you complete the project?

Thanks,
AM