DOCUMENTATION / COMPONENTS & FORMS
Let the conversation do more.
Build rich messages with buttons, dropdowns, entity selectors and forms.
Collect a little more detail
Forms support one to five text inputs. Required fields and length bounds are checked by the server. Forms expire with their parent interaction and can be submitted only once by the member who opened them.
import { ModalBuilder, TextInputBuilder } from '@relaychat/sdk';
await interaction.showModal(new ModalBuilder()
.setCustomId('ticket:details').setTitle('Tell us more')
.addInputs(new TextInputBuilder().setCustomId('details')
.setLabel('What happened?').setStyle('paragraph')
.setRequired(true).setMaxLength(1500)));
// Handle a new modal interaction:
// interaction.fields.detailsEmbeds and attachments
EmbedBuilder supports titles, descriptions, colors, fields, images, thumbnails, footers and timestamps. Upload attachments through bot.uploadFile(channelId, blob, name), then include the returned { id } in attachments. Download links are short-lived and created only after checking the member’s current channel access.
Messages render text as text; a bot cannot inject HTML into Relay. External image and link URLs must use HTTPS. Keep third-party image privacy in mind when choosing where your bot hosts images.
relay