# HighLevel recipes

> Send texts from HighLevel workflows through your own number instead of a rented one.

Three recipes for HighLevel. Each names its trigger and the BlueBot step, lists the fields to map and says how to test it with your own number before anyone else gets a text.

## How HighLevel connects

- **[Zapier](https://usebluebot.com/docs/zapier)**: BlueBot’s Zapier app has a Send Text action and instant triggers for incoming texts and every change of state.
- **[Text Hook](https://usebluebot.com/docs/text-hooks)**: A Text Hook is a BlueBot address the app posts its own webhook to. You map its fields to a recipient and a template, and each post becomes a text.
- **[API](https://usebluebot.com/docs/api)**: Your own code calls BlueBot’s REST API and listens to its signed webhooks.

## Text from a HighLevel workflow

| Part             | What it is                                          |
| ---------------- | --------------------------------------------------- |
| Trigger          | A HighLevel workflow reaches its webhook action     |
| Action           | A BlueBot **Text Hook** turns each post into a text |
| Connects through | [Text Hook](https://usebluebot.com/docs/text-hooks)                       |

### Steps

1. Make a Text Hook in BlueBot and copy its address.
2. Add a webhook action to your HighLevel workflow and paste the address.
3. Run the workflow once, then map the contact’s phone and first name from the payload BlueBot kept.
4. Write the template, and each run of the workflow sends a text from your number.

### Map the fields

| Text Hook setting | Set it to                                                                                                                   |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------- |
| Recipient         | The field in HighLevel’s post that holds the person’s phone number, written as a path such as `{{body.phone}}`.             |
| Text              | Hi {{body.first_name}}, it’s Alex from Summit Fitness. Your intro session is booked. Reply here if you need to change it. |
| Metadata          | `source` set to `gohighlevel`. BlueBot adds the hook’s id by itself.                                                        |

### Test it

Post a sample to the hook’s address with your own number in the phone field, as below. A text arrives on your phone, and the hook’s page lists the post.

```bash title="A test post shaped like HighLevel’s"
curl -X POST "https://usebluebot.com/h/YOUR_HOOK_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"phone":"+15555550123","first_name":"Maria"}'
```

## Text new contacts

| Part             | What it is                             |
| ---------------- | -------------------------------------- |
| Trigger          | When a contact is created in HighLevel |
| Action           | BlueBot’s **Send Text** action         |
| Connects through | [Zapier](https://usebluebot.com/docs/zapier)                 |

### Steps

1. Start a Zap with HighLevel’s trigger for a new contact.
2. Add BlueBot’s Send Text action and map the contact’s phone to To.
3. Write the text with their first name mapped in.

### Map the fields

| BlueBot field                | Map it to                                                                                                                                        |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| To                           | The person’s mobile number from HighLevel. US numbers can leave off the +1.                                                                      |
| Text                         | Hi {{first_name}}, thanks for signing up! This is Alex at Summit Fitness. Want to book a free intro session?                                   |
| `{{first_name}}` in the text | HighLevel’s first name field.                                                                                                                    |
| Metadata                     | `source` set to `gohighlevel`, and `record_id` set to the record’s id, so the status and reply webhooks for this text can find the record again. |
| Service                      | Auto, the default: iMessage when the person uses it, otherwise SMS through your iPhone.                                                          |

### Test it

Put your own number in **To** and press **Test step**. A text arrives on your phone from your own number, and Zapier shows the message BlueBot returned with `state: "queued"`. Then map HighLevel’s field back into **To** and turn the Zap on.

## Add replies to the contact

| Part             | What it is                                                               |
| ---------------- | ------------------------------------------------------------------------ |
| Trigger          | A text comes in (BlueBot’s message.received webhook)                     |
| Action           | A webhook for `message.received` starts it, and HighLevel takes the text |
| Connects through | [API](https://usebluebot.com/docs/api)                                                         |

### Steps

1. Point a BlueBot webhook for message.received at your own endpoint.
2. Find the contact by the sender’s number through HighLevel’s API.
3. Add the reply to the contact as a note so it shows on their record.

### Map the fields

| From BlueBot       | Into HighLevel                                                                                                                                             |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `data.from`        | The phone number to find the person by in HighLevel. It’s in E.164 (`+15555550123`); search by the last 10 digits if HighLevel stores numbers another way. |
| `data.text`        | The words, for a note, a row or a message. Null when the person sent only a picture.                                                                       |
| `data.received_at` | When it came in, in UTC.                                                                                                                                   |
| `data.files`       | Pictures and voice memos. Each `url` works for an hour, so copy a file you want to keep.                                                                   |
| `data.chat_id`     | Set when the text came in a group chat; null for a one-to-one text.                                                                                        |

### Test it

Run `bluebot listen --forward-to http://localhost:3000/webhooks`, then text your BlueBot number from another phone. The CLI forwards the event to your handler, signed. BlueBot copies texts from people you’ve texted through it, unless you set **Which chats to copy** to **Everything**.

## Before you turn it on

- Text only people who asked to hear from you. Anyone who replies STOP goes on your stop list, and BlueBot cancels texts to them. [Stop words](https://usebluebot.com/docs/concepts/stop-words)
- A text that can’t go yet waits with a hold rather than failing: quiet hours, your Mac away, a daily limit. [Holds](https://usebluebot.com/docs/concepts/holds)
- [HighLevel with BlueBot](https://usebluebot.com/integrations/gohighlevel) on the integrations page says what else the two do together.
