Deprecated: Creation of dynamic property Timber\Site::$pingback is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Site.php on line 180

Deprecated: Creation of dynamic property Timber\User::$name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/User.php on line 118

Deprecated: Creation of dynamic property Timber\Post::$has_disclaimer is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_edit_lock is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_edit_last is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_meta_box_present is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_send_notification is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_modify_title_and_content is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_notification_custom_heading is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$onesignal_notification_custom_content is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_content_score is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_focuskeywords is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_keywordsynonyms is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_estimated-reading-time-minutes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_wordproof_timestamp is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$tipologia is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_tipologia is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$attributi is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_attributi is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$in_evidenza_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_in_evidenza_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$inviato_in_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_inviato_in_newsletter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_category is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_blz_affiliation_attributes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_content_type is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_attributes is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_primary_speciali is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_focuskw is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_metadesc is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_linkdex is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_thumbnail_id is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$response_body is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_indexnow_last_ping is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_date_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$ping_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_password is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$to_ping is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$pinged is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_content_filtered is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$guid is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$menu_order is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_mime_type is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_count is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$filter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71
Parlare con qualunque app di messaggistica con Appraise | IlSoftware.it

Parlare con qualunque app di messaggistica con Appraise

Appraise è una versatile libreria open source che permette di scambiare informazioni con qualunque servizio di messaggistica. Sviluppatori, professionisti e aziende possono inviare notifiche appoggiandosi a qualunque piattaforma.

Il sogno di tanti sviluppatori è quello di poter comunicare con le varie piattaforme di messaggistica istantanea utilizzando un’unica soluzione integrata. Appraise è una promettente libreria open source che consente di inviare notifiche a una vasta gamma di servizi online, come WhatsApp, Telegram, Discord, Slack, Amazon SNS, Gotify e molti altri. La libreria fornisce una sintassi comune e intuitiva per la gestione delle notifiche, supporta l’invio di immagini e allegati (per i servizi che li accettano) ed è estremamente leggera, garantendo tempi di risposta rapidi grazie all’invio asincrono dei messaggi.

I vantaggi di parlare con qualunque app di messaggistica

Il principale beneficio derivante dall’utilizzo di Appraise (questa la pagina ufficiale) consiste, evidentemente, nella possibilità di accedere a quasi tutti i servizi di notifica disponibili senza dover sviluppare codice “ad hoc” e adattare la propria applicazioni a ciascuno di essi.

La libreria open source, comodamente installabile ad esempio con il comando Python pip install apprise, propone una sintassi comune e intuitiva per specificare i destinatari dei messaggi, rendendo più semplice per gli sviluppatori gestire i diversi servizi. È inoltre leggera, garantisce prestazioni di primo livello e tempi di risposta rapidi grazie all’invio asincrono delle richieste.

Gli sviluppatori che desiderano implementare sistemi di notifica, non devono più esplorare la giungla di API e di interfacce messe a disposizione da ciascun servizio. È sufficiente includere la libreria Apprise nel proprio progetto per avere accesso immediato a quasi tutti i servizi di notifica attualmente disponibili.

Per gli amministratori di sistema e i membri di team DevOps, non è più necessario cercare lo strumento giusto: tutto il necessario è già incluso e supportato nel tool da riga di comando (CLI, Command Line Interface) di Apprise.

Modalità d’installazione supportate da Apprise e Service ID

L’installazione di Apprise può essere effettuata tramite l’utilità pip, RPM o altri gestori di pacchetti per le principali distribuzioni GNU/Linux. Come accennato in precedenza, è altresì disponibile una comoda ed efficace interfaccia da riga di comando (CLI) chiamata che consente di inviare facilmente notifiche specificando gli URL dei servizi desiderati.

Servendosi di un apposito file di configurazione, Apprise consente agli utenti di specificare le proprie preferenze e credenziali in modo sicuro, senza doverle inserire direttamente sulla riga di comando.

I Service ID riportati in questa tabella sono degli URI (Uniform Resource Identifier) che permettono di interagire con ciascun servizio: tgram://, ad esempio, consente di “parlare” con Telegram, whatsapp:// con WhatsApp, twitter:// con X, slack:// con l’omonima suite per la produttività e la collaborazione, o365:// con i servizi integrati nella piattaforma Microsoft 365, msteams:// con Teams, mqtt:// e mqtts:// con i dispositivi IoT compatibili MQTT, ifttt:// con IFTTT e così via.

Apprise supporta diverse categorie di notifiche, tra cui notifiche basate sulla produttività, notifiche SMS, notifiche desktop, notifiche email e notifiche personalizzate. Ad esempio, si possono predisporre notifiche desktop su sistemi Windows, Linux e macOS, l’invio di email, notifiche strutturate come form, oggetti XML o JSON.

Qualche esempio di utilizzo di Apprise

Supponendo di utilizzare l’interfaccia a riga di comando, si possono ad esempio inviare messaggi a più servizi utilizzando la sintassi che segue:

apprise -t "Titolo messaggio notifica" -b "Testo del messaggio" \
'telegram://TOKEN/chat_id' \
'slack://webhook_id/webhook_token' \
'pbul://o.gn5kj6nfhv736I7jC3cj3QLRiyhgl98b'

Usando un’istruzione simile alla seguente, si possono inviare messaggi con allegati:

apprise -t "Notifica con allegati" -b "Il messaggio ha un allegato" \
--attach /percorso/del/file/allegato.txt \
'mailto://tuoindirizzo@email.com'

Ancora, si può predisporre un file di configurazione (apprise.yml):

urls:
- 'mailto://tuoindirizzo@email.com'
- 'slack://webhook_id/webhook_token'
- 'telegram://TOKEN/chat_id'

Per poi richiamarlo così come segue:

apprise -t "notifica di prova" -b "testo del messaggio di notifica" --config=apprise.yml

Personalizzare la struttura della notifica con Python

Il codice Python permette di creare una funzione di notifica personalizzata utilizzando la libreria Apprise. La struttura della notifica personalizzata è quindi utilizzata per inviare un messaggio:

# Creare una funzione di notifica personalizzata
from apprise.decorators import notify

@notify(on="mionuovoschema", name="Mio Schema Personalizzato")
def mio_schema_notifica(body, title, notify_type, *args, **kwargs):
# Personalizza la tua logica qui
print(f"{notify_type.upper()}: {title} - {body}")

# Ora utilizza la notifica personalizzata
apprise -t "Notifica personalizzata" -b "Questo messaggio segue il mio schema personalizzato" 'mionuovoschema://'

Nell’esempio mionuovoschema:// non corrisponde, ovviamente, a un servizio specifico. Per inviare effettivamente la notifica a un determinato servizio, va definito uno schema personalizzato che corrisponda alle specifiche del servizio di destinazione e fornire i dettagli di configurazione corretti.

Credit immagine in apertura: iStock.com – oatawa

Ti consigliamo anche

Link copiato negli appunti