# TXT Concepts

This page explains the core building blocks of UbiQuity TXT - shortcodes, keywords, programmes, and the STOP opt-out process. Understanding these will help you set up and manage your TXT activity correctly.

***

### Shortcodes

A shortcode is the number your contacts will send TXT messages to and receive TXT messages from - for example, 3611. UbiQuity will set up your shortcode and register it with all TXT carriers in New Zealand.

A single shortcode can be shared across multiple TXT programmes, provided those programmes have similar content. If you plan to send different types of TXT communication - for example, both service messages and marketing messages - you should use separate shortcodes to remain compliant with NZ legislation. See [TXT Message Guidelines](/documentation/channels/txt/txt-message-guidelines.md) for more detail.

Once your shortcode is assigned to your UbiQuity account and your user has the appropriate permissions, you are ready to start using TXT.

{% hint style="info" %}
**Note:** It is common to receive occasional random or misdirected inbound messages on a shortcode. These can be ignored.
{% endhint %}

***

### International long codes

If you need to send TXT messages to international mobile numbers, you will need an international long code set up on your account. Contact UbiQuity to arrange this.

***

### Keywords

When an inbound TXT message arrives, UbiQuity uses the first word of the message - the keyword - to route it to the correct TXT Programme.

For example, a message starting with *SUBSCRIBE* will be routed to the TXT Programme configured with the keyword *SUBSCRIBE*. Any additional content after the keyword (such as an email address) is also available to the programme for processing.

For each shortcode, you can have one keywordless programme. Any inbound messages that do not start with a recognised keyword will be routed to this programme.

Keywords must be alphanumeric, contain no spaces, and be between 1 and 50 characters.

***

### TXT Programmes

A TXT Programme is a workflow that handles inbound TXT messages. When a message arrives with a matching keyword, the programme runs its steps in sequence.

Some programmes complete in a single step - for example, replying with a recipe or a piece of information. Others involve multiple steps and wait for further inbound messages before continuing.

When a programme is waiting for a follow-up message, the mobile number is locked to that programme for 24 hours or until the end of the workflow is reached. No keyword is required for subsequent messages in the same workflow - UbiQuity knows which programme that number is engaged with.

TXT Programmes can also be configured to send outbound TXT Outs to your database contacts. See TXT Programmes for full details on setting up and building a programme.

***

### The STOP process

When you send marketing TXT messages, recipients must be able to opt out by replying STOP. UbiQuity manages this automatically.

How STOP messages are handled depends on whether a keyword is included:

* **"STOP"** (no keyword) - UbiQuity cannot determine which specific programme the contact is opting out from, so all TXT opt-in fields for that shortcode are set to No across the entire UbiQuity database. The contact will be excluded from all future TXT Outs on that shortcode.
* **"STOP \[keyword]"** (with keyword) - Only the opt-in field for the specific TXT Programme associated with that keyword is set to No. The contact will be excluded from future TXT Outs for that programme only.

If a mobile number appears more than once in your database, every matching contact record is updated.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ubiquity.co.nz/documentation/channels/txt/txt-concepts.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
