# HubSpot recipes

> Text new contacts and deal changes from your own number, and log replies back on the contact.

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

## How HubSpot connects

- **[Zapier](https://getdogbot.com/docs/zapier)**: DogBot’s Zapier app has a Send Text action and instant triggers for incoming texts and every change of state.
- **[Make](https://getdogbot.com/docs/make)**: DogBot’s Make app sends texts and starts scenarios when a text comes in or changes state.
- **[API](https://getdogbot.com/docs/api)**: Your own code calls DogBot’s REST API and listens to its signed webhooks.

## Text new contacts from your form

| Part             | What it is                              |
| ---------------- | --------------------------------------- |
| Trigger          | HubSpot’s New Contact trigger in Zapier |
| Action           | DogBot’s **Send Text** action           |
| Connects through | [Zapier](https://getdogbot.com/docs/zapier)                  |

### Steps

1. Start a Zap with HubSpot’s New Contact trigger.
2. Add a Filter by Zapier step so only contacts who came from your form go on.
3. Add DogBot’s Send Text action and map the contact’s mobile phone number to To.
4. Write the text with the contact’s first name mapped in.

### Map the fields

| DogBot field                 | Map it to                                                                                                                                    |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| To                           | The person’s mobile number from HubSpot. US numbers can leave off the +1.                                                                    |
| Text                         | Hi {{first_name}}, this is Jordan with Bright Path. Thanks for your note. What’s the best time to talk this week?                          |
| `{{first_name}}` in the text | HubSpot’s first name field.                                                                                                                  |
| Metadata                     | `source` set to `hubspot`, 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 DogBot returned with `state: "queued"`. Then map HubSpot’s field back into **To** and turn the Zap on.

## Text when a deal moves stage

| Part             | What it is                                  |
| ---------------- | ------------------------------------------- |
| Trigger          | When a deal moves to a new stage in HubSpot |
| Action           | DogBot’s **Send Text** module               |
| Connects through | [Make](https://getdogbot.com/docs/make)                          |

### Steps

1. Start a scenario with HubSpot’s module that watches deals, filtered to one stage, such as Contract Sent.
2. Get the deal’s contact and their phone number.
3. Send the text with DogBot’s Send Text module.

### Map the fields

| DogBot field                 | Map it to                                                                                                                                    |
| ---------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| To                           | The person’s mobile number from HubSpot. US numbers can leave off the +1.                                                                    |
| Text                         | Hi {{first_name}}, the contract is in your inbox. Text me here if anything in it needs a second look.                                      |
| `{{first_name}}` in the text | HubSpot’s first name field.                                                                                                                  |
| Metadata                     | `source` set to `hubspot`, 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 **Run once**. A text arrives on your phone, and the module’s output shows the message with `state: "queued"`. Then map HubSpot’s field back into **To**.

## Log replies on the contact

| Part             | What it is                                                                   |
| ---------------- | ---------------------------------------------------------------------------- |
| Trigger          | DogBot’s New Incoming Text trigger in Zapier                                 |
| Action           | DogBot’s **New Incoming Text** trigger starts it, and HubSpot takes the text |
| Connects through | [Zapier](https://getdogbot.com/docs/zapier)                                                       |

### Steps

1. Start a Zap with DogBot’s New Incoming Text trigger.
2. Find the HubSpot contact whose phone number matches the sender’s number.
3. Add the text to that contact as a note.

### Map the fields

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

### Test it

Text your DogBot number from another phone, one you’ve texted through DogBot before, then press **Test trigger** in Zapier. It loads that text with its fields, ready to map. DogBot 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 DogBot cancels texts to them. [Stop words](https://getdogbot.com/docs/concepts/stop-words)
- A text that can’t go yet waits with a hold rather than failing: texting hours, your Mac away, a daily limit. [Holds](https://getdogbot.com/docs/concepts/holds)
- [HubSpot with DogBot](https://getdogbot.com/integrations/hubspot) on the integrations page says what else the two do together.
