> ## Documentation Index
> Fetch the complete documentation index at: https://help.ciarem.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send WhatsApp from a HubSpot workflow

> Add the Send a WhatsApp template action to a HubSpot workflow, so every record it enrolls gets an approved WhatsApp template from Ciarem.

Once [HubSpot is connected](https://help.ciarem.ai/integrations/hubspot.md), your HubSpot workflows get a Ciarem action called **Send a WhatsApp template**. When a contact reaches it, Ciarem sends them an approved WhatsApp [template](https://help.ciarem.ai/channels/message-templates.md). In a company or deal workflow, it sends to the contacts associated with the record.

Use it to message a contact when something happens in HubSpot: they become a lead, their deal moves to a new stage, or their meeting is a day away.

## Before you start

* HubSpot is connected to Ciarem and its setup is finished. See [HubSpot](https://help.ciarem.ai/integrations/hubspot.md).
* You have at least one connected [WhatsApp number](https://help.ciarem.ai/channels/connect-whatsapp.md) and one approved template.
* Your HubSpot plan includes workflows, and you can create and edit them. If it doesn't, [send to a HubSpot list](https://help.ciarem.ai/integrations/hubspot/lists.md) instead.

## Add the action to a workflow

**1. Open or create a workflow**

In HubSpot, go to **Automation**, then **Workflows**. Open a workflow, or create one based on contacts, companies or deals and set its enrollment triggers.

**2. Add the Ciarem action**

Click **+** where the message should go. In **Choose an action**, go to **Integrated apps**, expand **Ciarem** and choose **Send a WhatsApp template**.

**3. Choose who receives it**

**Target record** starts on **Enrolled contact**, which sends to the contact the workflow enrolled. To send to the contacts of a related record instead, pick **Company: Most recently updated** or **Deal: Most recently updated**. See [Companies and deals](#companies-and-deals).

**4. Choose the WhatsApp number**

In **WhatsApp number**, pick the Ciarem number the message is sent from.

**5. Choose the template**

In **Template**, pick one of that number's approved templates. Each template shows its language and category, and the names of its variables if it has any.

**6. Fill in the variables, if the template has any**

In **Variable values (JSON)**, give one value per variable, using the variable's name or number as the key. A value is fixed text, or a contact property such as `{{contact.first_name}}` that fills in from each contact.

```json theme={null}
{
  "1": "{{contact.first_name}}",
  "2": "Monday at 10:00"
}
```

Leave the box empty when the template has no variables.

![The Send a WhatsApp template action in a HubSpot workflow, with Target record, WhatsApp number, Template and Variable values (JSON) filled in](https://mintcdn.com/ciaremaai/VapWOXd5thwocBcz/images/ciarem-help-hubspot-workflow-action.png?fit=max\&auto=format\&n=VapWOXd5thwocBcz\&q=85\&s=5a75819c3f89ee607f438999418e3ede)

**7. Save and turn the workflow on**

Save the action, review the workflow and turn it on. From then on, every enrolled record that reaches this step gets the template.

A contact property in a variable comes from the data Ciarem syncs: the contact's name, phone and email, plus the properties you picked in [Property mapping](https://help.ciarem.ai/integrations/hubspot.md#what-syncs). Just before sending, Ciarem reads those mapped properties from HubSpot again, so a value that an earlier step of the workflow changed is normally the one sent.

## Companies and deals

When the workflow is based on companies or deals, or **Target record** is a company or a deal, the action sends to every contact associated with that record, up to 25. If the record has more than 25 associated contacts, nobody gets the message and the step fails. Use a contact-based workflow to reach all of them.

HubSpot shows one result for the step. It counts as a success when at least one contact got the message. The step's action results list who got it (**sentTo**) and who didn't, with the reason (**notSent**).

Workflows based on other records, such as tickets or leads, don't offer the action.

## What happens when it runs

* **The step waits for the send.** HubSpot shows the step as in progress with "Queued: Ciarem is sending the template and will finish this step shortly." It then turns into a success or a failure with a reason. Either way, the workflow carries on with its next action. If a step hasn't finished within an hour, HubSpot fails it, and Ciarem doesn't send the message after that.
* **It is a real WhatsApp message.** It is charged to your WhatsApp wallet at Meta's rate, like any template. See [WhatsApp costs and the 24-hour window](https://help.ciarem.ai/billing/whatsapp-costs-and-templates.md).
* **It shows up in both places.** The send is logged on the contact's HubSpot timeline, and the message appears in the Ciarem [Inbox](https://help.ciarem.ai/using-ciarem/inbox.md).
* **The AI agent answers the reply.** When the contact had no open conversation, the message starts one handled by the AI, so their reply gets an answer right away. An open conversation keeps whoever was handling it: a teammate, the AI, or the WhatsApp Business app.
* **Each enrollment sends once.** If the workflow allows re-enrollment, a contact who enrolls again gets the template again, and it is charged again.
* **Opt-outs are respected.** Marketing templates are not sent to contacts who [opted out of marketing](https://help.ciarem.ai/channels/whatsapp-marketing-opt-out.md).

## If something is not working

When a step fails, open the workflow's history in HubSpot and find the enrolled record. The step shows one of these messages.

| What you see | What to do |
| - | - |
| The action is not in the actions panel | The workflow is not based on contacts, companies or deals. Create it on one of those. Also check that **Ciarem** is listed in HubSpot's **Settings > Integrations > Connected apps**. |
| **WhatsApp number** or **Template** has no options | Ciarem has no connected WhatsApp number, or the number has no approved template. Check both in Ciarem. |
| A template is missing from the list | Only approved templates of the chosen number are listed. Templates that need a button code, a dynamic link, a countdown, or a header file that Ciarem doesn't have stored can't be sent from HubSpot. |
| **This portal is no longer connected to Ciarem.** | Connect HubSpot again in Ciarem, under **Settings > Integrations > HubSpot**. |
| **This contact has not synced to Ciarem yet.** | Check that your [import filters](https://help.ciarem.ai/integrations/hubspot.md#what-syncs) include the contact. If the workflow starts the moment a contact is created, add a short delay before the Ciarem action so the contact has time to sync. Re-enroll the contact once it has synced. |
| **Another HubSpot contact has the same phone number, email or Instagram handle** | Merge the two contacts in HubSpot, or correct one of them. The other contact's record ID is in the step's details. See [Contacts not imported](https://help.ciarem.ai/integrations/hubspot.md#contacts-not-imported). |
| **This contact has no WhatsApp-reachable phone number.** | Add the contact's WhatsApp number in HubSpot, with its country code, for example +52. |
| **The selected template is no longer approved, or no longer exists.** | Open the action and choose another template. |
| **A template variable has no value** | Give every variable a value in **Variable values (JSON)**, and check that the contact has every property the template uses. |
| **The Ciarem WhatsApp wallet has insufficient balance.** | Top up your WhatsApp wallet in Ciarem. See [Plans and billing](https://help.ciarem.ai/billing/plans-and-billing.md). |
| **This WhatsApp account has reached the number of new conversations Meta allows it to start in 24 hours.** | Wait for the 24-hour window to free up, then re-enroll the contacts who didn't get it. |
| **The contact opted out of WhatsApp marketing, so the marketing template was not sent.** | Nothing to fix: the contact asked not to get marketing messages. See [WhatsApp marketing opt-out](https://help.ciarem.ai/channels/whatsapp-marketing-opt-out.md). |
| **This record has more than 25 associated contacts.** | Use a contact-based workflow to reach all of them. |
| **This record has no associated contacts to send to.** | Associate the contacts with the company or deal in HubSpot. |
| **Ciarem does not have permission to read this record's contacts.** | In Ciarem, open **Settings > Integrations > HubSpot** and click **Grant access** on the banner. |
| **WhatsApp rejected the message.** | The step's details carry WhatsApp's reason. If it keeps happening, [report a problem](https://help.ciarem.ai/getting-started/report-a-problem.md). |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.