References

Snapkit

This reference lists the elements for creating custom user interface using snap-kit.

Structure

The snap-kit JSON has a top-level structure with object, body, type, and snap_kit_body fields. The snap_kit_body field contains information regarding snap-kit's structure.

The snap_kit_body field has the following properties:

  • snap_in_id: A unique identifier for the snap-kit.
  • snap_in_action_name: The name of the action this snap-kit represents.
  • body: An object that holds the actual snap-kit content in the form of snaps.
1
2
3
4
5
6
7
8
9
{
  "object": "<source_id>",
  "body": "Giphy",
  "type": "timeline_comment",
  "snap_kit_body": {
    "snap_in_id": "<snap_in_id>",
    "snap_in_action_name": "giphy",
    "body": { "snaps": [] }
}

The body field contains an array of snaps. Each snap can have a type; and depending on the type, it has different properties.

Types in the following categories are available:

  • User interface elements

  • Form elements

  • Layout elements

  • Data pickers

Action payloads

Snap-kit generates payloads when a user interacts with an actionable snap. The payload is sent to the backend and can be used to perform actions. The following snaps generate payloads:

All actionable snaps share the same base payload structure.

1
2
3
4
5
6
{
  "type": "<type of snap that generated the payload>",
  "action_id": "<the action identifier of the snap that generated the payload>",
  "action_type": "<the type of the action as defined in the snap>",
  "timestamp": "<timestamp as a string in ISO 8601 format>"
}

Base types

Many elements share the same base properties. The base types these elements inherit from are described below.

User interface elements

Form elements

Layout elements

Data pickers

Last updated on