# Pipedream

Use Rasket in Pipedream workflows and in the agents and apps built on Pipedream Connect. Send email and templates, keep your contacts up to date, and start a workflow when an email is delivered or a reply arrives.

> Coming soon: Rasket is not in Pipedream's app directory yet. This page describes the integration as it will ship.

## What you can do

| Action | What it does |
| --- | --- |
| Send Email | Sends an email from an address on one of your verified domains. |
| Send Template Email | Sends one of your published templates, filling in its variables. |
| Send Custom Event | Sends a custom event for a contact, which starts your automations. |
| Create or Update Contact | Adds a contact, or updates the one with that email address. |
| Update Topic Subscriptions | Subscribes a contact to topics, or unsubscribes them. |
| Add Contact to Segment | Adds an existing contact to one of your segments. |
| Add to Suppression List | Stops Rasket from sending any email to an address. |
| Get Email | Gets an email you sent, with its status. |
| Find Contact | Finds a contact by email address or ID. |
| List Contacts | Lists your contacts, or those in one segment. |

| Source | Emits an event when |
| --- | --- |
| New Email Event (Instant) | An email you sent is delivered, opened, clicked, bounces, or reaches another status you pick. |
| New Contact Created (Instant) | A contact is added to your audience. |
| New Email Received (Instant) | One of your receiving addresses gets an email. |

## Before you start

- **A verified sending domain,** for the send actions. The [domains guide](https://www.rasket.com/docs/domains) walks through adding one.
- **A Full access API key.** Sources create webhooks, and a Sending access key cannot.
- **Room for webhook endpoints,** for the sources. Each deployed source uses one of your plan's webhook endpoints.

## Connect your Rasket account

1. In Rasket, open API keys and create a key with **Full access**. Copy it: Rasket shows it once.
2. In Pipedream, add a Rasket step or source and choose to connect a new account. Paste the key.

The connection acts for the team the key belongs to. Deleting the key in Rasket stops every workflow that uses it. The [authentication guide](https://www.rasket.com/docs/authentication) explains keys and their access.

## Sources

Deploying a source creates a webhook endpoint in Rasket for exactly the events it listens for. Removing the source deletes the endpoint. You will see these under Webhooks; leave them to Pipedream.

Each event is checked against the endpoint's signing secret before the source emits it, and Rasket's retries of the same event are emitted once.

### New Email Event

Pick one or more **Events**: Sent, Delivered, Delivery delayed, Bounced, Marked as spam, Opened, Link clicked, Failed, Suppressed, Scheduled or Canceled. Each event carries the email (its ID, from, to, subject, Message-ID and tags) and the event's details. The [events guide](https://www.rasket.com/docs/events) explains each one.

### New Contact Created

No settings. Each event carries the contact's ID, email, name, unsubscribed state and segment IDs.

### New Email Received

No settings. Each event carries the sender, the recipients, the subject, the text and HTML bodies, and each attachment's file name. If the message cannot be read, the event still arrives, with `body_available` set to false. Set up receiving first: see the [receiving guide](https://www.rasket.com/docs/receiving).

## Actions

### Send Email

| Field | What to put in it |
| --- | --- |
| From | A list of `hello@` on each of your verified domains. Pick one, or type another address on those domains, such as `Name <you@example.com>`. |
| To | Required. Up to 50 addresses. |
| Subject | Required. |
| HTML Body, Text Body | Give one or both. |
| CC, BCC, Reply-To | Optional. One or more addresses each. |
| Tags | Optional name and value pairs, such as `{"invoice": "1042"}`. They are stored on the email and come back on its events. |
| Idempotency Key | Optional. Use something unique from the trigger, such as its ID. A second send with the same key within 24 hours returns the first email instead of sending again. |

The step returns the new email's ID, which later steps can use.

### Send Template Email

| Field | What to put in it |
| --- | --- |
| Template | Required. Pick a published template, or type its ID or alias. |
| Template variables | One field per variable of the template's published version. A variable with no fallback is required. Leave any other empty to use its fallback. Object and list variables take JSON. |
| More Variables | Optional variables by name, such as `{"first_name": "Ronald"}`, for a template that is mapped from an earlier step. The fields above win on the same name. |
| From, Subject | Optional. Leave them empty to use what the template sets. |
| To, CC, BCC, Reply-To, Tags, Idempotency Key | As for Send Email. |

### Create or Update Contact

| Field | What to put in it |
| --- | --- |
| Email | Required. The contact is matched on it: an existing contact is updated, not doubled. |
| First Name, Last Name | Optional. |
| Unsubscribed | Optional. True unsubscribes the contact from everything. Empty keeps their current state. Nothing here resubscribes someone who opted out. |
| Properties | Optional custom properties by key, such as `{"plan": "Pro"}`. A new key is created. |
| Add to Segments | Optional. Segments the contact is already in are kept. |
| Subscribe to Topics, Unsubscribe from Topics | Optional. Pick from your topics. |

### Contacts, segments, topics and events

- Update Topic Subscriptions, Add Contact to Segment, Send Custom Event and Find Contact take a **Contact**: an email address or a contact ID.
- Someone who unsubscribed from everything still gets no campaigns, whatever their topics say.
- A run that is replayed sends a custom event again.
- Find Contact returns nothing, rather than failing, when there is no such contact.
- List Contacts returns up to 1,000 contacts. Max Results sets how many.

## When something goes wrong

- **401 or 403:** the key was deleted, or it is not Full access. Create a new Full access key and reconnect.
- **A source will not deploy:** your plan's webhook endpoints may all be in use. Delete the ones you no longer need under Webhooks.
- **422 on a send:** the sender must be on a verified domain, and an email takes at most 50 recipients.
- **An event did not arrive:** open the webhook in Rasket to see each delivery attempt and replay it.
