Skip to main content

Shortcuts

Shortcuts are the customizable items that can be added to the three-dots menu, offering additional actions for users. You can incorporate shortcuts in the following places within the platform:

  • Member profile
  • Post

To create a new shortcut, you should go to the "Shortcuts" section of your app under Bettermode developer portal and fill out the form.

note

Don't have an app yet? Follow the instructions here.

Shortcut on post

In Bettermode, we offer two distinct types of shortcuts: Stateful and Stateless. Stateful shortcuts are utilized when specific criteria dictate the display of different items in the menu. For instance, consider an app that allows users to mark posts as favorites. Once a post is marked, the app would employ a Stateful shortcut to dynamically change the menu item to "Unmark" in response to the post being favorited. This dynamic adaptation ensures that the menu accurately reflects the current state of the app's features, providing users with a seamless and personalized navigation experience within the platform. On the other hand, Stateless shortcuts are utilized when the menu items remain fixed, without requiring dynamic changes based on criteria or states.

Stateful Shortcuts

In Bettermode, Shortcuts offer a versatile feature known as states, allowing developers to create dynamic and context-aware interactions. For instance, consider an app that enables users to mark posts as favorites. By utilizing the states property, developers can design a shortcut that displays different names based on the current state of the post (e.g., "Add to Favorites" when not favorited and "Remove from Favorites" when already favorited). To achieve this, Bettermode sends requests to fetch the current state of the shortcut, dynamically updating the displayed item based on the retrieved information.

State request

To fecth the state of the shortcut, a request with the format bellow would be sent to the app.

{
"networkId": "1N25ZZyz5c",
"context": "NETWORK",
"entityId": "1N25ZZyz5c",
"currentSettings": [],
"type": "SHORTCUTS_STATES",
"data": {
"member": {
"id": "Prkdw73gZP",
"networkId": "1N25ZZyz5c",
"externalId": null,
"createdAt": "2022-02-17T22:26:32.112Z",
"updatedAt": "2023-06-20T18:27:22.087Z",
"lastSeenAt": "2023-07-19T17:18:00.283Z",
"verifiedAt": "2022-02-17T22:28:14.610Z",
"blockedAt": null,
"suspendedAt": null,
"deletedAt": null,
"status": "VERIFIED",
"username": "admin",
"email": "[email protected]",
"emailStatus": "verified",
"password": null,
"verificationCode": null,
"verificationCodeExpiresAt": null,
"verificationTries": null,
"afterVerificationRoleId": null,
"teammate": true,
"staffReasons": [
"NETWORK_STAFF_ROLE",
"SPACE_STAFF_ROLE"
],
"overrideTeammate": false,
"flagged": false,
"roleId": "tVrhIhIgor",
"name": "Bettermode",
"profilePictureId": null,
"bannerId": null,
"tagline": "Bettermode dev team",
"phone": "+12996681250",
"locale": "en-US",
"invitationLinkId": null,
"blockedMemberIds": [],
"blockedByMemberIds": [],
"memberSettings": {
"privateMessaging": {
"privateMessagingEnabled": true
}
},
"role": null,
"network": null,
"memberSessions": [
{
"id": "SaKUWcgdowCFuE1q4aMg7YrzIDViudFQ3XCrqCwwyDhCqP8FfC",
"networkId": "1N25ZZyz5c",
"createdAt": "2023-05-26T20:22:48.200Z",
"updatedAt": "2023-07-19T17:17:59.861Z",
"lastActivityAt": "2023-07-19T17:17:59.860Z",
"memberId": "Prkdw73gZP",
"refreshToken":"1N25ZZyz5cSwLPYCptXgM04G03ihli2rUHF5z2oD052301xJGKPk3cBpNoG14MbPOMegyK7iUkVVZEmgrzXTYCSvdhStFX1N25ZZyz5c",
"status": "ACTIVE",
"ip": "137.224.69.169",
"country": "CA",
"client": "WEB",
"clientVersion": "1.0.0",
"authMethod": "PASSWORD",
"authMethodId": null,
"os": "Mac OS",
"osVersion": "10.15.7",
"deviceBrand": ""
}
],
"attributes": {
"locale": "en-US"
},
"fields": [
{
"key": "website",
"value": "\"https://bettermode.com\"",
"schema": {
"key": "website",
"name": "Website",
"type": "text",
"settings": [
{
"key": "subtype",
"value": "\"url\""
}
],
"validators": [
{
"value": "\"^https?://\"",
"validation": "pattern",
"customErrorMessage": "Website link should start with https://"
}
]
}
},
{
"key": "jobTitle",
"value": "\"Something\"",
"schema": {
"key": "jobTitle",
"name": "Job title",
"type": "text"
}
}
],
"settings": {
"privateMessaging": {
"privateMessagingEnabled": true
}
}
},
"role": {
"id": "tVrhIhIgor",
"createdAt": "2022-02-17T22:26:32.112Z",
"updatedAt": "2022-02-17T22:26:32.112Z",
"networkId": "1N25ZZyz5c",
"name": "Admin",
"description": null,
"scopes": [
"*"
],
"locked": true,
"type": "admin",
"visible": true,
"network": null
},
"entities": [
{
"context": "POST",
"entity": {
"id": "8RX5i9InwRnFNcu",
"networkId": "1N25ZZyz5c",
"templateId": null,
"externalId": null,
"spaceId": "ahms6d5zteGd",
"postTypeId": "JEhUQer0pHuOdoI",
"createdAt": "2023-07-19T16:02:04.887Z",
"updatedAt": "2023-07-19T16:02:04.887Z",
"publishedAt": "2023-07-19T16:02:05.165Z",
"lastActivityAt": "2023-07-19T16:02:05.165Z",
"lastActivity": null,
"status": "PUBLISHED",
"createdById": "Prkdw73gZP",
"ownerId": "Prkdw73gZP",
"isAnonymous": false,
"locked": false,
"mentionedMembers": [],
"embedIds": [],
"imageIds": [],
"pinnedInto": [],
"repliedToId": null,
"repliedToIds": [],
"repliesCount": 0,
"totalRepliesCount": 0,
"seoDetail": {
"title": "A"
},
"customSeoDetail": {
"canonicalUrl": null
},
"topRepliers": [],
"title": "Shortcut",
"description": "A post about shortcut.",
"thumbnailId": "",
"slug": "shortcut",
"key": "8RX5i9InwRnFNcu",
"shortContent": "<p>A post about shortcut.</p>",
"language": "en",
"hasMoreContent": false,
"isReply": false,
"mappingFields": [
{
"key": "title",
"value": "\"Shortcut\"",
"type": "text"
},
{
"key": "content",
"value": "\"<p>A post about shortcut.</p>\"",
"type": "html"
},
{
"key": "previewImageId",
"value": "null",
"type": "image"
}
],
"fields": [
{
"key": "title",
"value": "\"A\"",
"schema": {
"key": "title",
"name": "Title",
"type": "text",
"required": true,
"settings": [
{
"key": "subtype",
"value": "\"text\""
},
{
"key": "view",
"value": "\"Title\""
}
],
"validators": null,
"description": "The title of post",
"readPrivacy": {
"allow": []
},
"typeOptions": {
"textType": "shortText"
},
"writePrivacy": {
"allow": [
"OWN",
"ADMIN"
]
}
}
},
{
"key": "content",
"value": "\"<p>A post about shortcut.</p>\"",
"schema": {
"key": "content",
"name": "Content",
"type": "richText",
"required": false,
"settings": [
{
"key": "view",
"value": "\"Html\""
},
{
"key": "placeholder",
"value": "\"\""
},
{
"key": "helperText",
"value": "\"Paste the podcast link here\""
},
{
"key": "selectOptions",
"value": "[]"
}
],
"validators": null,
"description": "The Body of post",
"readPrivacy": {
"allow": []
},
"typeOptions": {
"richTextType": "html"
},
"writePrivacy": {
"allow": [
"OWN",
"ADMIN"
]
}
}
}
],
"primaryReactionType": "EMOJI_BASE",
"positiveReactionsCount": 0,
"negativeReactionsCount": 0,
"reactionsCount": 0,
"singleChoiceReactions": [],
"isHidden": false,
"positiveReactions": null,
"negativeReactions": null,
"allowedEmojis": null,
"forbiddenEmojis": null,
"topicIds": [
"S6gJHFkZOIcsmr29FLy04",
"xbchZch2pu1WeKNXyLzmc"
],
"tagIds": [
"DH3LyaAim7uzsWYJHopGq",
"vAbmv1yYKJ5Oe46jXVYCb"
],
"attachmentIds": [],
"searchFields": [
"title",
"content"
]
},
"shortcuts": [
"mark-as-favorite"
]
}
]
}
}

State response

You need to respond to the request above with the following JSON format:

{
"type": "SHORTCUTS_STATES",
"status": "Succeeded",
"data": [
{
"context": "POST",
"entityId": "8RX5i9InwRnFNcu",
"shortcutStates": [
{
"shortcut": "mark-as-favorite",
"state": "marked"
}
]
}
]
}

Stateless Shortcuts

When states are not specified for a shortcut, it becomes a Stateless shortcut. In this case, the shortcut item is always visible within the menu, and user interaction is triggered simply by clicking on it. Unlike Stateful shortcuts, which adapt dynamically based on specific criteria or states, Stateless shortcuts maintain a consistent appearance and functionality, providing a straightforward and predictable user experience.

Shortcuts Interaction response

When a shortcut is clicked, an interaction request would be sent to your app and you need to respond with an interaction response. If you're new to interaction responses, read this guide to learn more.