# WhatsApp Campaigns
## Pre-requisites for setting up WhatsApp campaigns
1. You need to have Whatsapp channel configured with a business number.
2. Ensure you add whitelisted templates (approved templates) in the templates module.
> **Note**: You can also create "New template" from campaign creation window as well.
## Create WhatsApp campaign
1. Navigate to your project and go to **Engage** module.

1. On the top-right of the overview screen, click **+ Create Campaign**.

3. Provide **Basic information**
i. Enter a suitable **Campaign name** that resonates well with the purpose of the campaign.
ii. Select **Whatsapp** in active channels.
iii. Click **Next**.

4. Select your **Message template**.
i. Select the message template that you want to send using the radio button.
To view the message content, click on the template name as shown in the following.

ii. Choose your preferred **Sender ID** using the drop-down.
iii. Choose the field that contains users contact or number where they can receive the campaign.
iv. In **Map Variables**, use **Click to map** to
v. Select the **Media** type of the message.
* Static:
* Dynamic:
vi. Click **Next** to continue.

> **Note**:
The user contact details/ recipient column and other others can be selected from user data which you can upload/maintain in Yellow.ai User module.`
> **Tip**:
> In case you want to switch to User module to add audience, you can save the campaign as draft and continue later.
5. Select your **Target Audience**.
You can either choose audience from the list of segments that you already created [OR]
i. Create a new segment using **+ Add new segment**. For more details, see [Users module and segment creation](https://docs.yellow.ai/docs/platform_concepts/engagement/outbound/cdp/overview).
ii. Click **Next** to continue to Schedule.
#### Segments
* Segments are grouping of users based on certain condition sets. Segmentation can be based on city, tags, names, or any another user property.
* You can add multiple condition sets as required.
* In the below example, a segment is created with users whose country is mentioned as "india" from the User module.

* Once the segment is created, you can see the number of users under the segment.


* Select your segment and proceed by clicking on "next".
6. **Schedule** your Campaign: Define when to send the campaign (Timezone: Asia/Kolkata).

i. Set **How many times you want to run the campaign?**: Choose whether to run the campiagn only once or on a recurring basis.
* **Option 1 : Run once**
- Select **Now** to run after 10 min once you schedule the campaign.
- Select **Later** to send out the campaign message on a specific date and time. Use the Calendar box to set your preferred date and time.
* **Option 2 : Run multiple times**
Select the frequency and number of occurences using the available options.
i. Choose the frequency (Daily, Weekly, or Monthly) in **Repeat**
ii. Set at **Time** when you want to send out the message.
iii. Select when you want to end the campaign.
| Option | Description |
| -------- | -------- |
| never | To run the campaign for ever |
| on | To end on a specific date and set the desired date and time. |
| after | to end after n number of occurances and configure the respective options

* Honor **Business hours**: Using this you can honor DND timings, so that you can prevent users from receiving campaigns during specific periods, such as when they may be asleep, and so on.
Click on **Add business hours** and configure the business hours at which the campaign message should trigger. Post the business hours the messages can be handled as below.

#### Message handling during DND hours
* Discrad the message - The message will not be sent and will be marked failed.
* Postpone to next day - The campaign will be paused and will resume the next business hours.

### Step 5: Review and Launch
* Hooray..!! You have reached the final step and all set to launch the campaigns.
* You can review all the campaign details at once from this page and go back to previous steps in case of any changes you want to make.

* You can proceed till this step and "save ad draft" to resume anytime.
* If all the details are good to go and reviewed from your end, you can click on "Launch Campaign" to schedule the campaigns.
* As soon as you click on "Launch Campaign" you will be redirected to Campaigns overview page where you can monitor the campaigns.
### Test Campaigns (Recommended)
Make sure your campaign notifications are flawless by testing it with internal team members!!
While this is an optional step, we recommend that you test all campaigns that contain images, buttons, deep links, and elements of personalisation in the message to ensure that everything's in order.
#### How does it help?
* Prevents sending wrong content to the customers
* Enables viewing the notifications messages from end-user experience
* Makes sure variables are mapped to the right user properties
* Reduces campaign failures due to parameters mismatch or images size issues
#### Where do I get this option?
* While creating outbound campaigns, at final step "Review and Launch" you can review the content of the notifications once and click on "Test Campaign" from bottom right.
* Step by Step guidance to run test campaigns
* Prerequisites for adding test user details
* Test users data should be available in Users module
* Make sure the test users has all the data which will be mapped as variables in notification templates
* Doing so will enable viewing a user preview of the message with all the personalised data.
#### Steps to test your campaign
1 Login to cloud.yellow.ai and navigate to outbound notifications

###### Step-2: Create campaigns and proceed till "review and launch" step. Click on "Test campaign" button
**`Note: Test campaign is supported for all channel campaigns`**

###### Step-3: Search test users
* A wizard will be opened to add test user details.
* You can search users by name, email, phone number or userID.
`For example, type any name and available users will be suggested in dropdown.`

###### Step-4: Add test users
* Click on relevant user to populate all values like recepient ID and other paramters if any.
* You can check whether all the parameters are mapped correctly to the desired user columns.
* Here you can ensure that all the values are available for the user. If not, then you can search an alternate user to personalise the message.

* You can add up to 5 test users at a time. Click on "+Add Users" to search and add multiple users.

###### Step-5: Send Test Messages
* Once all the data is cross verified, you can click on "send test campaign" to trigger notifications to recipient IDs added.

* This screen will be frozen for 15 seconds to update the sent status of messages.
* In case of any data mismatch you can save the campaign by clicking "save as draft", navigate to templates step, correct your mappings.
* You can use "Test Campaign" option more than once.
**Note**:
```
After the Test Message has been sent, you will see that it is in "sending" state. After some time you will be able to see the delivery status of the test message as Delivered or Failed.**
If the Test Message has Failed to deliver, then you will be able to see the reason for failure.
```
###### Step-6: Check message sent status
* Click on "Test Campaign" will give you sent status of last test users and you can click on "Send new test campaign" to add new test users.
* Once the notification is good to go, you can launch the campaign anytime.
