Save Zoom recordings to Amazon S3, email host, then delete Zoom recording
@zoom-demo
code:
data:privatelast updated:4 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
trigger
steps.
construct_filename_and_download_url
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
5
6
7
8
9
}
10
const shortid = require('shortid')

// A recording with a topic "Test Recording" and file type MP4 becomes "test_recording-abc123.mp4"
// We append a "short ID" to avoid collisions for recordigs with the same topic name
const meetingTopic = event.meeting_topic.replace(/[^a-zA-Z0-9]/g, '_').toLowerCase()
this.filename = `${meetingTopic}-${shortid.generate()}.${event.file_type.toLowerCase()}`

this.downloadURL = `${event.download_url}?access_token=${event.download_token}`
steps.
upload_recording_to_amazon_s3
auth
to use OAuth tokens and API keys in code via theauths object
(auths.aws)
params
Bucket
 
string ·params.Bucket
Download URL

The URL of the file to upload to S3

{{steps.construct_filename_and_download_url.downloadURL}}
string ·params.downloadURL
Filename
{{steps.construct_filename_and_download_url.filename}}
string ·params.filename
AWS Region

The AWS region tied to your S3 bucket, e.g us-east-1 or us-west-2

 
us-east-1
string ·params.region
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
}
28
const AWS = require("aws-sdk")
const fetch = require('node-fetch');
const format = require('date-fns/format')

const { accessKeyId, secretAccessKey } = auths.aws
const { Bucket, downloadURL, filename, region } = params

const s3 = new AWS.S3({
  accessKeyId,
  secretAccessKey,
  region,
})

// Stream the data from HTTP request directly to S3.
// AWS' s3.upload method below accepts a Readable stream
// as the Body, which fetch returns by default.
// See https://github.com/aws/aws-sdk-js/issues/2100
const recordingResponse = await fetch(downloadURL)

this.s3Response = await s3.upload({
  Bucket,
  Key: `${format(new Date(), "yyyy/MM/dd/")}${filename}`, // Store in YYYY/MM/DD/ "dirs" to avoid name collisions
  Body: recordingResponse.body,
}).promise()

this.url = this.s3Response.Location
steps.
send_email
auth
to use OAuth tokens and API keys in code via theauths object
(auths.sendgrid)
params
To email

The email address of the recipient.

{{event.host_email}}
string ·params.to_email
Subject

The subject line of your email.

Recording completed for meeting {{event.meeting_topic}}
string ·params.subject
From email

The email address of the sender.

notifications@pipedream.com
string ·params.from_email
Reply to_email

The email address to which responses will be sent.

notifications@pipedream.com
string ·params.reply_to_email
Optional
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps, params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
}
41
const axios = require('axios')

return await require("@pipedreamhq/platform").axios(this, {
  url: `https://api.sendgrid.com/v3/mail/send`,
  headers: {
    Authorization: `Bearer ${auths.sendgrid.api_key}`,
  },
  method: 'POST',
  data: {
    "personalizations": [{
      "to": [{
        "email": params.to_email,
        "name": params.to_name
      }],
      "subject": params.subject,
      "headers": params.headers,
      "substitutions": params.substitutions,
      "custom_args": params.custom_args,
      "send_at": params.send_at
    }],
    "from": {
      "email": params.from_email,
      "name": params.from_name
    },
    "reply_to": {
      "email": params.reply_to_email,
      "name": params.reply_to_name
    },
    "content": [{
      "type": "text/plain",
      "value": `Recording URL: ${steps.upload_recording_to_amazon_s3.s3Response.Location}`
    }],
    "template_id": params.template_id,
    "sections": params.sections,
    "categories": params.categories,
    "batch_id": params.batch_id,
    "ip_pool_name": params.ip_pool_name
  }
})
steps.
zoom_delete_recording
Deletes a Zoom cloud recording
auth
(auths.zoom_admin)
params
Meeting ID

The meeting ID or UUID

{{event.meeting_id}}
string ·params.meetingId
Action

The recording delete action. trash: Move recording to the trash. delete: Delete recording permanently

string ·params.action
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
}
19
const axios = require("axios")

// See the API docs: https://marketplace.zoom.us/docs/api-reference/zoom-api/cloud-recording/recordingdelete
const config = {
  method: "DELETE",
  url: `https://api.zoom.us/v2/meetings/${params.meetingId}/recordings`,
  params: {
    action: params.action,
  },
  headers: {
    Authorization: `Bearer ${auths.zoom_admin.oauth_access_token}`,          
    "Content-Type": "application/json"
  }
}

// A 204 response indicates the recording was successfully deleted
return await axios(config)