WordPress Plugin
Integra NotifyHub in qualsiasi sito WordPress in 5 minuti. Hook automatici per commenti, WooCommerce e Contact Form 7.
Download & Installazione
Requisiti
| WordPress | 5.8 o superiore |
| PHP | 7.4 o superiore |
| WooCommerce | Opzionale, per hook ordini |
| Contact Form 7 | Opzionale, per hook form |
Installazione
- Scarica il file ZIP dal pulsante qui sopra
- Nel pannello WordPress vai su Plugin → Aggiungi nuovo → Carica plugin
- Seleziona il file
notifyhub-wp.zipe clicca Installa ora - Attiva il plugin "NotifyHub WP"
- Vai su Impostazioni → NotifyHub per configurarlo
Configurazione
Dopo l'attivazione, vai su Impostazioni → NotifyHub. Sono necessari 3 campi per connettere il plugin al tuo workspace.
Connessione API
| URL NotifyHub | https://notify.trovido.com — URL del portale NotifyHub |
| API Key | Chiave Bearer generata dalla sezione /sources del portale |
| Telefono notifiche | Numero WhatsApp/Telegram per ricevere le notifiche (formato +39...) |
Impostazioni predefinite
| Canale predefinito | whatsapp | telegram | email — canale di invio per gli hook automatici |
| Template predefinito | Slug del template usato dagli hook (es. nh_wp_notification) |
Hook automatici
Abilita o disabilita individualmente gli hook per commenti, ordini WooCommerce e form Contact Form 7 tramite le relative checkbox.
Impostazioni → NotifyHub
---------------------------------
Connessione API
URL NotifyHub: [https://notify.trovido.com]
API Key: [nh_live_xxxxxxxxxxxxx ]
Telefono: [+393331234567 ]
Impostazioni predefinite
Canale: [WhatsApp v]
Template: [nh_wp_notification ]
Hook automatici
[x] Nuovo commento
[x] Ordine WooCommerce
[ ] Form Contact Form 7
[Salva impostazioni]
---------------------------------
Test invio
Numero test: [+393331234567 ]
[Invia test WhatsApp]
Hook automatici
Il plugin intercetta eventi WordPress e invia notifiche automatiche via NotifyHub. Ogni hook puo essere abilitato singolarmente dalla pagina impostazioni.
Nuovo commento
Invia una notifica quando un visitatore pubblica un commento su un post o una pagina.
| Hook WP | comment_post |
| Template | Configurabile (default: nh_wp_notification) |
| Idempotency | wp_comment_{comment_id} |
Ordine WooCommerce
Invia una notifica per ogni nuovo ordine ricevuto. Richiede WooCommerce attivo.
| Hook WP | woocommerce_new_order |
| Template | nh_woo_order |
| Idempotency | wp_woo_{order_id} |
Form Contact Form 7
Invia una notifica quando un visitatore compila e invia un form CF7. I campi vengono riassunti automaticamente (max 10).
| Hook WP | wpcf7_mail_sent |
| Template | nh_wp_notification |
| Idempotency | wp_cf7_{timestamp} |
Shortcode recensioni
Inserisci il form di raccolta recensioni in qualsiasi pagina WordPress con lo shortcode [notifyhub_review].
Flusso
- L'utente compila nome, email, valutazione (1-5 stelle), testo e foto opzionale
- Il plugin invia la recensione a NotifyHub via API
- L'admin riceve un messaggio WhatsApp/Email con bottoni Pubblica / Rifiuta
- Il click sul bottone esegue il callback al sito, aggiornando lo stato della recensione
Parametri
| template | Template WhatsApp da usare (default: review_approval) |
| phone | Numero che riceve la richiesta di approvazione (default: telefono notifiche) |
| title | Titolo del form (default: Lascia una recensione) |
| success | Messaggio di conferma dopo l'invio |
Variabili template
[notifyhub_review]
[notifyhub_review
template="review_approval"
phone="+393331234567"
title="Lascia una recensione"
success="Grazie! La tua recensione è stata inviata."]
{
"recipient": {
"whatsapp_phone": "+393331234567",
"name": "MioSito Admin"
},
"channel": "whatsapp",
"template": "review_approval",
"vars": {
"1": "Mario Rossi",
"2": "5 stelle",
"3": "Servizio eccellente, consiglio..."
},
"media": {
"url": "https://sito.it/wp-content/uploads/photo.jpg",
"type": "image"
},
"idempotency_key": "wp_review_a1b2c3d4..."
}
API diretta da PHP
Per integrazioni custom, usa la classe NotifyHub_API direttamente nel tuo tema o plugin WordPress.
Metodi disponibili
| NotifyHub_API::send(array) | Invio generico — accetta lo stesso payload dell'API REST |
| NotifyHub_API::send_whatsapp() | Shortcut per WhatsApp: ($phone, $template, $vars, $actions) |
| NotifyHub_API::send_telegram() | Shortcut per Telegram: ($chat_id, $template, $vars) |
| NotifyHub_API::send_email() | Shortcut per Email: ($email, $template, $vars) |
| NotifyHub_API::is_configured() | Ritorna true se API key e URL sono impostati |
Risposta
Tutti i metodi ritornano un array con ok (bool), code (HTTP status) e data (body della risposta).
NotifyHub_API::send_whatsapp(
'+393331234567',
'hello_world',
['name' => 'Mario']
);
NotifyHub_API::send([
'recipient' => [
'email' => '[email protected]'
],
'channel' => 'email',
'template' => 'report',
'vars' => [
'title' => 'Report settimanale',
'date' => date('d/m/Y'),
],
'media' => [
'url' => wp_get_attachment_url($id),
'type' => 'image',
],
]);
$result = NotifyHub_API::send([...]);
if ($result['ok']) {
$delivery_id = $result['data']['delivery_id'];
} else {
$error = $result['data']['message']
?? $result['error']
?? 'Errore sconosciuto';
error_log('NotifyHub: ' . $error);
}
WP-CLI
Configura il plugin dalla riga di comando senza accedere al pannello WordPress. Utile per deploy automatizzati e provisioning server.
# Imposta URL e API key
wp option update notifyhub_api_url \
"https://notify.trovido.com"
wp option update notifyhub_api_key \
"nh_live_xxxxxxxxxxxxx"
wp option update notifyhub_notify_phone \
"+393331234567"
# Canale e template predefiniti
wp option update notifyhub_default_channel \
"whatsapp"
wp option update notifyhub_default_template \
"nh_wp_notification"
# Commenti
wp option update notifyhub_on_comment 1
# Ordini WooCommerce
wp option update notifyhub_on_woo_order 1
# Contact Form 7
wp option update notifyhub_on_cf7 1
wp option get notifyhub_api_url
wp option get notifyhub_api_key
wp option get notifyhub_on_comment
Vuoi integrare NotifyHub via REST API senza WordPress?