Skip to content

Commit

Permalink
feat(join): use zammad api (3)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil committed Dec 20, 2023
1 parent 623b13a commit 1c7b77c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/connectors/sendZammadMail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import { sampleSize } from "lodash";
import path from "node:path";
import { DO_NOT_SEND_MAIL, ZAMMAD_TOKEN, ZAMMAD_URL } from "../config/env";
import { render } from "../services/renderer";
import { LocalTemplateSlug } from "./sendinblue";
import { LocalTemplate } from "./sendinblue";

//

const CLOSED_STATE_ID = "4";
const CREATE_TICKET_ENDPOINT = `${ZAMMAD_URL}/api/v1/tickets`;
const EMAIL_TYPE_ID = 1;
const FROM_MON_COMPTE_PRO = "MonComptePro";
const GROUP_MON_COMPTE_PRO = "MonComptePro";
const GROUP_MON_COMPTE_PRO_SENDER_ID = 1;
const MODERATION_TAG = "moderation";
Expand All @@ -25,15 +24,11 @@ export async function sendZammadMail({
subject,
template,
params,
senderEmail = "[email protected]",
}: {
to: string[];
cc?: string[];
subject: string;
template: LocalTemplateSlug;
params: any;
senderEmail?: string;
}) {
} & LocalTemplate) {
const body = await render(
path.resolve(`${__dirname}/../views/mails/${template}.ejs`),
params,
Expand Down
5 changes: 5 additions & 0 deletions src/connectors/sendinblue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ export type LocalTemplateSlug =
| "welcome"
| "moderation-processed";

export type LocalTemplate = {
template: "unable-to-auto-join-organization";
params: { libelle: string };
};

// active templates id are listed at https://app-smtp.sendinblue.com/templates
const remoteTemplateSlugToSendinblueTemplateId: {
[k in RemoteTemplateSlug]: number;
Expand Down

0 comments on commit 1c7b77c

Please sign in to comment.