array( __( 'Create the WhatsApp Cloud API', 'afojet-new-post-alerts' ), $api_ok ), 'template' => array( __( 'Create the message template', 'afojet-new-post-alerts' ), $tpl_ok ), 'webhook' => array( __( 'Connect the webhook', 'afojet-new-post-alerts' ), $hook_ok ), 'live' => array( __( 'Go live & fix errors', 'afojet-new-post-alerts' ), false ), ); ?>
' . sprintf( /* translators: %s link */ __( 'Open %s and create a business portfolio with your blog or company name. Skip this if you already have one.', 'afojet-new-post-alerts' ), self::link( 'https://business.facebook.com/overview', 'business.facebook.com' ) ) . '
' . '' . __( 'Tip: verify your business (Settings → Security centre → Business verification) early. Without it you can message only 250 people a day.', 'afojet-new-post-alerts' ) . '
' ); self::step( 2, __( 'Create an app on Meta for Developers', 'afojet-new-post-alerts' ), '' . __( 'Meta gives you a free test number to try things (it can only message up to 5 numbers you add under "To"). For real readers add your own number:', 'afojet-new-post-alerts' ) . '
' . '' . __( 'The Phone number ID is a long number like 1234567890123456. It is not your phone number and not the "WhatsApp Business Account ID".', 'afojet-new-post-alerts' ) . '
' ); self::step( 4, __( 'Create a permanent access token', 'afojet-new-post-alerts' ), '' . __( 'The token shown in API Setup expires after 24 hours. Make one that never expires:', 'afojet-new-post-alerts' ) . '
' . 'whatsapp_business_messaging and whatsapp_business_management, then generate and copy the token. Meta shows it only once.', 'afojet-new-post-alerts' ) . '' . sprintf( /* translators: %s link */ __( 'In %s → Payment settings, add a card. Post alerts are "marketing" messages; Meta charges per delivered message and the price depends on the reader\'s country.', 'afojet-new-post-alerts' ), self::link( 'https://business.facebook.com/wa/manage/home/', 'WhatsApp Manager' ) ) . ' ' . self::link( 'https://developers.facebook.com/docs/whatsapp/pricing', __( 'See prices', 'afojet-new-post-alerts' ) ) . '
' ); self::step( 6, __( 'Paste the details into New Post Alerts', 'afojet-new-post-alerts' ), '' . sprintf( /* translators: %s link */ __( 'Go to %s, paste the Phone number ID and the access token, and save. Then make the template in Part 2 and send a test.', 'afojet-new-post-alerts' ), '' . esc_html__( 'New Post Alerts → WhatsApp API', 'afojet-new-post-alerts' ) . '' ) . '
' ); echo '' . sprintf( /* translators: %s link */ __( 'Open %s and click Create template.', 'afojet-new-post-alerts' ), self::link( 'https://business.facebook.com/wa/manage/message-templates/', __( 'WhatsApp Manager → Message templates', 'afojet-new-post-alerts' ) ) ) . '
' ); self::step( 2, __( 'Choose category and name', 'afojet-new-post-alerts' ), '| ' . esc_html__( 'Category', 'afojet-new-post-alerts' ) . ' | Marketing → Default. ' . esc_html__( 'New-post alerts count as marketing. If you pick Utility, Meta will move it to Marketing or reject it.', 'afojet-new-post-alerts' ) . ' |
|---|---|
| ' . esc_html__( 'Name', 'afojet-new-post-alerts' ) . ' | ' . esc_html( $name ) . ' ' . esc_html__( '(lowercase and underscores only – must match the plugin setting)', 'afojet-new-post-alerts' ) . ' |
| ' . esc_html__( 'Language', 'afojet-new-post-alerts' ) . ' | ' . esc_html__( 'The language you write in. Its code must match the plugin setting:', 'afojet-new-post-alerts' ) . ' ' . esc_html( $lang ) . ' ' . esc_html__( '(English (US) = en_US, English (UK) = en_GB, Hindi = hi)', 'afojet-new-post-alerts' ) . ' |
' . __( 'Header: choose Media → Image and upload any sample picture. New Post Alerts sends the post\'s featured image.', 'afojet-new-post-alerts' ) . '
' : '' . __( 'Header: leave empty (or turn on "Template has an image header" in settings to show the featured image).', 'afojet-new-post-alerts' ) . '
'; ob_start(); echo wp_kses_post( $header ); echo '' . esc_html__( 'Body – copy this:', 'afojet-new-post-alerts' ) . '
'; echo '' . esc_html( self::sample_body() ) . '
' . esc_html__( 'Click "Add variable" if the editor does not turn {{1}} into a variable by itself. Meta asks for sample values – use these:', 'afojet-new-post-alerts' ) . '
'; echo '' . esc_html( $var ) . ' | ' . esc_html( $val ) . ' |
|---|
' . esc_html__( 'Footer:', 'afojet-new-post-alerts' ) . ' ' . esc_html__( 'Reply STOP to unsubscribe', 'afojet-new-post-alerts' ) . '
' . esc_html__( 'Button:', 'afojet-new-post-alerts' ) . ' ' . esc_html__( 'Add button → Visit website.', 'afojet-new-post-alerts' ) . '
| ' . esc_html__( 'Button text', 'afojet-new-post-alerts' ) . ' | ' . esc_html__( 'Read post', 'afojet-new-post-alerts' ) . ' |
|---|---|
| ' . esc_html__( 'URL type', 'afojet-new-post-alerts' ) . ' | Dynamic |
| ' . esc_html__( 'Website URL', 'afojet-new-post-alerts' ) . ' | ' . esc_html( trailingslashit( home_url() ) ) . '{{1}} |
| ' . esc_html__( 'Sample', 'afojet-new-post-alerts' ) . ' | ' . esc_html( $link ) . ' |
' . esc_html__( 'Buttons:', 'afojet-new-post-alerts' ) . ' ' . esc_html__( 'none needed. Meta may add a "Stop promotions" button by itself – New Post Alerts unsubscribes people who tap it (needs the webhook in Part 3).', 'afojet-new-post-alerts' ) . '
'; } self::step( 3, __( 'Write the message', 'afojet-new-post-alerts' ), ob_get_clean() ); self::step( 4, __( 'Check the rules, then submit', 'afojet-new-post-alerts' ), '' . __( 'Click Submit. Approval usually takes a few minutes and at most 24 hours. Wait until the status is Active.', 'afojet-new-post-alerts' ) . '
' ); self::step( 5, __( 'Send a test', 'afojet-new-post-alerts' ), '' . sprintf( /* translators: %s link */ __( 'On %s, enter your own number under "Send a test". You should get your latest post on WhatsApp. If not, the error message tells you why – see Part 4.', 'afojet-new-post-alerts' ), '' . esc_html__( 'the WhatsApp API tab', 'afojet-new-post-alerts' ) . '' ) . '
' ); echo '' . wp_kses_post( sprintf( /* translators: %s link */ __( 'New Post Alerts Pro uses two more templates (daily/weekly digest and a verification code). The Pro add-on adds their steps here. %s', 'afojet-new-post-alerts' ), '' . esc_html__( 'Learn about Pro', 'afojet-new-post-alerts' ) . '' ) ) . '
'; } AFPP_Admin::card_close(); } /* ------------------------------------------------------------------ */ private static function part_webhook() { AFPP_Admin::card_open( __( 'Part 3 · Connect the webhook', 'afojet-new-post-alerts' ), __( 'Lets WhatsApp tell your site when a reader replies STOP, taps "Stop promotions", or when a message is delivered and read.', 'afojet-new-post-alerts' ), 'webhook' ); echo '' . wp_kses_post( __( 'In your app on Meta for Developers open WhatsApp → Configuration, and under Webhook click Edit. Paste:', 'afojet-new-post-alerts' ) ) . '
'; echo '| ' . esc_html__( 'Callback URL', 'afojet-new-post-alerts' ) . ' | '; AFPP_Admin::copy_field( AFPP_Webhook::url() ); echo ' |
|---|---|
| ' . esc_html__( 'Verify token', 'afojet-new-post-alerts' ) . ' | '; AFPP_Admin::copy_field( (string) get_option( 'afpp_webhook_token' ) ); echo ' |
' . wp_kses_post( __( 'Click Verify and save.', 'afojet-new-post-alerts' ) ) . '
'; self::step( 1, __( 'Add the callback URL', 'afojet-new-post-alerts' ), ob_get_clean() ); self::step( 2, __( 'Subscribe to messages', 'afojet-new-post-alerts' ), '' . __( 'Under Webhook fields click Manage and subscribe to messages. That one field brings both replies and delivery receipts.', 'afojet-new-post-alerts' ) . '
' . sprintf( /* translators: %s link */ __( 'Copy App settings → Basic → App secret into %s. New Post Alerts refuses every webhook call until it is saved, and then accepts only calls signed by Meta.', 'afojet-new-post-alerts' ), '' . esc_html__( 'the webhook settings', 'afojet-new-post-alerts' ) . '' ) . '
' ); self::step( 4, __( 'Check it works', 'afojet-new-post-alerts' ), '' . __( 'Send any message to your business number from your phone. The "Webhook working" badge at the top of this page turns green.', 'afojet-new-post-alerts' ) . '
' . '' . __( 'Meta can only reach a public HTTPS site. On a local site (localhost) the webhook will not verify – that is expected. Sending still works.', 'afojet-new-post-alerts' ) . '
' ); echo '' . __( 'In App settings → Basic, add a Privacy policy URL (your site\'s privacy page), then switch the app from Development to Live at the top of the dashboard.', 'afojet-new-post-alerts' ) . '
' ); self::step( 2, __( 'Send your first post', 'afojet-new-post-alerts' ), '' . __( 'Open any published post. In the WhatsApp subscribers box click Send on WhatsApp. Results appear on the Broadcasts tab.', 'afojet-new-post-alerts' ) . '
' ); echo '| ' . esc_html__( 'Code', 'afojet-new-post-alerts' ) . ' | ' . esc_html__( 'Meaning', 'afojet-new-post-alerts' ) . ' | ' . esc_html__( 'What to do', 'afojet-new-post-alerts' ) . ' |
|---|---|---|
' . esc_html( $e[0] ) . ' | ' . esc_html( $e[1] ) . ' | ' . esc_html( $e[2] ) . ' |
' . wp_kses_post( self::link( 'https://developers.facebook.com/docs/whatsapp/cloud-api/support/error-codes', __( 'All WhatsApp error codes', 'afojet-new-post-alerts' ) ) ) . '
'; AFPP_Admin::card_close(); } }