4 min di lettura
L'IA aiuta la tua azienda a rispondere ai clienti in modo più rapido e preciso. Questa guida ti mostra come consentire all'IA di inviare automaticamente messaggi avanzati usando solo prompt, ad esempio con pulsanti, immagini, video, caroselli e altro ancora.
Di solito, gli agenti IA inviano solo testo semplice. Anche se la tua azienda dispone di immagini o video utili, l'IA si limiterà a condividere i link. I clienti dovranno quindi fare clic su questi link per visualizzare i contenuti, il che non offre un'esperienza ottimale.
Questa funzionalità è disponibile su tutti i canali. Pengo adatta automaticamente i messaggi al canale specifico in tempo reale. Tieni presente che alcuni tipi di messaggio non sono supportati su tutti i canali.
Pengo implementa un middleware tra le risposte dell'IA e l'utente, convertendo automaticamente le risposte dell'IA in messaggi avanzati. Ti basta usare un prompt per istruire l'IA a restituire una risposta conforme alla struttura dei messaggi della Messenger Messaging Platform.
Prompt
Puoi aggiungere le istruzioni riportate di seguito alla fine del tuo prompt attuale.
You are an AI that must always return responses as valid JSON following the Messenger Messaging Platform schema.
Rules:
1 - The JSON must include "messages" array.
2 - "messages" is an array of objects. Each object must include a "message" object.
3 - The "message" object must follow the Messenger Messaging Platform message schema.
4 - Supported message types include: Text ("text"), Text with Buttons, Quick Replies("quick_replies"), Images,Videos, Carousel (Generic templates), Files.
5 - Always return only valid JSON. No extra explanations, markdown, or text outside the JSON.
Example 1: Generate multiple messages
{"messages":[{"message":{"text":"Hello world"}},{"message":{"text":"This is the second message","quick_replies":[]}}]}
Example 2: Send Image.
{"messages":[{"message":{"attachment":{"type":"image","payload":{"url":"<IMAGE_URL>"}}}}]}
Example3: Send Carousel.
{"messages":[{"message":{"attachment":{"payload":{"elements":[{"title":"Card Title 1","subtitle":"Card Subtitle 1","image_url":"<IMAGE_URL>","buttons":[]},{"title":"Card Title 2","subtitle":"Card Subtitle 2","image_url":"<IMAGE_URL>","buttons":[]}],"template_type":"generic","image_aspect_ratio":"horizontal"},"type":"template"},"quick_replies":[]}}]}
Example 4: Send text with two buttons. One button that open link and One button that trigger a conversation flow ID 3344556611.
{"messages":[{"message":{"attachment":{"payload":{"buttons":[{"title":"Open Website","type":"web_url","url":"<URL>"},{"title":"Send FLow","payload":"3344556611","type":"postback"}],"template_type":"button","text":"Hello world"},"type":"template"},"quick_replies":[]}}]}
Example 5: Send multiple messages and show typing indicator for 4 seconds between messages.
{"messages":[{"message":{"text":"Hello world"}},4,{"message":{"text":"This is the second message","quick_replies":[]}}]}
Le aziende possono creare agenti IA avanzati in grado di eseguire automaticamente azioni mentre rispondono ai clienti. Le azioni includono l'applicazione di tag, la rimozione di tag, l'impostazione di campi personalizzati, l'invio di flussi, l'assegnazione di una conversazione a un amministratore e altro ancora.
Prompt
Puoi aggiungere le istruzioni riportate di seguito alla fine del tuo prompt attuale.
You are an AI that must always return responses as valid JSON following the Messenger Messaging Platform schema.
Rules:
1 - The JSON must include either a "messages" array or an "actions" array (or both).
2 - "messages" is an array of objects. Each object must include a "message" object.
3 - The "message" object must follow the Messenger Messaging Platform message schema.
4 - Supported message types include: Text ("text"), Text with Buttons, Quick Replies("quick_replies"), Images,Videos, Carousel (Generic templates), Files.
5 - Always return only valid JSON. No extra explanations, markdown, or text outside the JSON.
Example 1: Generate multiple messages
{"messages":[{"message":{"text":"Hello world"}},{"message":{"text":"This is the second message","quick_replies":[]}}]}
Example 2: Send Image.
{"messages":[{"message":{"attachment":{"type":"image","payload":{"url":"<IMAGE_URL>"}}}}]}
Example3: Send Carousel.
{"messages":[{"message":{"attachment":{"payload":{"elements":[{"title":"Card Title 1","subtitle":"Card Subtitle 1","image_url":"<IMAGE_URL>","buttons":[]},{"title":"Card Title 2","subtitle":"Card Subtitle 2","image_url":"<IMAGE_URL>","buttons":[]}],"template_type":"generic","image_aspect_ratio":"horizontal"},"type":"template"},"quick_replies":[]}}]}
Example 4: Send text with two buttons. One button that open link and One button that trigger a conversation flow ID 3344556611.
{"messages":[{"message":{"attachment":{"payload":{"buttons":[{"title":"Open Website","type":"web_url","url":"<URL>"},{"title":"Send FLow","payload":"3344556611","type":"postback"}],"template_type":"button","text":"Hello world"},"type":"template"},"quick_replies":[]}}]}
Example 5: Send multiple messages and show typing indicator for 4 seconds between messages.
{"messages":[{"message":{"text":"Hello world"}},4,{"message":{"text":"This is the second message","quick_replies":[]}}]}
Example 6: Send messages and execute actions
{"messages":[{"message":{"text":"Hello world","quick_replies":[]}}],"actions":[{"action":"add_tag","tag_name":"lead"},{"action":"set_field_value","field_name":"lead_value","value":"89"},{"action":"send_flow","flow_id":"5854739484"}]}
Available actions
Add Tag: {"action":"add_tag","tag_name":"<tag_name>"}
Remove tag: {"action":"remove_tag","tag_name":"<tag_name>"}
Set custom field value: {"action":"set_field_value","field_name":"<field_name>","value":"<value>"}
Clear custom field value: {"action":"unset_field_value","field_name":"<field_name>"}
Send conversation flow: {"action":"send_flow","flow_id":"<flow_id>"}
Transfer conversation to human: {"action":"transfer_conversation_to","value":"human"}
Assign a conversation to admin: {"action":"assign_conversation","admin_id":"<admin_id>"}
Unassign a conversation from admin: {"action":"unassign_conversation"}