novuhq / novu

Open-Source Notification Platform. Embeddable Notification Center, E-mail, Push and Slack Integrations.
https://novu.co
Other
34.53k stars 3.53k forks source link

[NV-1012] - Create webhook parser for Telnyx (sms) #1646

Closed novubot closed 1 year ago

novubot commented 1 year ago

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.

maxslimb commented 1 year ago

I would like to work on this!

ksjadeja commented 1 year ago

Hi @scopsy, I would also like to work on this issue, if possible.

ainouzgali commented 1 year ago

Hi @abhilipsasahoo03 , please notice that this issue has already been assigned. Please avoid working on assigned issues. @maxslimb, as you were assigned a few days after you asked to be, I just want to make sure you are still willing to work on this.

abhilipsasahoo03 commented 1 year ago

Hi @abhilipsasahoo03 , please notice that this issue has already been assigned. Please avoid working on assigned issues. @maxslimb, as you were assigned a few days after you asked to be, I just want to make sure you are still willing to work on this.

Hi, I'm extremely sorry, somehow I missed out on the assignment! I'll take care of this next time onwards.

maxslimb commented 1 year ago

@ainouzgali Yes, I am working on this issue, will put a pr soon