- Create a Twilio account
- Get a Twilio phone number in your Twilio account
- Create the following secrets in the Account Settings Page (select "Custom Key" when you get to the Types of Secrets section):
- Twilio phone number
- Account SID (found in the API keys & tokens section of your Twilio account. Make sure to login to your Twilio account first)
- Auth Token (found in the API keys & tokens section of your Twilio account. Make sure to login to your Twilio account first)

- If you initially used a Twilio trial account to evaluate this capsule, you will eventually need to upgrade your Twilio account to a regular paid account to use this capsule in a production environment. More information about Twilio SMS pricing.
*Note: if this capsule was duplicated from the Apps Library, you can skip this entire section.The environment is already fully setup for you.
- Create a new capsule and select copy from public git
- Enter the url for this github repo
https://github.com/codeocean/text-notification.git
- Select a starter environment that has python available. The Python (3.8.5, miniconda 4.9.2, jupyterlab 3.0.9) starter environment that came preinstalled with Code Ocean will work but any starter environment with python will work.
- Click on the gear icon next to
pipand selectEdit Bulk. - Copy and paste the following packages into the
Edit Pip Packagestext field.code-ocean-aux-tools==1.1.3 twilio==8.8.0 - Your environment is setup. The first time you run this capsule, the environment will need to build and you will find a file called
buildLogin the results folder. Every subsequent time you run this capsule, the environment will not build and the capsule will simply pull the docker images from the registry.
*Note: if this capsule was duplicated from the Apps Library, you can skip this section and procede directly to attaching secrets. The secrets are already in the environment UI, you just merely need to attach your secrets described in the next section.
Prerequisite: you should have already created 3 secrets in your account settings page decribed above in the requirements section.
- Scroll to the bottom of the Environment UI and click on the
Add secret to capsulebutton and selectCustom Key. - Select you Twilio SID secret. You must select this particular secret first.
- Repeat step #1 and select Twilio Auth Token secret. You must select this particular secret 2nd.
- Repeat step #1 and select Twilio Phone secret. You must select this particular secret 3rd.
- Your secrets should look like the image below. The name of each secret is not important. However, the order of the secrets is. The value for the first secret must be your Twilio SID and so on.
*Note: if you needed to do the steps above for Add Secrets To Capsule, then you don't need to complete the steps below because you have inherently already attached your secrets during the process.
- Setup this capsule by attaching your secrets
- Go to the Environment UI and scroll to the bottom where the Secrets section is found
- Attach your secrets to this capsule.
- Make sure you attach your secrets that correspond to the secrets setup in this capsule (e.g. ensure you attach your Twilio phone number secret for the capsule secret labelled Twilio Phone, etc.)
*Note: if you duplicated this capsule from the Apps Library, this capsule will already have an app panel which means you can skip this section.
To effectively use this capsule to receive notifications in a pipeline, you will want to setup an App Panel here in the capsule so that it will be available in the pipeline you add this capsule to.
-
Click on the
App Buildertab on the lefthand side. -
Click on either the
Create Appbutton or the gear icon in the top right. -
Fill in the
SubtitleandInstructionsfields in theGeneralsection. -
Scroll down to the
Parameterssection and add atext parameterby clicking on the icon. -
Complete the
Phonetext parameter. -
Add another text parameter and complete the
Messagetext parameter. -
Add a
list parameter. -
Complete the
Logginglist parameter.- Fill out the
Label,List Values,Default Value, andDescriptionfields. - The values needed for the
List Valuessection are
console file both off - Fill out the
-
Add another
List Parameterand complete theLogging Levellist parameter.- The values needed for the
List Valuessection are
debug info warning error critical- Here is the description section if you want to use the same description as we are using
The log level to start tracking (e.g. warning means that events listed under warning and greater severity will be logged). This parameter is only relevant if logging is turned on. - The values needed for the
-
Click on the
Finishbutton at the bottom. Your App Panel is now setup.
- Click on App Builder on the left (If your App Builder is empty, see the section above for Creating App Panel).
- Enter the phone number to send the text notification to.
- Enter the message to include in the text notification.
- Select the logging options if you would like to include some logging information with the output.
- Run this capsule to confirm it is setup correctly.
This capsule can be used in a Code Ocean Pipeline to send a notification at any point in a Pipeline where you attach this capsule. This can be after a critical step in a pipeline completes or after the entire pipeline completes or both. You are able to add as many copies of this capsule as fits your needs.
- Add this text notification capsule to the Pipeline UI.
- Connect this capsule at the point in the pipeline where you want to be notified. In the example below, as soon as the
Create metadatacapsule completes, the text notification capsule will run and send the text notification. - Adjust any settings for this text notification capsule using the Pipeline App Builder. You will likely want to set the phone number to send the notification to and also set the notification message.
- Repeat steps 1,2, and 3 to receive additional notifications at any other step in your pipeline.
Code Ocean is a cloud-based dry lab for scientific computing with a focus on guaranteeing reproducibility, collaboration and organizing scientific projects. Code Ocean automates best practices allowing users of the platform to focus on science yet follow best practices.


















