Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update subject line #1636

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions server/src/send-update/send-update.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ConfigService } from "../config/config.service";
import { Client } from "@sendgrid/client";
import { MailService } from "@sendgrid/mail";
import * as Sentry from "@sentry/nestjs";
import moment from 'moment';

type HttpMethod = 'get' | 'GET' | 'post' | 'POST' | 'put' | 'PUT' | 'patch' | 'PATCH' | 'delete' | 'DELETE';

Expand Down Expand Up @@ -50,13 +51,15 @@ export class SendUpdateService {
* @returns {object}
*/
async createSingleSendProjectUpdate(id: string, emailHtml: string, segmentId: string) {
const date = Date();
const formattedDate = moment(date).format('MM-DD-YYYY');
const data = {
name: "Single Send Test 2024-12-10 v3",
name: `ZAP Update ${formattedDate} - Status Change`,
send_to: {
segment_ids: [segmentId]
},
email_config: {
subject: "Single Send Test 2024-12-10 v3",
subject: `ZAP Update ${formattedDate} - Status Change`,
html_content: emailHtml,
generate_plain_content: true,
custom_unsubscribe_url: `https://${this.environment === "production" ? "zap.planning.nyc.gov" : "zap-staging.planninglabs.nyc"}/subscribers/{{${this.environment === "production" ? "zap_production_id" : "zap_staging_id"}}}`,
Expand Down
Loading