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

[NV-1007] Create webhook parser for Mandrill (email) #4798

Closed
davidsoderberg opened this issue Nov 9, 2023 · 1 comment
Closed

[NV-1007] Create webhook parser for Mandrill (email) #4798

davidsoderberg opened this issue Nov 9, 2023 · 1 comment
Labels
@novu/api webhooks Created by Linear-GitHub Sync

Comments

@davidsoderberg
Copy link
Contributor

Why

To be able to give better answers why a message was not sent to a subscriber we need to get some info from the provider with a webhook. (deliverability status, rejection status etc).

How

To do this we need to implement these functions inside of the provider:

  getMessageId?: (body: any | any[]) => string[];

  parseEventBody?: (
    body: any | any[],
    identifier: string
  ) => IEmailEventBody | undefined;

The getMessageId needs to return all identifiers that should be the same value as id that is returned from sendMessage with help of this we can connect a webhook to the specific message.

parseEventBody will get the full webhook body and the current identifier that the body should be parsed for. If there is nothing to parse the method should return undefined.

All returns that is not undefined should be an object that is in this format:

status: string;

 date: string;

externalId?: string;

attempts?: number;

response?: string;

// Contains the raw content for message from the provider webhook

row?: string;

Note that statuses for email needs to be value from EmailEventStatusEnum and sms should have a status from SmsEventStatusEnum.

Example of how to do it can be found in SendgridEmailProvider.

From SyncLinear.com | NV-1007

@davidsoderberg davidsoderberg added @novu/api webhooks Created by Linear-GitHub Sync labels Nov 9, 2023
Copy link

github-actions bot commented Nov 9, 2023

Hi, I'm Jarvis 🤖%0A%0AI'm a bot built to help you with your contribution to Novu. %0AI will add instructions and guides on how to run the subset of the Novu platform associated to this issue and make your first contribution.%0A%0AThis issue was tagged as related to @novu/api and the related code is located at the apps/api folder, here is how I can help you:%0A%0A

%0A First time contributing to Novu?%0A%0A If that's the first time you want to contribute to Novu here are a few simple steps to get you started:%0A 1. Fork the repository and clone your fork to your local machine.%0A 2. Install the dependencies using npm run setup:project.%0A 3. Create a new branch with the number of the issue, for example: 1454-fix-something-cool and start contributing based on the Contributing Guide or the short guide in the section below.%0A 4. Create a Pull request and follow the template of creation %0A
%0A%0A
%0A Run and test @novu/api locally%0A%0A ### Run API in watch mode%0A The easiest way to start the API is to run npm run start:api from the root of the repository%0A%0A ### Run API integration tests%0A To validate your changes or simply to run the e2e tests run npm run start:e2e:api. All the e2e tests have the .e2e.ts suffix and usually are located near the controller files of each module.%0A

@scopsy scopsy closed this as completed Nov 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@novu/api webhooks Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

2 participants