Skip to content

Commit

Permalink
move support page from keybase.pub & remove deprecated API (#328)
Browse files Browse the repository at this point in the history
* move support page

* remove deprecated API
  • Loading branch information
joshblum authored Feb 3, 2025
1 parent 6ec98ce commit 012073f
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 99 deletions.
28 changes: 0 additions & 28 deletions zoombot/SUPPORT.md

This file was deleted.

58 changes: 0 additions & 58 deletions zoombot/zoombot/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,6 @@ type DeauthorizationEvent struct {
ClientID string `json:"client_id"`
}

// Compliance

type DataComplianceRequest struct {
ClientID string `json:"client_id"`
UserID string `json:"user_id"`
AccountID string `json:"account_id"`
DeauthorizationEventReceived DeauthorizationEvent `json:"deauthorization_event_received"`
ComplianceCompleted bool `json:"compliance_completed"`
}

type DataComplianceResponse struct {
UserDataRetention bool `json:"user_data_retention"`
AccountID string `json:"account_id"`
UserID string `json:"user_id"`
Signature string `json:"signature"`
DeauthorizationTime string `json:"deauthorization_time"`
ClientID string `json:"client_id"`
}

func GetUser(client *http.Client, userID string) (*GetUserResponse, error) {
apiURL := fmt.Sprintf("%s/users/%s", apiBaseURLV2, userID)
resp, err := client.Get(apiURL)
Expand Down Expand Up @@ -229,45 +210,6 @@ func CreateMeeting(client *http.Client, userID string, request *CreateMeetingReq
return &meeting, nil
}

func DataCompliance(clientID, clientSecret string, request *DataComplianceRequest) (*DataComplianceResponse, error) {
apiURL := fmt.Sprintf("%s/oauth/data/compliance", apiBaseURL)
payload, err := json.Marshal(request)
if err != nil {
return nil, err
}

client := &http.Client{}
req, err := http.NewRequest("POST", apiURL, bytes.NewBuffer(payload))
if err != nil {
return nil, err
}
req.Header.Add("content-type", "application/json")
req.SetBasicAuth(clientID, clientSecret)
resp, err := client.Do(req)
if err != nil {
return nil, err
}

defer resp.Body.Close()

data, err := io.ReadAll(resp.Body)
if err != nil {
return nil, err
}

if resp.StatusCode != http.StatusOK {
return nil, parseError(resp.StatusCode, data)
}

var event DataComplianceResponse
err = json.Unmarshal(data, &event)
if err != nil {
return nil, err
}

return &event, nil
}

type ZoomAPIError struct {
Code int `json:"code"`
Message string `json:"message"`
Expand Down
18 changes: 5 additions & 13 deletions zoombot/zoombot/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,18 @@ func NewHTTPSrv(stats *base.StatsRegistry, kbc *kbchat.API, debugConfig *base.Ch
"zoombot", base.Images["logo"], "/zoombot")
http.HandleFunc("/zoombot", h.healthCheckHandler)
http.HandleFunc("/zoombot/deauthorize", h.zoomDeauthorize)
http.HandleFunc("/zoombot/support", h.supportHandler)
return h
}

func (h *HTTPSrv) healthCheckHandler(w http.ResponseWriter, _ *http.Request) {
fmt.Fprintf(w, "OK")
}

func (h *HTTPSrv) supportHandler(w http.ResponseWriter, _ *http.Request) {
fmt.Fprint(w, supportHTML)
}

// see https://developers.zoom.us/docs/api/webhooks/#verify-with-zooms-header
func (h *HTTPSrv) validateWebhookMessage(bodyBytes []byte, r *http.Request) (err error) {
requestTimestamp := r.Header.Get("x-zm-request-timestamp")
Expand Down Expand Up @@ -97,17 +102,4 @@ func (h *HTTPSrv) zoomDeauthorize(w http.ResponseWriter, r *http.Request) {
http.Error(w, "unable to delete user", http.StatusBadRequest)
return
}

_, err = DataCompliance(h.credentials.ClientID, h.credentials.ClientSecret, &DataComplianceRequest{
ClientID: deauthorizationRequest.Payload.ClientID,
UserID: deauthorizationRequest.Payload.UserID,
AccountID: deauthorizationRequest.Payload.AccountID,
DeauthorizationEventReceived: deauthorizationRequest.Payload,
ComplianceCompleted: true,
})
if err != nil {
h.Errorf("zoomDeauthorize: compliance error: %s", err)
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}
57 changes: 57 additions & 0 deletions zoombot/zoombot/support_html.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package zoombot

const supportHTML = `<html lang="en">
<title>
Keybase Meeting Link Bot Support
</title>
<body>
<h2 id="installation">Installation</h2>
<ul>
<li>Step by step guide<ol>
<li>Install Keybase (<a href="https://keybase.io/download">https://keybase.io/download</a>)</li>
<li>Add the Keybase Meeting Link Bot to your teams and conversations
through the following steps:<ol>
<li>Navigate to the conversation you wish to install Zoom Bot for</li>
<li>Click the 'Chat info &amp; sessions' button (the icon is an i in
a circle) in the top right corner</li>
<li>Select the 'Bots' tab</li>
<li>Scroll down to the entry that says 'Zoom Bot' and click the
plus. Keybase will guide you through installing the bot</li>
</ol>
</li>
</ol>
</li>
<li>Uninstalling or deauthorizing the Keybase Zoom Bot from your Zoom Account<ul>
<li>Navigate to <a
href="https://marketplace.zoom.us/user/installed">https://marketplace.zoom.us/user/installed</a> and click
on
the “Uninstall” button next to the Keybase integration</li>
</ul>
</li>
</ul>
<h2 id="usage">Usage</h2>
<ul>
<li><code>!zoom</code>: Create a new Zoom meeting<ul>
<li>To use the bot, type <code>!zoom</code> in conversations that the
Keybase Zoom Bot has been added to. If you haven't used the bot before,
it will direct message you in order to authenticate with Zoom.
Otherwise, the bot will broadcast a Zoom Instant Meeting link on your
behalf to the conversation that you sent the command into</li>
</ul>
</li>
</ul>
<h2 id="contact-support">Contact Support</h2>
<ul>
<li>Use the <code>!zoombot feedback &lt;feedback here&gt;</code> to provide feedback and questions.</li>
<li>Report issues here: <a
href="https://github.com/keybase/managed-bots/issues">https://github.com/keybase/managed-bots/issues</a></li>
<li>Join @keybasefriends to discuss with the community <a
href="https://keybase.io/team/keybasefriends">https://keybase.io/team/keybasefriends</a></li>
<li>In app going to <code>Settings &gt; Feedback</code> to submit bugs or <code>keybase log send</code> from the
command line.</li>
</ul>
</body>
</html>
`

0 comments on commit 012073f

Please sign in to comment.