One of the more notable new features of Android 7.1 is the ability for keyboards to directly insert GIFs into an application. However, both the keyboard and target application have to be updated to handle the new functionality. Thankfully, Twitter has now done so with version 6.33.0-beta.556.

To use this feature, you will need a compatible keyboard (like Gboard), a device running Android 7.1 or later (Edit: Twitter doesn't seem to have this working on older version of Android, even if theoretically it should), and the latest Twitter beta release. Once you have all that, inserting GIFs should come up as an option on the keyboard.

  

Just like the existing GIF button in the Twitter app, this works with both tweets and DMs. I expect this will arrive in the non-beta Twitter app with the next update.