You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Video of how the Poll app uses an Attachment Picker

<video>

What is an attachment picker?

An attachment picker allows users to create and send messages with attachments. For example,

  • The poll app allows a user to attach an opinion poll to a message.
  • The notes app allows a user to attach a rich media note to a message.

To create an attachment, the user clicks on an attachment picker button. The image below shows the Attachment picker bar on the Flock desktop client along with the poll app attachment picker button 

 

Similarly the Flock mobile clients also provide a hook for the Attachment picker button -

 

Clicking on the polls app button in the attachment picker on mobile or desktop, opens a modal widget, which the user then uses to create a poll.

What are the available actions for an attachment picker button?

When a user presses the attachment picker button, you can configure it to do one of the below -

  • Launch a modal widget
  • Launch a sidebar widget
  • Launch a browser

Alongwith launching any of the above, a client.pressButton event will also be passed as a parameter to the web app URL loaded in any of the above widgets or browser

How do I create an attachment picker?

  1. Go through Creating an App to setup your app in the developer dashboard.
  2. In the Advanced Info section, enable the attachment picker.



    Fill in the info below:

    FieldMandatoryDescription
    Tooltip textYesThis will be shown against your attachment picker button to the user
    Select action for attachment pickerYes

    Select an appropriate client action for the attachment picker.

    Type of widget in desktopYesWhether the widget should be modal or sidebar (available only if open widget is selected)
    Action URLYesThe URL that should get called on clicking of the attachment picker button (available only if open widget or open browser are selected)
    Send contextYesWhether information related to the event should be sent to the browser (available only if open browser is selected)
  3. Go through app installation and install this app into your own Flock account.
  4. Whenever a user presses the attachment picker button, the event client.pressButton along with a validation token will be appended to the corresponding client action you selected and sent to your service.
  5. After verifying the validation token, you should present the interface for the user to create an attachment.
  6. Once the user has finished creating the attachment you can send it to back to Flock to the chat tab from where the user clicked on your attachment picker by creating a message object, with an attachment object, and sending the message to Flock via the chat.sendMessage method call.
  7. Publish your app to the app store once you are done testing it.

Code Samples