Is it worth bothering with the ChatBot API?

#1

Is there even just a single working end-to-end example (ideally with documentation) of posting a message to a channel as a bot ? I’ve searched high and low, went through the zoom documentation (which contains many errors btw), tried various examples (the zoom-bot-api node app on github, the curl examples, etc) which all seems to be incomplete and all ending up with dead ends. If you have a working example somewhere, please share that, or if one does not exist then I can stop wasting my time with zoom bot api.

0 Likes

#2

This is the simplest path that I’ve found, using curl. (note that I get the same result when going through Postman, or when using the zoom bot api example https://github.com/zoom/zoom-bot-api):

First get the access token:
curl -X POST ‘https://api.zoom.us/oauth/token?grant_type=client_credentials&client_id=CLIENTID&client_secret=CLIENTSECRET’ -H ‘Accept: application/json’

The result contains an access token, and scope as follows: scope":“user:write:admin user:read:admin imchat:write:admin imchat:bot user:master”

As far as I can see in the documentation, I scope of “imchat:write:admin imchat:bot” is what is required to post messages.

(Below continues since I can’t put more than one link when posting to devforum…)

0 Likes

#3

(… continuing example above)

Now, try send a message to a channel:
curl -X POST
https://api.zoom.us/v2/im/chat/messages
-H ‘Authorization: Bearer ACCESS_TOKEN_FROM_ABOVE_RESPONSE’
-H ‘Cache-Control: no-cache’
-H ‘Content-Type: application/json’
-d ‘{
“robot_jid”:“BOTJID”,
“to_jid”:“CHANNEL JID”,
“account_id”: “ACCOUNT_ID”,
“content”: {
“head”: {
“text”: “Ticket ZOOM-1000 Created”
},
“body”: [
{
“type”: “message”,
“text”: “ZOOM-1000 New Bot Feature”
}
]
}
}’

I get this error: {“message”:“The user does not have authorization, the application cannot send the message.”,“code”:7004}.

I’m not able to get past this error, and I don’t see anything in the documentation that might explain this error. I’m not aware of any authorization settings, other than those of the bot, which as per above scope seems to be correct.

0 Likes

#4

Did you use an actual robot JID number acquired from the marketplace?
Your example looks like you just used the literal “BOTJID”

0 Likes

#5

I used the value from the marketplace. Everywhere where you see var names in CAPS, is where I’ve removed the actual values since I did not want to have that publicly here in the forum. Have you been able to successfully post messages as a bot using the API ?

0 Likes

#6

Haven’t tried - am trying to get video chat working via their Electron SDK to no avail.
I was put off the chat bot stuff as it seems you can only create one if you choose to have it listed publicly on the marketplace - unlike other types of Zoom apps.
A private chatbot on Zoom for internal corporate use would be useful for us but for whatever reason Zoom have locked that so it’s marketplace/public only, why I have no idea.

With the error you describe - do you have all the necessary permission granted? My boss had to assign some so I could start developing…

0 Likes

#7

I also don’t want to publish the Bot at any point, however my understanding from the documentation is that you don’t need to publish the Bot. You do need to say that you intend to publish it in order to get the Bot options on the app.

An end to end, step by step, working example would be great but that doesn’t seem to exist.

From the docs:

Intend to Publish option needs to be selected even if it is a private app. You do not need to publish this app if you choose not to).

and

When developing your bot, submission is only required when bots are intented for publishing on Marketplace. If the bot is for internal use you do not need to submit, you will only need to generate your publishable url for your production keys to work.

0 Likes

#8

Hey thanks that’s very useful. I’ll give it a go then!

0 Likes

#9

I created a chatbot with their new npm module (https://marketplace.zoom.us/docs/guides/guides/building-a-chatbot/zoombotsdk-chatbot)

It was very straightforward and I was able to get it up and running in few hours. You do not need publish is to marketplace if you want to keep it private - mine is private and is used for internal purposes within my company.

Keep in mind that their bots work at account level which means you need to be an account admin of your zoom account to enable the bot. It’s documented but I missed it and took sometime to figure it out. It’s a pain but I guess they are protecting their customers data from rogue bots.

Hope this helps.

Frank

2 Likes

#10

Thanks very much, will give the npm module a try next.

0 Likes

#11

Hi @hancojvr,
I am sorry that you found the docs confusing. Do you have an admin account with Zoom? Have you tried using the ZoomBotSDK? As @Frank_Viggiano mentioned, you can find an end-to-end example for the chatbot here: https://marketplace.zoom.us/docs/guides/guides/building-a-chatbot/zoombotsdk-chatbot
You can find the repo for this guide here: https://github.com/zoom/zoom-bot-demo

For authorization, Frank’s suggestion is useful. Ensure that you have a Zoom admin account and that you’re using the correct credentials. Please, let us know if it helps. We’re in the process of revamping our docs to ensure that we meet up to your expectations. Could you tell us what errors did you see in the docs so that we can fix them? Thank you so much for your patience. A member from our team will also assist you if you continue to see these errors.

0 Likes

#12

Sure, once I have a working example, I will post what I’ve seen as errors in the docs and will try explain why I’ve found the docs unclear / frustrating (incl. app error messages I’ve found to be unhelpful). It’ll just be my view of things, but maybe it helps you with improvements in future.

1 Like

#13

@shrijana.g, with the SDK-bot-demo I get the same error message is before which really isn’t telling me much:

{“message”:“The user does not have authorization, the application cannot send the message.”,“code”:7004}

Do you perhaps know what this might be referring to ?

Let me ask some questions about things that I’m not certain about:

  1. I’m trying to evaluate zoom chat bot api, and so I’m working with a free zoom account. Is the free zoom account supposed to work for chat bots, or is there perhaps a limitation here ?
  2. My account profile in marketplace says ‘Admin’. Is this the ‘Account Admin’ level that is required for a bot ?
  3. Must the Bot be installed into the zoom account in some way? (aside from registering it on marketplace). I’m not seeing an option to do this, but thought I’d just check.

I’ve noticed in the sdk-bot-demo code (index.js) that there is a setting for

setting.setUrl(‘https://dev.zoom.us’)

which is supposed to be used with dev credentials, which is what I’m using. It’s the first time I’ve seen this distinction with the dev.zoom.us VS. api.zoom.us. I’ve been using https://api.zoom.us as per the examples. However when I switch to https://dev.zoom.us, the api calls simply hang.

Also, and this is minor but just an example of the various small irritations I’ve experienced with this api, documentation, examples: When I clone the sdk-bot-demo from github, and run npm install as per the docs, it fails with a JSON parse error. I need to first delete the package-lock file, before the package install works.

0 Likes

#14

@hancojvr Thank you for the details. A free account would not be able to make the API calls. You would need a pro account.
Additionally, you do not need to use setting.setUrl(‘https://dev.zoom.us’). Sorry for the confusion and I will make sure that the docs get updated.

Once you have finished registering your app (with a publishable url generated), you can copy that publishable url and open it in a browser. You would then authorize the app. This will install the bot in your Zoom client.

If you have a pro account, can you try using your prod credentials? If not, send us an email at marketplace-support@zoom.us and provide us with the email for your Zoom account that needs to be upgraded and we can provide you with a 30 days trial. Thank you for your patience and for your inputs.

0 Likes

#15

I am now able to finally post to a channel from a Bot.

  • I upgraded to Pro license. However, I still got the exact same error message as before. So, it’s not clear that the Pro license was really required, since I was able to make API calls just fine and they mostly worked with the Basic license. At no point did I get an error message stating that I needed to upgrade my license… but then again, the error messages have been mostly useless anyway.

  • I needed to take the following steps to make the Bot able to post: Go to the bot management page, go to ‘Local Test’, Generate the URL, past the URL into a browser, then authorise the Bot.

  • I did not need to use my prod credentials, developer credentials worked fine.

  • By far the easiest path to do a simple post from a bot to a channel, is to use the curl examples above. No need for callback URLs with ngrok, it’s a simple and clean way to get going. Only two post calls, one to get an access token, then other one to send a message using the access token. This should be a simple, step by step guide for developers to get going with posting messages from applications to zoom chat (in a dev env!!). Hopefully this will help others avoid hours and hours of frustrations and wasted time.

0 Likes