Video Walk through of this Tutorial

If you would like to see this User Subscription Use Case via MailChimp service in action, click this video below.

General Description

This example shows the user how to use ProcessMaker I/O in combination with MailChimp and Slack. Both software programs provide the tools that allow the user to build effective processes while satisfying a variety of business needs.

Getting Started with a Use Case

How to Launch an Environment* of ProcessMaker I/O

*ProcessMaker I/O is designed to be installed in the cloud, so in this document an environment refers to an installation of ProcessMaker I/O in a virtual machine or a container.

If you don't have an Environment of ProcessMaker I/O yet, please:

  1. Go to the Environment page.
  2. Click Create an Environment and follow the instructions provided.

If you already have an Environment of ProcessMaker I/O, please:

  1. Launch an Environment of ProcessMaker I/O on the Environment page.
  2. Copy/remember the Environment URL link; this will be required later as your-environment-url, (as example "your-environment-url" is "MYENVIRONMENT.api.processmaker.io", where "MYENVIRONMENT" is your "Processmaker I/O environment name")
  3. Choose the Mailchimp [Use Case] (https://portal.processmaker.io/dash/examples/mailchimp).
  4. Switch to the Mailchimp tab on the left menu.
  5. Download Mailchimp BPMN file.bpmn on your computer BPMN file to your computer.
  6. Click the Processes tab.
  7. Click the Upload Process Scheme button.
  8. Click the Choose File button.
  9. Click the Import button to upload the revised BPMN file from your computer to your Environment.

How to Set Up a Slack App

  • Create a Slack app
    • Go to https://api.slack.com/apps and click Create New App.
    • Fill in the App Name field.
    • Choose the Development Slack Team.
    • Click on Create App.
  • Install the app to your team
  • Get the Slack app Oauth access token
    • When your Slack app is created and installed to your team, get a Slack bot token via the Oauth & Permissions tab, accessed under Features in the left menu.
    • In the Oauth Tokens & Redirect URLs section, click on Copy in the Bot User OAuth Access Token field to copy the Slack bot token to your clipboard (token starts with 'xoxb' string).
    • This token should be passed to the process start event, as shown later

How to Set Up MailChimp

  • To set up the MailChimp connector, you'll need the MailChimp API key. Getting the key is explained in the following guide: http://kb.mailchimp.com/integrations/api-integrations/about-api-keys.
  • To subscribe users to the list, you need the list ID. Log into your MailChimp account and navigate to your lists. Click on the required list and go to its Settings → List name and Defaults page. There you will find List ID (e.g. 47294ece32).

Running the Process

  • To run the process, first import the BPMN file containing the corresponding process to your PMIO instance (this is explained in the Readme section for the specific example case).

  • To initiate the (un)subscription, you can trigger the start event via any means. This might be the TriggerEvent PMIO API call, or the WebHook call for Start Events. Please refer to the API documentation section and API SDK for your desired programming language. Here are the WebHook variables to pass:

  • 'action' => {subscribe} or {unsubscribe} string,

'list_id' => {your_list_id}, 'customer_email' => {email}, 'email_md5' => md5({email}), 'customer_fname' => {John}, 'customer_lname' => {Doe}, 'slack_token' => {slackToken}, 'slack_channel' => {slackChannel_name}, 'mailchimp_api_key' => {mailChimpKey}

Substitute in the necessary values, which are marked by brackets.

Connectors:

Slack\ APIConnector
This connector implements notifications between your process and the Slack Web API.
Input Parameters:

"api_url">https://slack.com/api/chat.postMessage
"text"><![CDATA[message_text]>
"token">{slack_token}
"channel">{slack_channel}

Mailchimp\SendMailChimp
This connector implements subscription actions with the MailChimp service.
Input Parameters:

"arguments"> "action">put
"options"> "method">lists/{list_id}/members/{email_md5}
"api_key">{mailchimp_api_key}

Output Parameters:

"subscription_data">{response_body}
"subscription_error">{last_error}
"subscription_successful">{result_successful}

Subscription Use Case

This example covers subscribe and unsubscribe user requests, taking the appropriate actions in MailChimp and sending notifications with Slack bot and email.

Process Description

  1. A user sends a subscribe or unsubscribe request with their email and name
  2. If the request is subscribe, the process runs MailChimp, subscribes the new user, sends a notification to the Slack channel that the new user subscribed to, and sends a confirmation email to the user
  3. If the request is unsubscribe, the process is the same as subscribe, but with unsubscribe action parameters
  4. If the subscription or unsubscribe fails, a message is sent to the Slack channel

Process Scheme

Alt text here

Download BPMN file

Download Mailchimp BPMN file

Process Items

The tasks in the process are listed in the table below:

Task Type Connector Description
Subscription Request Start Event Starts the Subscription process
MailChimp Subscribe / MailChimp Unsubscribe Service Task Mailchimp / SendMailChimp This technical task runs a MailChimp connector, sends the argument "Subscribe" or "Unsubscribe", and gets a confirmation from MailChimp about the action
Slack Subscription Success/Slack Unsub Success Service Task Slack/APIConnector This sends a notification to the Slack channel about a successful subscription/unsubscribe
Slack Subscription Failure/ Slack Unsub Failure Service Task Slack/APIConnector This sends a notification to the Slack channel about failed subscription/unsubscribe
Mail Success/Mail Unsub Success Service Task SendMailConnector This sends a notification to the user about a successful subscription/unsubscribe

Messages

All messages will take place in Slack. There will be NO email messages, as that defeats the purpose of Slack. Therefore, all messages will be in the form of formatted WebHook messages in either a channel or a private message between the ProcessMaker Bot and the user.

Message Title Task Location Content
Notification to user about successful subscription Mail Success E-mail Dear Customer_fName,
This is an email to confirm your subscription to our mailing list
Notification to user about successful unsubscribe Mail Unsub Success E-mail Dear Customer_fName,
This is email to confirm that you have unsubscribed from our mailing list
Notification to Slack channel about successful subscription Slack Subscription Success Slack channel A new subscription has been completed for {customer_fname} {customer_lname} <{customer_email}>
Notification to Slack channel about successful unsubscribe Slack Unsub Success Slack channel {customer_fname} {customer_lname} <{customer_email}> unsubscribed successfully
Notification to Slack channel about subscription failure Slack Subscription Failure Slack channel A new subscription for {customer_fname} {customer_lname} <{customer_email}> resulted in failure: {subscription_error}
Notification to Slack channel about unsubscribe failure Slack Unsub Failure Slack channel An unsubscribe for {customer_fname} {customer_lname} <{customer_email}> resulted in failure: {subscription_error}