| @@ -7,324 +7,131 @@ | ||
| 7 | 7 | |
| 8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | 9 | exit; |
| 10 | 10 | } |
| 11 | -$disclaimer = get_option(NOTIFIER_PREFIX . 'disclaimer'); | |
| 12 | -$verify_token = get_option(NOTIFIER_PREFIX . 'verify_token'); | |
| 13 | -$api_credentials_validated = get_option(NOTIFIER_PREFIX . 'api_credentials_validated'); | |
| 14 | -$show_disclaimer = ( isset($_GET['show']) && $_GET['show'] == 'disclaimer' ) ? true : false; | |
| 15 | -$phone_number_id = get_option( NOTIFIER_PREFIX . 'phone_number_id' ); | |
| 16 | -$phone_number_details = get_option( NOTIFIER_PREFIX . 'phone_number_details'); | |
| 11 | +$api_key = get_option(NOTIFIER_PREFIX . 'api_key'); | |
| 17 | 12 | ?> |
| 18 | 13 | <div class="wrap notifier"> |
| 19 | - | |
| 20 | - <h1>Dashboard</h1> | |
| 21 | - | |
| 22 | 14 | <div class="notifier-wrapper"> |
| 23 | - | |
| 24 | - <?php if ('accepted' != $disclaimer || $show_disclaimer) : ?> | |
| 25 | - | |
| 26 | - <div class="onboarding"> | |
| 27 | - <div class="onboarding-head"> | |
| 28 | - <h3>!!! [IMPORTANT DISCLAIMER] DO NOT SKIP WITHOUT READING !!!</h3> | |
| 29 | - <p>Please read and accept the following 3 points before you start using this plugin.</p> | |
| 30 | - </div> | |
| 31 | - <div class="onboarding-body"> | |
| 32 | - <div class="onboarding-disclaimer"> | |
| 33 | - <h4>1. PHONE NUMBER WILL RESTRICTION</h4> | |
| 34 | - <p>This plugin uses WhatsApp's official <a href="https://developers.facebook.com/docs/whatsapp/cloud-api/overview" target="_blank">Cloud API</a> to send notifications from your WordPress backend. In order to use the API, you need to register your phone number with them to be able to send notifications.</p> | |
| 35 | - <p>Once the phone number is setup in their app to use with this plugin, you will <b>not be able to use the number</b> on the <a href="https://business.whatsapp.com/products/business-app" target="_blank">WhastApp Business mobile app</a>.</p> | |
| 36 | - <p>If you want to use your phone number that you were earlier using on the WhatsApp phone app, WhatsApp <a href="https://developers.facebook.com/docs/whatsapp/phone-numbers" target="_blank">requires you</a> to <b>delete that account from phone</b> (along with it's message history) to be able to use it via the API.</p> | |
| 37 | - <p>If you're using a different number that's not used in the mobile app or if you're okay to delete the phone app account, you can proceed with using this plugin.</p> | |
| 38 | - <hr /> | |
| 39 | - <h4>2. ONE-WAY COMMUNICATION ONLY</h4> | |
| 40 | - <p>Note that this plugin currently allows only <b>one-way communication</b>, that is, you can only <b>send notifications</b> on WhatsApp but <b>can not receive / read replies</b>.</p> | |
| 41 | - <p>If you want to use your phone number for two-way communication with your customers, we suggest using their mobile app. But if you're okay with the one-way communication restriction, you can proceed with using this plugin.</p> | |
| 42 | - <p>Note that we have plans to introduce <b>full-fledged WhatsApp inbox system</b> with this plugin that'll allow you <b>two-way communication</b> from WordPress dashbaord. But that'll take time to launch so be thoughtful about the phone number that you use with this plugin.</p> | |
| 43 | - <hr /> | |
| 44 | - <h4>3. METERED BILLING BY WHATSAPP</h4> | |
| 45 | - <p>Notifications you send from the app are <a href="https://developers.facebook.com/docs/whatsapp/pricing" target="_blank">metered by WhatsApp</a>. <b>First 1000 messages per month are <em>free</em></b> to send but you're charged for the messages you send post that. The billing is handled by WhatsApp on their site and not by this plugin.</p> | |
| 46 | - <hr /> | |
| 47 | - <p>If you understand and accept these points, click on button below to get started.</p> | |
| 48 | - </div> | |
| 49 | - </div> | |
| 50 | - <div class="onboarding-footer"> | |
| 51 | - <?php if ('accepted' != $disclaimer) : ?> | |
| 52 | - <form method="POST" action="" enctype="multipart/form-data"> | |
| 53 | - <button name="disclaimer" class="button-primary" type="submit" value="">I Understand & Accept</button> | |
| 54 | - <?php wp_nonce_field( NOTIFIER_NAME . '-disclaimer' ); ?> | |
| 55 | - </form> | |
| 56 | - <?php else : ?> | |
| 57 | - <button class="button" disabled="disabled">Already accepted</button> | |
| 58 | - <a class="button-primary" href="admin.php?page=notifier">Back to Dashboard</a> | |
| 59 | - <?php endif; ?> | |
| 60 | - </div> | |
| 61 | - </div> | |
| 62 | - | |
| 63 | - <?php elseif (!$api_credentials_validated) : ?> | |
| 64 | - | |
| 65 | - <div class="onboarding"> | |
| 66 | - <div class="onboarding-head"> | |
| 67 | - <h3>Let's Configure The Plugin!</h3> | |
| 68 | - <p>Follow the steps below to configure the plugin to start sending WhatsApp notifications. Estimated time: 8 to 10 minutes.</p> | |
| 69 | - </div> | |
| 70 | - <div class="onboarding-body"> | |
| 71 | - <div class="step active"> | |
| 72 | - <div class="step-head"> | |
| 73 | - <div class="step-title text-uppercase"><b>Step 1: Create Meta account and an app for WhastApp Cloud API</b></div> | |
| 74 | - <button class="toggle-step"></button> | |
| 15 | + <?php if (!Notifier::is_api_active()) : ?> | |
| 16 | + <div class="dashboard-boxes"> | |
| 17 | + <div class="col w-70"> | |
| 18 | + <div class="dashboard-box"> | |
| 19 | + <div class="dashboard-box-head"> | |
| 20 | + <h3>Let's get started 🚀</h3> | |
| 75 | 21 | </div> |
| 76 | - <div class="step-body"> | |
| 22 | + <div class="dashboard-box-body"> | |
| 23 | + <p><a href="https://wanotifier.com/" target="_blank">WANotifier</a> is a free SaaS tool that allows you to send bulk WhatsApp marketing and transactional messages to your customers using the <b>WhatsApp's official Cloud API</b>.</p> | |
| 24 | + <p>This plugin is an <b>extension to our SaaS platform</b> that allows you to <b>trigger WhatsApp message notifications</b> from your WordPress website. To use this plugin you'll need to <b>create an account with us</b> and connect it with this plugin.</p> | |
| 25 | + <p>Following are the instructions to do the setup.</p> | |
| 77 | 26 | <ol> |
| 78 | - <li>Create a free <a href="https://developers.facebook.com/async/registration/" target="_blank">Meta developer account</a>, if you don't already have one.</li> | |
| 79 | - <li>Login to the Meta developer portal and click on <a href="https://developers.facebook.com/apps/create/" target="_blank">Create App</a> button to create a new app.</li> | |
| 80 | - <li>On this page, select the <b>Business</b> option and click on the <b>Next</b> button at the bottom.</li> | |
| 81 | - <li>On the next <b>Provide basic information</b> page, fill in the details and click on <b>Create App</b> when done.</li> | |
| 82 | - <li>This will redirect you to app page where you need to <b>Add products to your app</b>. Scroll to the bottom to find "WhatsApp" product and click <b>Set up</b>.</li> | |
| 83 | - <li>Next, you will see the option to select an existing Business Manager (if you have one) or, if you would like, the onboarding process will create one automatically for you (you can customize your business later, if needed). Make a selection and click <b>Continue</b>.</li> | |
| 84 | - <li>You will be redirected to the <b>Get Started</b> page.</li> | |
| 27 | + <li>Create a <b>FREE</b> <a href="https://app.wanotifier.com/create-account/" target="_blank">WANotifier</a> account.</li> | |
| 28 | + <li>Go through the on-boarding steps to setup your phone number with our tool and <b>WhatsApp API</b>.</li> | |
| 29 | + <li>After setup is done, you'll land on the <b>Dashboard</b> page. From there, go to the <a href="https://app.wanotifier.com/settings/api/" target="_blank">Settings > API</a> page and scroll to the bottom to get your <b>WANotifier.com API Key</b>.</li> | |
| 30 | + <li>Copy and paste that key in the text box below and click on <b>Save and Validate</b> to continue.</li> | |
| 85 | 31 | </ol> |
| 32 | + <hr> | |
| 33 | + <p><b>Need help?</b> Just <a href="https://wanotifier.com/support/" target="_blank">get in touch</a> with us and we'll help you setup your account and this plugin for FREE.</p> | |
| 34 | + <hr style="margin-bottom: 20px;"> | |
| 35 | + <form method="POST" action="" enctype="multipart/form-data"> | |
| 36 | + <input type="text" name="notifier_api_key" id="wa-notifier-api-key" placeholder="Enter your API key here" value="<?php echo esc_attr($api_key); ?>" /> | |
| 37 | + <button name="webhook_validation" class="button-primary" type="submit" value="">Submit and validate</button> | |
| 38 | + <?php wp_nonce_field( NOTIFIER_NAME . '-webhook-validation' ); ?> | |
| 39 | + </form> | |
| 86 | 40 | </div> |
| 87 | 41 | </div> |
| 88 | - <div class="step"> | |
| 89 | - <div class="step-head"> | |
| 90 | - <div class="step-title text-uppercase"><b>Step 2: Setup your phone number in WhastApp Cloud API</b></div> | |
| 91 | - <button class="toggle-step"></button> | |
| 42 | + </div> | |
| 43 | + <div class="col w-30"> | |
| 44 | + <div class="dashboard-box"> | |
| 45 | + <div class="dashboard-box-head"> | |
| 46 | + <h3>Customer testimonials ❤️</h3> | |
| 92 | 47 | </div> |
| 93 | - <div class="step-body"> | |
| 94 | - <ol> | |
| 95 | - <li>Scroll down on the <b>Get Started</b> screen and click on <b>Add phone number</b> button.</li> | |
| 96 | - <li>Fill in your business information and click <b>Next</b>.</li> | |
| 97 | - <li>On the next screen, you'll be prompted to create a WhatsApp Business profile. Enter the details and click <b>Next</b>.</li> | |
| 98 | - <li>Next, you'll need to add your phone number. Enter your phone number and select a verification method to verify the number.</li> | |
| 99 | - <li>Enter the verfication code and click <b>Next</b>.</li> | |
| 100 | - <li>Once the phone number is added, scroll up on the <b>Get Started</b> page and select your added number from the dropdown under <b>Send and receive messages</b>.</li> | |
| 101 | - <li>After selecting your phone number the <b>Phone number ID</b> and <b>WhatsApp Business Account ID</b> values will get updated below it. Copy those values and add them on the <a href="<?php echo esc_url( get_admin_url( null, 'admin.php?page=' . NOTIFIER_NAME . '-settings') ); ?>" target="_blank">Settings</a> page.</li> | |
| 102 | - <li>Do not save the page, just keep it open. We'll add <b>Permanent Access Token</b> in the next step.</li> | |
| 103 | - </ol> | |
| 48 | + <div class="dashboard-box-body"> | |
| 49 | + ⭐⭐⭐⭐⭐ | |
| 50 | + <em><p>I have been <strong>using WANotifier for the past 1 month</strong> for my eCommerce store. I am able to add/import/manage contacts, create message templates, segment users, connect with third party APIs, reply to messages all within the same dashboard. The UI is <strong>simple and friendly</strong>. The instructions are clear. <strong>Definitely recommended</strong>!</p></em> | |
| 51 | + <p><strong>Gopi Kanna</strong><br> | |
| 52 | + Co-founder, DomainCoasters.com</p> | |
| 53 | + <hr> | |
| 54 | + ⭐⭐⭐⭐⭐ | |
| 55 | + <em><p>We have been using WANotifier for past two months. <strong>Nice product</strong>! A quick and automated response brings in a feeling of completeness to online purchase experience for our customers. We have processed multiple orders after installing this utility and <strong>it just works perfectly every time</strong>.</p></em> | |
| 56 | + <p><strong>Avinash Pendse</strong> | |
| 57 | + <br>Founder, GrahakShahi.com</p> | |
| 58 | + <hr> | |
| 59 | + ⭐⭐⭐⭐⭐ | |
| 60 | + <em><p>Very good plugin for <b>WhatsApp Woocommerce integration for free</b>. Easily work without any issues. Simple to use.Tutorials also found on YouTube. Thanks to the WANotifier team.</p></em> | |
| 61 | + <strong>hashimsamnan</strong> | |
| 62 | + <br>Woocommerce user | |
| 104 | 63 | </div> |
| 105 | 64 | </div> |
| 106 | - <div class="step"> | |
| 107 | - <div class="step-head"> | |
| 108 | - <div class="step-title text-uppercase"><b>Step 3: Configure webhook and permanent token</b></div> | |
| 109 | - <button class="toggle-step"></button> | |
| 110 | - </div> | |
| 111 | - <div class="step-body"> | |
| 112 | - <p>In this step, we'll setup the Webhook and Permanent Token.</p> | |
| 113 | - <b>Webhook:</b> | |
| 114 | - <ol> | |
| 115 | - <li>From the <b>Get Started</b> screen's left sidebar, click on <b>Whatsapp > Configuration</b> link.</li> | |
| 116 | - <li>Click on the <b>Edit</b> button. That'll open a popup.</li> | |
| 117 | - <li>Enter the following in the <b>Callback URL</b> field: <code><?php echo esc_url (site_url('/?notifier') ); ?></code>. Note that if you have any kind of firewall set on your website the verification will fail.</li> | |
| 118 | - <li>In the <b>Verify Token</b> field enter: <code><?php echo esc_html($verify_token); ?></code> and click <b>Verify</b>.</li> | |
| 119 | - <li>Under <b>Webhook fields:</b> click on <b>Manage</b>.</li> | |
| 120 | - <li>Click on <b>Subscribe</b> button in front of all fields and then click on <b>Done</b>.</li> | |
| 121 | - </ol> | |
| 122 | - | |
| 123 | - <b>Permanent Token:</b> | |
| 124 | - <ol> | |
| 125 | - <li><a href="https://business.facebook.com/settings" target="_blank">Click here</a> to open <b>Business Settings</b> for your <b>Business Manager</b> account and select your account.</li> | |
| 126 | - <li>Under <b>Users</b> in left sidebar, click on <b>System users</b>. Click on <b>Add</b> to add a new user.</li> | |
| 127 | - <li>Click on <b>I Accept</b> button if you see non-discrimation policy popup.</li> | |
| 128 | - <li>Enter a name for your <b>System user name</b> (you can keep it admin or system, this will not be shown to your users). Select <b>System user role</b> as <b>Administrator</b> and click on <b>Create system user</b>.</li> | |
| 129 | - <li>Click on <b>Add Assets</b> button. Under <b>Select asset type</b> click on <b>Apps</b>, select your app from <b>Select assets</b> column and then enable <b>Full control > Manage App</b>. Click on <b>Save Changes</b>.</li> | |
| 130 | - <li>Now click on <b>Generate Token</b> button. Select your app from the dropdown and click on <b>Generate Token</b>. From the list of permissions under <b>Available Permissions:</b> select <em>whatsapp_business_messaging</em> and <em>whatsapp_business_management</em> and then click on <b>Generate Token</b>.</li> | |
| 131 | - <li>Copy the <b>Access token</b>. Open this plugin's <a href="<?php echo esc_url(get_admin_url( null, 'admin.php?page=' . NOTIFIER_NAME . '-settings&tab=api') ); ?>" target="_blank">Settings</a> page, add it in the <b>Permanent Access Token</b> field and save.</li> | |
| 132 | - </ol> | |
| 133 | - | |
| 134 | - </div> | |
| 135 | - </div> | |
| 136 | - <div class="step"> | |
| 137 | - <div class="step-head"> | |
| 138 | - <div class="step-title text-uppercase"><b>Step 4: Validate and complete</b></div> | |
| 139 | - <button class="toggle-step"></button> | |
| 140 | - </div> | |
| 141 | - <div class="step-body"> | |
| 142 | - <p>After you've completed the steps above and added the <b>WhastApp Phone Number ID</b>, <b>WhastApp Business Account ID</b> and the <b>Permanent Access Token</b>, click on the link below to validate.</p> | |
| 143 | - <p>Once you click the button below, the plugin will connect to your account via Cloud API to validate the details. Once validated, it'll create draft <b>Message Templates</b> for you to start sending notifications.</p> | |
| 144 | - <form method="POST" action="" enctype="multipart/form-data"> | |
| 145 | - <button name="validate" class="button-primary" type="submit" value="">Validate and Complete Setup</button> | |
| 146 | - <?php wp_nonce_field( NOTIFIER_NAME . '-validate' ); ?> | |
| 147 | - </form> | |
| 148 | - </div> | |
| 149 | - </div> | |
| 150 | 65 | </div> |
| 151 | 66 | </div> |
| 152 | - | |
| 153 | - <?php else : ?> | |
| 67 | + <?php | |
| 68 | + else : | |
| 69 | + $available_triggers = Notifier_Notification_Triggers::get_notification_triggers(); | |
| 70 | + $enabled_triggers = get_option('notifier_enabled_triggers'); | |
| 71 | + $enabled_triggers = (!empty($enabled_triggers)) ? $enabled_triggers : array(); | |
| 72 | + ?> | |
| 154 | 73 | <div class="dashboard-boxes"> |
| 155 | - <div class="col w-100"> | |
| 156 | - <div class="dashboard-box dashboard-box-top"> | |
| 157 | - <div class="dashboard-box-body d-flex w-100"> | |
| 158 | - <div class="w-25"> | |
| 159 | - <b>Phone Number:</b> | |
| 160 | - <?php echo esc_html($phone_number_details[$phone_number_id]['display_num']); ?> | |
| 161 | - </div> | |
| 162 | - <div class="w-25"> | |
| 163 | - <b>Display Name:</b> | |
| 164 | - <?php echo esc_html($phone_number_details[$phone_number_id]['display_name']); ?> | |
| 165 | - </div> | |
| 166 | - <div class="w-25"> | |
| 167 | - <b>Status:</b> | |
| 168 | - <?php echo esc_html($phone_number_details[$phone_number_id]['phone_num_status']); ?> | |
| 169 | - </div> | |
| 170 | - <div class="w-25"> | |
| 171 | - <b>Qaulity Rating:</b> | |
| 172 | - <span class="quantity-rating quantity-rating-<?php echo esc_attr( strtolower($phone_number_details[$phone_number_id]['quality_rating']) ); ?>"></span> | |
| 173 | - </div> | |
| 74 | + <div class="col w-70"> | |
| 75 | + <div class="dashboard-box"> | |
| 76 | + <div class="dashboard-box-head"> | |
| 77 | + <h3>How to use this plugin? 🤔</h3> | |
| 174 | 78 | </div> |
| 79 | + <div class="dashboard-box-body how-to"> | |
| 80 | + <img class="notifier-overview-image" src="<?php echo NOTIFIER_URL; ?>assets/images/notifier-plugin-overview.svg"> | |
| 81 | + <p>Follow the instructions below to setup your <b>Triggers</b> that'll fire WhatsApp notification messages:</p> | |
| 82 | + <p><b>STEP 1 - Create a Trigger on this site</b></p> | |
| 83 | + <ul> | |
| 84 | + <li><a href="<?php echo admin_url('post-new.php?post_type=wa_notifier_trigger'); ?>" target="_blank">Click here</a> to add a new Trigger.</li> | |
| 85 | + <li>Select a <b>Trigger</b> from the dropdown when you want the notification to be fired.</li> | |
| 86 | + <li>Enable the <b>Data fields</b> and <b>Recipient fields</b> that you want to send to WANotifier when notification is fired.</li> | |
| 87 | + <li>Then save this trigger and <b>Enable</b> it.</li> | |
| 88 | + </ul> | |
| 89 | + <p><b>STEP 2 - Create a Message Template on WANotifier</b></p> | |
| 90 | + <ul> | |
| 91 | + <li>Now go to the WANotifier portal and <a href="https://app.wanotifier.com/templates/add/" target="_blank">create a new Message Template</a>. </li> | |
| 92 | + <li>You can either keep the template simple or add variable placeholders like <code>{{1}}</code>, <code>{{2}}</code> and so on. We will map these variables with <b>Data fields</b> in the next step below.</li> | |
| 93 | + </ul> | |
| 94 | + <p><b>STEP 3 - Create a Notification on WANotifier</b></p> | |
| 95 | + <ul> | |
| 96 | + <li>Now <a href="https://app.wanotifier.com/notifications/add/" target="_blank">create a new Notification</a> and select <b>Notification Type</b> as <b>Transactional</b>.</li> | |
| 97 | + <li>Then from the <b>Trigger</b> dropdown, select the trigger that you created in Step 1.</li> | |
| 98 | + <li>Add <b>Recipients</b> to whom you want to send this notification. Select the <b>Recipient fields</b> that you enabled above or select custom contacts.</li> | |
| 99 | + <li>Select the <b>Message Template</b> you created in Step 2.</li> | |
| 100 | + <li>If you created this message template with variables (<code>{{1}}</code>, <code>{{2}}</code> and so on), you will see option to map these variables with the <b>Data fields</b> you enabled during Step 1.</li> | |
| 101 | + <li>Click on the <b>Save</b> button to save this notification.</li> | |
| 102 | + </ul> | |
| 103 | + <p>That's it. Your notification will be sent each time it gets triggered from this website!</p> | |
| 104 | + <p><em><b>Disclaimer:</b> By enabling the triggers you accept and agree that the associated data and recipient fields will be sent to our server for use with the message template when sending notifications. We do not store any data other than what is required for sending a notification.</em></p> | |
| 105 | + </div> | |
| 175 | 106 | </div> |
| 176 | 107 | </div> |
| 177 | - <?php | |
| 178 | - $message_templates = get_posts( | |
| 179 | - array ( | |
| 180 | - 'post_type' => 'wa_message_template', | |
| 181 | - 'post_status' => 'publish', | |
| 182 | - 'numberposts' => 5, | |
| 183 | - ) | |
| 184 | - ); | |
| 185 | - $message_templates_count = count($message_templates); | |
| 186 | - | |
| 187 | - $contacts = get_posts( | |
| 188 | - array ( | |
| 189 | - 'post_type' => 'wa_contact', | |
| 190 | - 'post_status' => 'publish', | |
| 191 | - 'numberposts' => 5, | |
| 192 | - ) | |
| 193 | - ); | |
| 194 | - $contacts_count = count($contacts); | |
| 195 | - | |
| 196 | - $notifications = get_posts( | |
| 197 | - array ( | |
| 198 | - 'post_type' => 'wa_notification', | |
| 199 | - 'post_status' => 'publish', | |
| 200 | - 'numberposts' => 5, | |
| 201 | - ) | |
| 202 | - ); | |
| 203 | - $notifications_count = count($notifications); | |
| 204 | - ?> | |
| 205 | - <?php if ($message_templates_count == 0 || $contacts_count == 0 || $notifications_count == 0) : ?> | |
| 206 | - <div class="col w-33"> | |
| 207 | - <div class="dashboard-box"> | |
| 208 | - <div class="dashboard-box-head"> | |
| 209 | - <h2>You're all set! Here are the next steps...</h2> | |
| 210 | - </div> | |
| 211 | - <div class="dashboard-box-body"> | |
| 212 | - <p> | |
| 213 | - <span class="dashicons <?php echo ($message_templates_count == 0) ? 'dashicons-marker' : 'dashicons-yes-alt'; ?>"> </span> | |
| 214 | - <b>STEP 1</b> - Create your first <a href="<?php echo esc_url(admin_url( 'edit.php?post_type=wa_message_template' )); ?>" target="_blank">Message Template</a>. | |
| 215 | - </p> | |
| 216 | - <p> | |
| 217 | - <span class="dashicons <?php echo ($contacts_count == 0) ? 'dashicons-marker' : 'dashicons-yes-alt'; ?>"> </span> | |
| 218 | - <b>STEP 2</b> - Add / import <a href="<?php echo esc_url(admin_url( 'edit.php?post_type=wa_contact' )); ?>" target="_blank">Contacts</a>. | |
| 219 | - </p> | |
| 220 | - <p> | |
| 221 | - <span class="dashicons <?php echo ($notifications_count == 0) ? 'dashicons-marker' : 'dashicons-yes-alt'; ?>"> </span> | |
| 222 | - <b>STEP 3</b> - Create and send your first <a href="<?php echo esc_url( admin_url( 'edit.php?post_type=wa_notification' ) ); ?>" target="_blank">Notification</a>. | |
| 223 | - </p> | |
| 224 | - </div> | |
| 108 | + <div class="col w-30"> | |
| 109 | + <div class="dashboard-box"> | |
| 110 | + <div class="dashboard-box-head"> | |
| 111 | + <h3>Want more control? 💪</h3> | |
| 225 | 112 | </div> |
| 226 | - </div> | |
| 227 | - <?php endif; ?> | |
| 228 | - <?php if ($message_templates_count > 0) : ?> | |
| 229 | - <div class="col w-33"> | |
| 230 | - <div class="dashboard-box"> | |
| 231 | - <div class="dashboard-box-head"> | |
| 232 | - <h2>Message Templates</h2> | |
| 233 | - </div> | |
| 234 | - <div class="dashboard-box-body"> | |
| 235 | - <table> | |
| 236 | - <tr> | |
| 237 | - <th>Name</th> | |
| 238 | - <th>Status</th> | |
| 239 | - </tr> | |
| 240 | - <?php | |
| 241 | - foreach ($message_templates as $template) { | |
| 242 | - $status = get_post_meta( $template->ID, NOTIFIER_PREFIX . 'status', true); | |
| 243 | - $status_text = ($status) ? '<span class="status status-' . esc_attr(strtolower($status)) . '">' . esc_html($status) . '</span>' : '-'; | |
| 244 | - echo '<tr><td><a href="' . esc_url(get_edit_post_link($template->ID)) . '">' . esc_html($template->post_title) . '</a></td><td>' . wp_kses_post($status_text) . '</td></tr>'; | |
| 245 | - } | |
| 246 | - ?> | |
| 247 | - </table> | |
| 248 | - </div> | |
| 249 | - <div class="dashboard-box-footer"> | |
| 250 | - <div class="dashboard-box-buttons-wrap"> | |
| 251 | - <a class="button" href="<?php echo esc_url(admin_url('edit.php?post_type=wa_message_template')); ?>">View All</a> | |
| 252 | - </div> | |
| 253 | - </div> | |
| 113 | + <div class="dashboard-box-body"> | |
| 114 | + <p>This plugin provides you with simple triggers with a basic set of data fields to trigger notifications. If want more control over triggering your notifications, we suggest using <b>Webhooks</b> instead.</p> | |
| 115 | + <p>With webhooks you can <b>add Contacts</b> and <b>trigger Notifications</b> from WordPress using action hooks or using 3rd party sites like Zapier, Pabbly, IFTTT etc!</p> | |
| 116 | + <p><a href="https://app.wanotifier.com/contacts/import/" target="_blank">Click here</a> to view the webhook URL to <b>add contacts</b>. To trigger notification using webhook, <a href="https://app.wanotifier.com/notifications/add/" target="_blank">create a new Notification</a> and select <b>Trigger</b> option as <b>Via a Webhook URL</b>.</p> | |
| 254 | 117 | </div> |
| 255 | 118 | </div> |
| 256 | - <?php endif; ?> | |
| 257 | - <?php if ($contacts_count > 0) : ?> | |
| 258 | - <div class="col w-33"> | |
| 259 | - <div class="dashboard-box"> | |
| 260 | - <div class="dashboard-box-head"> | |
| 261 | - <h2>Contacts</h2> | |
| 262 | - </div> | |
| 263 | - <div class="dashboard-box-body"> | |
| 264 | - <table> | |
| 265 | - <tr> | |
| 266 | - <th>First Name</th> | |
| 267 | - <th>Last Name</th> | |
| 268 | - <th>Number</th> | |
| 269 | - </tr> | |
| 270 | - <?php | |
| 271 | - foreach ($contacts as $contact) { | |
| 272 | - $first_name = get_post_meta( $contact->ID, NOTIFIER_PREFIX . 'first_name', true); | |
| 273 | - $last_name = get_post_meta( $contact->ID, NOTIFIER_PREFIX . 'last_name', true); | |
| 274 | - $wa_number = get_post_meta( $contact->ID, NOTIFIER_PREFIX . 'wa_number', true); | |
| 275 | - echo '<tr><td><a href="' . esc_url( get_edit_post_link($contact->ID) ) . '">' . esc_html($first_name) . '</a></td><td>' . esc_html($last_name) . '</td><td>' . esc_html($wa_number) . '</td></tr>'; | |
| 276 | - } | |
| 277 | - ?> | |
| 278 | - </table> | |
| 279 | - </div> | |
| 280 | - <div class="dashboard-box-footer"> | |
| 281 | - <div class="dashboard-box-buttons-wrap"> | |
| 282 | - <a class="button" href="<?php echo esc_url(admin_url('edit.php?post_type=wa_contact')); ?>">View All</a> | |
| 283 | - </div> | |
| 284 | - </div> | |
| 119 | + <div class="dashboard-box"> | |
| 120 | + <div class="dashboard-box-head"> | |
| 121 | + <h3>Quick links 🔗</h3> | |
| 285 | 122 | </div> |
| 286 | - </div> | |
| 287 | - <?php endif; ?> | |
| 288 | - <?php if ($notifications_count > 0) : ?> | |
| 289 | - <div class="col w-33"> | |
| 290 | - <div class="dashboard-box"> | |
| 291 | - <div class="dashboard-box-head"> | |
| 292 | - <h2>Notifications</h2> | |
| 293 | - </div> | |
| 294 | - <div class="dashboard-box-body"> | |
| 295 | - <table> | |
| 296 | - <tr> | |
| 297 | - <th>Name</th> | |
| 298 | - <th>Status</th> | |
| 299 | - <th>Stats</th> | |
| 300 | - </tr> | |
| 301 | - <?php | |
| 302 | - foreach ($notifications as $notification) { | |
| 303 | - $status = get_post_meta( $notification->ID, NOTIFIER_PREFIX . 'notification_status', true); | |
| 304 | - $sent = get_post_meta( $notification->ID, NOTIFIER_PREFIX . 'notification_sent_contact_ids', true); | |
| 305 | - $sent_count = ($sent && is_array($sent)) ? count($sent) : '0'; | |
| 306 | - $unsent = get_post_meta( $notification->ID, NOTIFIER_PREFIX . 'notification_unsent_contact_ids', true); | |
| 307 | - $unsent_count = ($unsent && is_array($unsent)) ? count($unsent) : '0'; | |
| 308 | - echo '<tr>'; | |
| 309 | - echo '<td><a href="' . esc_url( get_edit_post_link($notification->ID) ) . '">' . esc_html($notification->post_title) . '</a></td>'; | |
| 310 | - echo '<td>' . esc_html($status) . '</td>'; | |
| 311 | - echo '<td>Sent: ' . esc_html($sent_count) . ' / Failed: ' . esc_html($unsent_count) . '</td>'; | |
| 312 | - echo '</tr>'; | |
| 313 | - } | |
| 314 | - ?> | |
| 315 | - </table> | |
| 316 | - </div> | |
| 317 | - <div class="dashboard-box-footer"> | |
| 318 | - <div class="dashboard-box-buttons-wrap"> | |
| 319 | - <a class="button" href="<?php echo esc_url( admin_url('edit.php?post_type=wa_notification') ); ?>">View All</a> | |
| 320 | - </div> | |
| 321 | - </div> | |
| 123 | + <div class="dashboard-box-body"> | |
| 124 | + <ul> | |
| 125 | + <li><a href="https://app.wanotifier.com/template/" target="_blank">Message Templates</a> - Create / edit message templates.</li> | |
| 126 | + <li><a href="https://app.wanotifier.com/contacts/" target="_blank">Contacts</a> - Manage your contacts.</li> | |
| 127 | + <li><a href="https://app.wanotifier.com/notifications/" target="_blank">Notifications</a> - See the notification delivery stats and much more.</li> | |
| 128 | + <li><a href="https://app.wanotifier.com/inbox/" target="_blank">Inbox</a> - See customer replies to your notifications and message them back.</li> | |
| 129 | + </ul> | |
| 322 | 130 | </div> |
| 323 | 131 | </div> |
| 324 | - <?php endif; ?> | |
| 132 | + </div> | |
| 325 | 133 | </div> |
| 326 | - | |
| 327 | 134 | <?php endif; ?> |
| 328 | 135 | |
| 329 | 136 | </div> |
| 330 | 137 | </div> |