User Subscription Use Case
READY
Using Mailchimp with Processmaker I/O
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.
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
- A user sends an subscribe or unsubscribe request with their email and name
- 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
- If the request is unsubscribe, the process is the same as subscribe, but with unsubscribe action parameters
- If the subscription or unsubscribe fails, a message is sent to the Slack channel
Process Scheme
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 | Dear Customer_fName, | |
Notification to user about successful unsubscribe | Mail Unsub Success | Dear Customer_fName, | |
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} |
Getting Started with a Use Case
How to Launch an Instance* of ProcessMaker I/O
*ProcessMaker I/O is designed to be installed in the cloud, so in this document an instance refers to an installation of ProcessMaker in a virtual machine or a container.
If you don't have an instance of ProcessMaker I/O yet, please:
- Go to the Instance page.
- Click Create an Instance and follow the instructions provided.
If you already have an instance of ProcessMaker I/O, please:
- Launch an instance of ProcessMaker I/O on the Instance page.
- Copy/remember the instance URL link; this will be required later.
- Click on the Form examples link.
- Switch to the Mailchimp tab on the top.
- Download BPMN file to your computer.
- Click on Import tab at the top left and upload the BPMN file from your PC.
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"><![CDATA[{"email_address":"{customer_email}","status":"unsubscribed","merge_fields":{"FNAME":"{customer_fname}","LNAME":"{customer_lname}"}}]]>
"action">put
"options"><![CDATA[{"ignore_exception":true}]]>
"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}