Build an integration

Canvas objects

Request object

The request payload will have all the data needed for you to understand who is using your app, where they are using it, and how you should respond.

Admin

The admin object provides information on the Gist teammate. You can see more about this on the Teammate object.

{
  "id": 7652,
  "name": "John Doe",
  "email": "[email protected]",
  "avatar": "https://d258lu9myqkejp.cloudfront.net/users_profiles/3/medium/jittarao.jpg?1588261838",
  "agent_status": "online",
  "last_active_on": "2020-10-08T13:05:38.022Z",
  "away_mode_enabled": false,
  "team_ids": [
    1
  ],
  "has_inbox_seat": true
}

Context

The context object provides additional details on where the app has been added (or is currently being used), what page the app is being used on, and the Messenger settings. This is in order for you give a fully customised experience based on the customers use case.

{
  locale: "en",
  location: "inbox", // can also be messenger
  messenger_launcher_color: "#888888",
  messenger_background_color: "#666666",
  referrer: "https://yourdomain.com/"
}
Key Type Location Description
location String Inbox, Messenger Where the app is added or the action took place. Can be either 'messenger' or 'inbox'.
locale String Inbox, Messenger The default end-user language of the Messenger. Use to localise Messenger App content.
referrer String Inbox, Messenger The current page URL where the app is being used.
messenger_launcher_colour String Messenger The Messenger's launcher colour. Used in Sheets to make a Messenger App experience feel part of the host Messenger.
messenger_background_colour String Messenger The Messenger's background colour. Used in Sheets to make a Messenger App experience feel part of the host Messenger.

Current Canvas

The current_canvas object mirrors the same format as the Canvas object. This will be the canvas that was most recently showing before the request was sent.

{
  "current_canvas": {
    "content": {
      "components" : [
        {
          "type": "button",
          "id": "button-1",
          "label": "This canvas showed before I was clicked",
          "action": {
            "type": "submit"
          }
        }
      ]
    },
    "stored_data": { "key": "value" } // Optional. Can be more than one pair
  }
}

Input Values

The input_values object is a JSON hash containing key-value pairs. These key-value pairs represent the data that's been inputted by customers and teammates with a given component.

The key will be the component_id and the value will be the data that was inputted by this component.

{
    "input_values": {
        "<component_id>": "<Value entered in component>" // Can be more than one pair
    }
}

Contact

The contact object provides information on the Gist contact. You can see more about this on the Contacts object.

{
  "contact": {
    "type": "lead",
    "id": 146179,
    "name": "Rubamaga",
    "email": "[email protected]",
    "user_id": "22449",
    "phone": null,
    "created_at": 1506500350,
    "signed_up_at": null,
    "last_seen_at": 1506500350,
    "last_contacted_at": null,
    "updated_at": 1506501237,
    "session_count": null,
    "avatar": "https://avatar.tobi.sh/[email protected]?size=120&type=svg&text=GO",
    "landing_url": null,
    "original_referrer": null,
    "last_seen_ip": "127.0.0.1",
    "last_seen_user_agent": null,
    "location_data": {
      "city_name": "Paris",
      "region_name": null,
      "country_name": "France",
      "country_code": "FR",
      "continent_code": null,
      "latitude": 48.871216,
      "longitude": 2.311713,
      "postal_code": null,
      "time_zone": null,
      "utc_offset": null
    },
    "segments": [],
    "tags": [],
    "subscription_types": [],
    "social_profiles": null,
    "custom_properties": {
      "age": 22
    },
    "unsubscribed_from_emails": false
  }
}

Conversation

The conversation object provides information on the Gist conversation your app is being shown for. You can see more about this on the Conversations object page.

{
  "conversation": {
      "id": 1911149811, // The id representing the conversation
      "created_at": 1539897198, // The time the conversation was created
      "updated_at": 1540393270, // The last time the conversation was updated
      "channel": "chat", // channel the conversation was initiated on.
      "title": "Conversation title", // title of the conversation that is created
      "conversation_identifier": "nmjkgjw6-322acdac-6b3d-17d8-c08e-dd1b6f82cfc3", // conversation url key
      // The contact who is involved in the conversation.
      "contacts": [
          {
           "type": "user",
           "id": 165796,
           "user_id": "1",
           "email": "[email protected]"
      }
      ],
      // List of all teammates that participated (left a response) in the conversation
      "teammates": [
          {
              "id": 814860,
              "name": "Mark Strong",
              "email": "[email protected]"
          }
      ],
      // The teammate the conversation is currently assigned to. Note 'unassigned' indicates the conversation is currently unassigned.
      "assignee": {
          "id": 814860,
          "type": "teammate", // can be team or teammate
                "name": "Mark Strong",
                "email": "[email protected]"
      },
      "open": true, // Indicates whether a conversation is open (true) or closed (false)
      "state": "open", // Can be set to "open", "closed" or "snoozed"
      "read": true, // Indicates whether the last message in conversation has been read by the contact.
      "waiting_since": 64654125776, // The last time a contact responded to a teammate. In other words, the time a contact started waiting for a response. Set to null if last reply is from a teammate.
      "snoozed_until": null, // If set this is the time in the future when this conversation will be marked as open. i.e. it will be in a snoozed state until this time.
      // A list of tags associated with the conversation.
      "tags": {
          "tags": [
             {
                "id": 5,
                "name": "test 3"
             }
          ],
      },
      // List of all available conversation properties in the conversation
      "custom_properties": {
        "user_id": 145,
        "city": "London",
        "last_seen": 1502979465,
        "active": true,
        "fruits": ["Apple", "Orange", "Peach"] // List property
      }
      "priority": "not_priority", // The priority of the conversation. Can be set to "priority" or "not_priority"
      "conversation_rating": {
          "created_at": 1539897198, // indicates the time the rating was first left
          // the contact that gave the rating
          "contact": {
              "id": 1,
              "type": "lead"
          },
          "rating": 5, // The rating, between 1 and 5, for the conversation
          "remark": null, // An optional field to add a remark to correspond to the number rating
          // An object containing the ID and type of the teammate associated with the conversation when it was rated
          "teammate": {
              "id": 814860,
              "name": "Mark Strong",
              "email": "[email protected]"
          }
      },
      "statistics": {
        "first_contact_reply_at": 1539897200,
        "first_assignment_at": 1539897200,
        "first_teammate_reply_at": 1539897200,
        "first_close_at": 1539897200,
        "last_assignment_at": 1539897200,
        "last_assignment_teammate_reply_at": 1539897200,
        "last_contact_reply_at": 1539897200,
        "last_teammate_reply_at": 1539897200,
        "last_close_at": 1539897200,
        "last_closed_by": {
          "id": 325432652,
          "name": "Tom Smith",
          "email": "[email protected]"
        },
        "count_messages": 67
      }
    }
}