# Sending Signals from Marketo

> Source: https://docs.trailspark.ai/docs/marketo-webhook-setup

## Overview

The direct Marketo integration has been deprecated. Send Marketo activity data to TrailSpark using a webhook called from Smart Campaign flow steps. This approach gives you full control over which activities generate signals and what data is included.

## Webhook Endpoint

```
POST https://app.trailspark.ai/api/signal-staging/webhook/{apiKey}
```

- Content-Type: `application/json`
- Response: HTTP 202 on success

Create an API key at **Settings** > **API Keys** with endpoint type **Signal Staging**. See [Managing API Keys](/docs/api-keys) for details.

## Creating the Webhook in Marketo

Go to **Admin** > **Webhooks** > **New Webhook** and configure:

| Field | Value |
|-------|-------|
| **Webhook Name** | TrailSpark Signal |
| **URL** | `https://app.trailspark.ai/api/signal-staging/webhook/YOUR_API_KEY` |
| **Request Type** | POST |
| **Request Token Encoding** | JSON |
| **Response Type** | None |

In the **Template** field, paste the JSON payload below.

## JSON Payload Template

```json
{
  "email": "{{lead.Email Address}}",
  "event": "{{member.status}} - {{program.name}}",
  "source": "marketo",
  "properties": {
    "lead_id": "{{lead.Id}}",
    "first_name": "{{lead.First Name}}",
    "last_name": "{{lead.Last Name}}",
    "company": "{{lead.Company}}",
    "title": "{{lead.Job Title}}"
  }
}
```

`{{member.status}} - {{program.name}}` allows you to repurpose the same webhook for multiple programs and statues. For example, you could send both registered and attended as separate signals for Webinars. Think of the `event` as the unique signal you want to register in Trailspark which your signal mapping rules match against.

## Smart Campaign Examples

Each example below assumes the TrailSpark Signal webhook has already been created in Admin.

### Form Fills

Capture demo requests, contact form submissions, and content downloads.

**Smart List:**
- Trigger: **Program Status Changed**
- Constraint: New Status is **Filled Out Form**

**Flow:**
1. Call Webhook > TrailSpark Signal

The `{{member.status}} - {{program.name}}` token automatically captures the name and member status for the program.

### Program Status Changes

Captures webinar attendance, event participation, and nurture engagement.

**Smart List:**
- Trigger: **Program Status Changed**
- Constraint: New Status is **Registered/Attended** 

**Flow:**
1. Call Webhook > TrailSpark Signal

The `{{member.status}} - {{program.name}}` token automatically captures the name and member status for the program.

### Interesting Moments and Key Activities

Captures high-value actions flagged by other campaigns or integrations.


## Best Practices

- **Be selective.** Only send signals relevant to behavior scoring -- demo requests, pricing page visits, content downloads, webinar attendance. Not every Marketo activity needs to reach TrailSpark.
- **Use consistent program naming.** Signal mapping rules can match patterns in `properties.program_name`. Consistent naming (e.g., "Webinar - Topic Name", "Ebook - Title") simplifies rule creation.
- **Watch signal volume.** Each webhook call counts against your plan's signal limit. Audit which Smart Campaigns call the webhook periodically.
- **Test before activating.** Trigger the Smart Campaign for a single test lead, then check the **Signal Queue** in TrailSpark to confirm the signal arrived with the expected fields.

## Troubleshooting

**Signals not appearing in TrailSpark** -- Verify the API key is active and not expired. Confirm the webhook URL contains the correct key. Check that the Smart Campaign is activated (not just created). Look at the Marketo webhook call log under **Admin** > **Webhooks** > **Activity Log** for errors.


**HTTP 401 from TrailSpark** -- The API key is invalid, expired, or deactivated. Generate a new key at **Settings** > **API Keys**.

**HTTP 429 from TrailSpark** -- Signal limit reached. Review which Smart Campaigns are calling the webhook and narrow the scope. Consider upgrading your plan or enabling overages.

**Tokens not resolving** -- Marketo tokens must use exact field names including spaces (e.g., `{{lead.Email Address}}`, not `{{lead.email}}`). Check Marketo's token reference for correct syntax.

## Next Steps

- [Webhook Payload Format](/docs/webhook-payload-format) -- full field reference for signal payloads
- [Creating Signal Mapping](/docs/creating-signal-mapping) -- set up rules to match incoming Marketo signals
- [API Keys](/docs/api-keys) -- manage keys and configure secrets