# TXT Programmes

A TXT Programme is the foundation of UbiQuity TXT. Programmes manage inbound TXT messages using a workflow of steps, and can also be configured to send outbound TXT Outs to contacts in your UbiQuity database.

Before you can use TXT, the UbiQuity team will need to enable the TXT module on your account and set up your shortcode. Once that is done, you are ready to create your first programme.

***

### Creating a TXT Programme

When creating a new TXT Programme, you will be prompted to choose a programme type:

| Option                             | Description                                                                                                                                                                                                                         |
| ---------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Send TXTs to my database           | Configures the programme to send TXT Outs to contacts in your UbiQuity database. Requires a database opt-in field to manage STOP requests.                                                                                          |
| Provide a TXT subscription service | Allows contacts to subscribe by texting in the keyword. Adds or updates the contact in your database and sets their opt-in field to Yes. Also enables TXT Outs to these contacts.                                                   |
| Collect email addresses            | Accepts an inbound TXT containing the keyword followed by an email address (e.g. *SUBSCRIBE* [*john@example.com*](mailto:john@example.com)). Validates the email address and adds or updates the matching contact in your database. |
| Build my own inbound programme     | Starts with a blank workflow for you to build from scratch.                                                                                                                                                                         |

***

### Programme settings

Any inbound TXT message starting with your configured keyword will trigger this programme.

For time-based promotions, you can set an optional start and/or end date. If the message arrives outside these dates, the programme will run the steps defined in the **Too Early** or **Too Late** workflow instead of the standard flow.

If you are using the UbiQuity API to send TXT messages and want delivery receipts, enter your endpoint URL in the **API Message Status URL** field. UbiQuity will return the message ID, status, and timestamp for each message sent via the API.

***

### Building the workflow

When an inbound TXT arrives with the matching keyword, the programme runs its workflow steps in sequence. You build the workflow by dragging widgets onto the canvas.

#### Receive and Process

This is always the first widget in a workflow. It waits for an inbound TXT message to arrive and can optionally validate the content.

The keyword is automatically stripped from the incoming message. The remaining content is available positionally — the first word after the keyword is position 1, the second is position 2, and so on. You can assign variable names to these positions for use in later widgets.

#### Send TXT

Sends a TXT message to the contact. You can use merge fields to personalise the message, including any variable names assigned in the Receive and Process widget.

#### Database Lookup

Checks whether a matching record exists in your UbiQuity database. You specify which database field to match against and what value to compare it to. If a match is found, the widget is successful and the workflow continues down the success path.

#### Database Update

Updates or adds a record in your UbiQuity database. Inbound TXT messages do not automatically update the database - you must use this widget to write any data.

Set the **Update Type** to:

| Option     | Behaviour                                                               |
| ---------- | ----------------------------------------------------------------------- |
| Add        | Adds a new contact to the database.                                     |
| Update     | Updates an existing contact. Use Match Criteria to identify the record. |
| Add/Update | Adds the contact if they do not exist; updates them if they do.         |

If your database has mandatory fields (such as email address), an attempt to add a contact without those fields will fail. Database rules are managed under **Database > Edit Database Fields**. If your database rules are restrictive, you may want to create a separate UbiQuity account for TXT.

#### Web Request

Calls a URL when the workflow reaches this step. By default, UbiQuity makes the request in the background and immediately moves to the next step. You can optionally wait for a response and then branch based on success or failure (anything other than a 200 response is treated as a failure).

This widget can be used to call any URL, including the UbiQuity API.

#### Conditional Branching

Routes the workflow to different steps based on conditions you define. You can branch on database fields, values received in the TXT message, or variable names assigned earlier in the workflow.

***

### Tracking links

You can track links included in your TXT Programme for reporting purposes, and to use link click data for targeting future TXT Outs.

When a link is tracked, it is converted to a shortened URL in the outgoing message. By default, shortened URLs begin with *t.uq.nz*. This can be customised to use your own domain - contact UbiQuity to arrange this.

If you do not want a link to be shortened or tracked, untrack it on the Track Links screen. Untracked links will display as entered and will not appear in click reports.

Use **Get Friendly Names** to automatically fetch the page title for each link, making reports easier to read. If your website uses Google Analytics, you can also append tracking codes to links from this screen.

***

### Configuring for TXT Outs

To send TXT Outs from a TXT Programme, the programme must be configured for TXT Outs. This can be done during the create wizard or at any time afterwards.

Configuring for TXT Outs requires you to select or create a database opt-in field. When a contact replies STOP, UbiQuity sets this field to No and excludes the contact from future TXT Outs for this programme.

If you allow UbiQuity to create the field, it will be named after the TXT Programme. You can set up steps in the workflow so that a contact texting in automatically sets this field to Yes.

For more detail on how STOP messages are handled, see TXT Concepts.


---

# 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-programmes.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.
