Create a Lita Extension to Send Text to the Pastebin API

Pastebin is a service that provides two main uses: First, it provides a public space to store a text dump at a permanent URL. Maybe you’re storing a code snippet or some meeting minutes? Second, it auto-expires those notes after a scheduled period, say 24 hours. It can be a relief to share some scratch notes and know that they’ll be purged over time. These twin purposes are ideal for screening out a too-long post from your chat room.

Following is the ShipToPastebin implementation in its entirety; you’ll note that it’s a very short file. All the extension aims to do is expose a method—for use by proper Lita skills—that receives a long string and returns a Pastebin URL. To create your new ...

Get Build Chatbot Interactions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.