any_attachment

This block will catch any attachment file like a document, audio, image, sticker or video.

any_attachment(&block)

Platforms

Platform
Supported

Messenger

WhatsApp

Telegram

Usage

Since each platform handles attachments differently, we recommend the use of @user.platform method to handle this separately, as in the following example:

class MainContext < Conversation

  def blocks

    any_attachment do |attachments|
    
      if @user.platform == "messenger"
        #Handle attachments param for Messenger
      elsif @user.platform == "telegram"
        #Handle attachments param for Telegram
      elsif @user.platform == "whatsapp"
        #Handle attachments param for WhatsApp
      end
      
    end

  end
  
end

Last updated