Skill Level: Beginner

By utilizing Bluemix, NodeJS, SendGrid , and HTTP requests, I will show you how to bypass the native IBM BPM email functionality. This will allow emails to be sent through HTTP requests done inside IBM BPM.


  1. Why use HTTP to send an Email?

    In using IBM BPM we recieved security certificate errors and SMTP functionality issues that were not easily fixable when using a cloud or local environment.  We found the best way was to send the HTTP request to our own server running inside Bluemix on Cloud Foundry.  By doing this we bypass these key areas of contention.

    • SMTP Email Requests
    • HTTP Security Certificate errors
    • Hard to work with response data
  2. Installing the Environment

    1. IBM BPM must be running successfully on either a Cloud or Local instance.
      1. Inside a human service have a Read from HTTP integration (this is found inside the System Data toolkit >>Implementation tab)
      2. The only field we need to work with is the URL of the integration service.
    2. Bluemix Cloud Foundry server with NodeJS
      1. Go into Bluemix, ensure that you followed the getting started steps.
      2. Including installing the CF and Bluemix Command Line Interfaces.
    3. SendGrid
      1. Have a working SendGrid account
        1. A free account with 12,000 emails a month is available off their site directly.
    4. RestifyAPI
      1. Do not do anything with this yet. We will install it later on via NPM through terminal
  3. Creating the NodeJS Environment

    1. Ensure that NodeJS is installed in the directory of your downloaded Bluemix Cloud Foundry Project Folder.
    2. Install Restify in the Bluemix Cloud Foundry Project Folder
      1. Navigate to the directory of the Cloud Foundry Project Folder
      2. npm install restify
    3. Add Restify to your package.json file
      1. Screen-Shot-2016-08-18-at-3.07.08-PM
    4. Add Sendgrid to your package.json (and install sendgrid to your Bluemix Cloud Foundry Project Folder)
      2. npm install sendgrid
      3. You might also need to install the NodeJS HTTP Client Dependency

    5. Create a Javascript file that runs the Restify server
      1. Restify has some code that works wells for your initial server (found on their website)
        1. Screen-Shot-2016-08-18-at-3.25.40-PM
        2. Access this by running node restify.js (or what you call it)
        3. Test by going to localhost:8080/hello/*yourname* without the *
      2. Craft SendGrid functionality into a JS file.
        1. Screen-Shot-2016-08-18-at-3.30.36-PM
        2. Combine the files if you so choose. I inserted the whole of this email functionality between the dashes

          res.send('hello ' +;


        3. Make sure to add your sendgrid API Key to the top (the full SG instance that is only created once found via the settings) . Also add some of the necessary requirements for cloudfoundry and bluemix deployment to the top.  (cfenv)
        4.  Modify the port server calling at the bottom of the JS file from a port number to appEnv.port


          1. Specifically appEnv.port should grab the autoassigned port when being deployed to CloudFoundry.
          2. The fields of /hello/:eto/:efrom/:esubject/:ebody correspond to the getrequest in this format localhost:port/hello/**/**/*subject*/*body*
        5. After the fields have been properly created, push the service to Cloud Foundry
        6. In IBM BPM create a javascript file that writes to tw.local.url
          1. tw.local.url = '*topersonemail*/*frompersonemail*/*subject*/*body*/'
          2. Feel free to tie to variables so an example might be
            1. tw.local.url='' + tw.local.emaildestination + '/' + + '/'

        7. Run the IBM BPM Process and an email should be sent!
  4. Additional Capabilities

    To pass additional fields in your get request simply add /:variablename inside the server.get after the last variable inside the single quotes. this additional value is bounded as req.params.variablename

  5. Contact Information

    If you have any questions about this service feel free to contact me at and I'll try my best to help/walkthrough adding the service to IBM BPM

Join The Discussion