# Multi environment chatbot

**URL:** <https://devforum.zoom.us/t/multi-environment-chatbot/30909>\
**Category:** API and Webhooks\
**Created:** [September 21, 2020, 7:28pm UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909 "2020-09-21T19:28:42Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbl](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jbl/32/3432_2.png) [@jbl](https://devforum.zoom.us/u/jbl)\
**Post date:** [September 21, 2020, 7:28pm UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/1 "2020-09-21T19:28:42Z")

</div>

**Description**

I’m working a Zoom chatbot integration with our product, but our setup is such that every customer has it’s own dedicated server/subdomain.

We want to create an integration that we at some point can publish on your market place, but the combination of multi-server and one static webhook URL makes this a bit difficult. I was thinking of making a router-middle layer to deal with this. But we need some sort of identifier to make this solution viable.

I would like any input on what I potentially could use as an identifier or alternative solutions.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 22, 2020, 8:14pm UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/2 "2020-09-22T20:14:08Z")

</div>

Hey @jbl,

Thanks for reaching out about your Chatbot implementation. Just to make sure we’re on the same page, are you saying that your customers have unique Zoom subdomains, or simply that they’re on different Zoom accounts?

If it’s just that they don’t belong to your Zoom account, you can use OAuth to have Zoom users outside your account authorize your Chatbot:

> **[Chatbot - Build an App - Documentation](https://marketplace.zoom.us/docs/guides/build/chatbot-app#local-testing)**
>
> Create a Chatbot App
> 
> Chatbots are apps installed within the Zoom Client which interact with users using the chat interface. Chatbots could be created t...

Having said that, please let me know if I’m misunderstanding. Any more details you can provide for clarification will help me to further assist!

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![jbl](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jbl/32/3432_2.png) [@jbl](https://devforum.zoom.us/u/jbl)\
**Post date:** [September 23, 2020, 3:20pm UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/3 "2020-09-23T15:20:51Z")

</div>

Hi, Thanks for getting back to us.

Currently, we got a working integration with Zoom. However, this relies on every customer(our customers) to setup there own Zoom app and specify their server(is own subdomain) as the “Bot endpoint URL”.

I would like to make an app where the user can click on an OAuth link(in our solution) and if they grant access to the app we will know what server/subdomain it’s should send the messages to.

To clarify, when I write subdomain, it’s related to our solution as every customer has it’s own environment/subdomain.

What I was thinking is, I’ll attach the origin in the “state” part of the Oauth URL. If the customer grants access, you will redirect to our middle layer(/auth endpoint). This middle layer will now know the origin and can forward the auth request to appropriate server.

The issue is, if the customer now writes something(to the bot in Zoom) how do I determine what server I should forward this request to? Is there some iditifier that I can use to create a mapping?

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 24, 2020, 7:50pm UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/4 "2020-09-24T19:50:34Z")

</div>

Hey @jbl,

Thanks for clarifying—and great idea.

As of right now, using a router would be the only way to do this. In terms of an identifier, you should be able to check the `account_id` in the payload and use that to route to the proper server.

Hope this helps!  
-Will

---

<div class="post-metadata">

**Author:** ![jbl](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jbl/32/3432_2.png) [@jbl](https://devforum.zoom.us/u/jbl)\
**Post date:** [September 25, 2020, 9:03am UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/5 "2020-09-25T09:03:51Z")

</div>

Okey, given an access token(chat bot), can you get the account id that this access token belongs to?

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 28, 2020, 4:48pm UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/6 "2020-09-28T16:48:30Z")

</div>

Hey @jbl,

The account ID would be included in the decoded access token.

Let me know if this helps!  
-Will

---

<div class="post-metadata">

**Author:** ![jbl](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jbl/32/3432_2.png) [@jbl](https://devforum.zoom.us/u/jbl)\
**Post date:** [September 29, 2020, 6:01am UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/7 "2020-09-29T06:01:51Z")

</div>

Hi,

When I decode the JWT I get from calling [https://api.zoom.us/oauth/token](https://api.zoom.us/oauth/token), I don’t find any account ID that matches? As I understood it, the `payload.accountId` should be in the JWT as well? The only key-value that matches is the `userId` and I don’t think I want to use that one?

Here is a revoked version of the decoded JWT and an incoming event.

Decoded JWT

```auto
{
    'aud': 'https://oauth.zoom.us',
    'uid': '<1234>',
    'ver': 7,
    'auid': '<revoked>',
    'nbf': '<revoked>',
    'iss': '<revoked>',
    'gno': '<revoked>',
    'exp': '<revoked>',
    'type': '<revoked>',
    'iat': '<revoked>',
    'jti': '<revoked>'
}

```

Event:

```auto
 {
'event': 'bot_notification',
'payload': {'accountId': '<revoked>',
          'channelName': '<revoked>',
          'cmd': '<revoked>',
          'name': '<revoked>',
          'robotJid': '<revoked>@xmpp.zoom.us',
          'timestamp': '<revoked>',
          'toJid': '<1234>@xmpp.zoom.us',
          'userId': '<1234>',
          'userJid': '<1234>@xmpp.zoom.us',
          'userName': '<revoked>'}
}

```

---

<div class="post-metadata">

**Author:** ![jbl](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jbl/32/3432_2.png) [@jbl](https://devforum.zoom.us/u/jbl)\
**Post date:** [September 29, 2020, 6:23am UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/8 "2020-09-29T06:23:01Z")

</div>

Hi,

Just realized after posting that I got to call `https://zoom.us/oauth/authorize` with the `authorization_code`. Looks like it’s going to work, thanks for your help!

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 30, 2020, 7:23pm UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/9 "2020-09-30T19:23:47Z")

</div>

hey @jbl,

That’s correct—glad it’s working out for you!

Best,  
Will

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [October 31, 2020, 5:24am UTC](https://devforum.zoom.us/t/multi-environment-chatbot/30909/10 "2020-10-31T05:24:00Z")

</div>

Closed on October 31, 2020, 5:24am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
