A business runs marketing campaigns to promote products with the objective of boosting revenues. The campaigns need to be run on appropriate audiences for maximum impact. A consumer not interested in a product will ignore the campaign offer.
There are two steps to running a marketing campaign:
-
Identifying the target audience - The target audience can be determined by analyzing the purchases and browsing history of customers, social media posts, reviews and other data sources. This will help identify customers who could be interested in a product.
-
Run campaigns(e-mail, sms, phone etc.) on target audience.
In this pattern, the following aspects are covered:
- Identifying the target audience to run a campaign in a certain product category.
- Run an E-mail campaign for the target audience.
The customer demographics and sales data available here is used to demonstrate the above. The sales data includes multiple categories of products. For this pattern, we demonstrate identifying the target audience and running a campaign for Canned Foods.
When the reader has completed this pattern, they will understand how to:
- Create and run a Jupyter notebook in Watson Studio.
- Use Object Storage to access data files.
- Use Python Pandas to derive insights and come up with a target audience based on the customer purchase data.
- Integrate with Watson Campaign Automation to run a campaign on the target audience.
The intended audience for this code pattern are Developers and Data Scientists who want to build an end to end marketing campaign solution for a business.
- The Object storage stores the data.
- Data is utilized as csv files.
- The Jupyter notebook processes the data and generates the target audience.
- The Jupyter notebook is powered by Spark.
- The target audience information is sent to Watson campaign automation(WCA) to run campaigns.
-
IBM Watson Studio: Analyze data using RStudio, Jupyter, and Python in a configured, collaborative environment that includes IBM value-adds, such as managed Spark.
-
IBM Cloud Object Storage: An IBM Cloud service that provides an unstructured cloud data store to build and deliver cost effective apps and services with high reliability and fast speed to market.
-
Watson campaign automation: Smarter marketing automation across all digital channels, powered by Watson.
-
Data Science: Systems and scientific methods to analyze structured and unstructured data in order to extract knowledge and insights.
-
Marketing automation: Software platforms and technologies designed for marketing departments and organizations to more effectively market on multiple channels online (such as email, social media, websites, etc.) and automate repetitive tasks.
Follow these steps to setup and run this developer journey. The steps are described in detail below.
- Sign up for Watson Studio
- Create contacts database in Watson Campaign Automation
- Create campaign contact list in Watson Campaign Automation
- Create campaign mailing template in Watson Campaign Automation
- Configure application access in Watson Campaign Automation
- Create the notebook
- Add the data
- Update the notebook with service credentials
- Update Watson Campaign Automation URLs and credentials in the notebook
- Run the notebook
- Analyze the results
Sign up for IBM's Watson Studio.
Login to the Watson campaign automation instance.
Select Data
and then Databases
. Select Shared
and click Create
.
Configure the database by entering a name wdp_wca_db
. Click on Next
.
Click on Create
to create the database.
Select Data
and then Databases
. Click View
to view the list of databases.
Click on the database wdp_wca_db
.
Note the database id.
Select Data
and then Contact Lists
. Click on Create Contact List
.
Configure the campaign list by selecting the parent database as wdp_wca_db
. Enter a name campaign_canned_food_contact_list
. Click OK
.
Select Data
and then Contact Lists
. Click View
to view the list of contact lists.
Click on the list campaign_canned_food_contact_list
.
Note the contact list id.
Click on Content
. Under Create Mailings
click on Mailing Template
.
Select the Welcome Simple
mailing template.
Click to open the selected mailing template. Click Open
to customize the mailing template.
Click on Select Contacts
and select campaign_canned_food_contact_list
. Click Done
.
Customize the template as shown below and change the name to CannedFoodsCampaignJune2018
. Click on Save
.
Click on Content
. Under View Mailings
click on Templates
.
The list of templates can be seen. Hover the mouse over CannedFoodsCampaignJune2018
and note the template id.
Login to the Watson Campaign Automation instance. Go to Settings
and select Organization Settings
.
Goto Application Account Access
and click Add Application
.
Add an application name customer_insights_wstudio
and click Add
.
Note the client id and client secret. Click Close
.
Click on Add Account Access
.
Select the application customer_insights_wstudio
and click Add
.
A refresh token is sent to the registered email-d. Please note the refresh token.
- In Watson Studio - create a project if necessary, provisioning an object storage service if required.
- Go to
Tools
and selectNotebook
. - Select the
From URL
tab. - Enter a name for the notebook.
- Optionally, enter a description for the notebook.
- Select the project.
- Enter this Notebook URL: https://github.com/IBM/run-campaigns-target-customers/blob/master/notebooks/campaign_management.ipynb
- Select the runtime as shown below.
- Click the
Create
button.
- Please download the file from https://dataplatform.ibm.com/exchange/public/entry/view/f8ccaf607372882403a37d9019b3abf4.
- Rename the file as
customer_orders.csv
- All the email addresses in the file are invalid. For testing the pattern, modify and add valid email address for couple of contacts that get added to Watson Campaign Automation after the notebook execution.
- From your project page in Watson Studio, click
Find and Add Data
(look for the10/01
icon) and itsFiles
tab. - Click
browse
and navigate to where you downloadedcustomer_orders.csv
on your computer. - Add the files to Object storage.
- Select the cell below
2.1 Add your service credentials for Object Storage
section in the notebook to update the credentials for Object Store. - Use
Find and Add Data
(look for the10/01
icon) and itsFiles
tab. You should see the file names uploaded earlier. Make sure your active cell is the empty one created earlier. - Select
Insert to code
belowcustomer_orders.csv
. - Click
Insert Crendentials
from the drop down menu. - If the credentials are written as
credential_2
change them tocredentials_1
.
Replace the <BASE_URL>
with the base url for the Watson Campaign Automation instance.
Add the client id, client secret and refresh token noted in section 5.
Replace the <BASE_URL>
with the base url for the Watson Campaign Automation instance. The <BASE_URL>
specified here can be different from the <BASE_URL>
entered previously for getting access tokens.
Enter the database id , contact list id and template id we noted in sections 2,3 and 4.
When a notebook is executed, what is actually happening is that each code cell in the notebook is executed, in order, from top to bottom.
Each code cell is selectable and is preceded by a tag in the left margin. The tag
format is In [x]:
. Depending on the state of the notebook, the x
can be:
- A
blank
, this indicates that the cell has never been executed. - A
number
, this number represents the relative order this code step was executed. - A
*
, this indicates that the cell is currently executing.
There are several ways to execute the code cells in your notebook:
- One cell at a time.
- Select the cell, and then press the
Play
button in the toolbar.
- Select the cell, and then press the
- Batch mode, in sequential order.
- From the
Cell
menu bar, there are several options available. For example, you canRun All
cells in your notebook, or you canRun All Below
, that will start executing from the first cell under the currently selected cell, and then continue executing all cells that follow.
- From the
- At a scheduled time.
- Press the
Schedule
button located in the top right section of your notebook panel. Here you can schedule your notebook to be executed once at some future time, or repeatedly at your specified interval.
- Press the
For this Notebook, you can simply Run All
cells.
Once the notebook execution is complete, an email is sent to all the contacts in the contact list campaign_canned_food_contact_list
.
This code pattern is licensed under the Apache Software License, Version 2. Separate third party code objects invoked within this code pattern are licensed by their respective providers pursuant to their own separate licenses. Contributions are subject to the Developer Certificate of Origin, Version 1.1 (DCO) and the Apache Software License, Version 2.