> For the complete documentation index, see [llms.txt](https://help.qwary.com/product-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.qwary.com/product-guide/workflows/salesforce-workflow/create-an-email-campaign-for-salesforce-case-opportunity..md).

# Create an email campaign for Salesforce Case/Opportunity.

With a user-friendly interface and robust features, you can leverage Qwary's advanced survey capabilities to gather valuable feedback and insights directly from your customers, enhancing your understanding of their needs and preferences and enabling you to create impactful email campaigns that deliver results, all within the familiar and efficient Salesforce ecosystem.

**Create a survey and add questions. Once done, activate the survey.**

Click Project --> New Project and select a template or start from scratch. Qwary provides a wide range of question types to choose from when adding questions to your survey, including multiple-choice, rating, short answer, picture choice, ranking, form, slider, multiple choice grid, rating grid, Net Promoter Score, and image upload. Once questions are added, activate the survey.

**Create an app in Salesforce.**

Skip *this step if you already have an app created for Qwary.*

* Log into the salesforce account.&#x20;
* Open to Settings --> Setup.
* Go to platform tools --> App Manager & click 'New Connected App.'
* Enter the below information and click on 'Save.'
* After saving your record, Click on consumer details and save the consumer key and secret.&#x20;

<figure><img src="/files/j7PJRQtI2gGeEpWOKCpm" alt=""><figcaption><p>Create Salesforce App</p></figcaption></figure>

**Connect Qwary to Salesforce with scheduler workflow.**

1. Go to Workflows --> Create new workflow --> Select Schedule-based workflow, enter workflow name, and click 'Create.'
2. Click on 'Add Task.' There are three tasks to select from for Salesforce.&#x20;
   * Extract contact and/or account data from Salesforce Account.&#x20;
   * Send an email survey invite when the opportunity closes in Salesforce.
   * Send an email survey invite when the opportunity closes in Salesforce.
3. Select opportunity or case email campaign and click 'connect.'
4. Click on 'Connect' again from the Salesforce integration overview page.&#x20;
5. Enter the Salesforce account username, password, consumer key, and consumer secret (from step 2e)
6. You have successfully connected Qwary to your Salesforce account and will land on the task configuration page.

**Create an email campaign for Salesforce Case/Opportunity.**

1. Click 'Add Survey' on the task configuration page to select the survey for the email campaign (from step 1)
2. Depending on the task type (Case or Opportunity), the SOQL query will be auto-populated. Caution: Changing this query can have an adverse effect. Please use [Salesforce Workbench](https://workbench.developerforce.com/) to create a custom, SOQL Query.
3. Compose email
   * Enter from name
   * Enter reply to email address(optional)
   * Enter subject
   * Click 'Edit this message' to edit the message—Toggle 'Embed First Question' to embed the first question in the email body. Email for the first question is applicable when you have NPS, Rating Question, or multiple choice question as the survey's first question.&#x20;
4. Select schedule
   * Send email immediately - Check this option to send a survey invitation immediately when the case/opportunity is closed or a custom SOQL Query is evaluated true.
   * Send an invite with a delay - Check this option to send a survey invitation later after the case/opportunity is closed, or a custom SOQL Query is evaluated as true.
   * Reminder - Select this option to send a reminder email if participants have yet to respond to the original invitation.
     * Enter days to wait before sending a reminder email.
     * Enter reminder subject
5. Click on 'Save' for the task to save the task.

**Define Schedule**

Define a schedule for the task to run. Qwary runs SOQL query periodically to check if a new case/opportunity matching the defined criteria is found.

1. Schedule by minutes - runs the workflow every defined minute.
2. Schedule by hours - runs the workflow every defined hour.
3. Schedule daily - runs the workflow daily.
4. Schedule weekly - runs the workflow weekly.
5. Schedule monthly - runs workflow monthly.
6. Schedule yearly - runs workflow yearly.

**Active the workflow**

Click on the workflow menu to activate the workflow.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.qwary.com/product-guide/workflows/salesforce-workflow/create-an-email-campaign-for-salesforce-case-opportunity..md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
