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

Add Typescript types for SMS Status Callbacks #802

Open
emagaram opened this issue Oct 11, 2022 · 16 comments
Open

Add Typescript types for SMS Status Callbacks #802

emagaram opened this issue Oct 11, 2022 · 16 comments
Labels
status: waiting for feature feature will be implemented in the future type: twilio enhancement feature request on Twilio's roadmap

Comments

@emagaram
Copy link

I'm pretty sure there are no typescript types for SMS Status Callback Webhooks. Could you add this in the future? Thanks!

@beebzz
Copy link

beebzz commented Oct 17, 2022

Hi @emagaram, thanks for posting an issue! Could you specify where this typing is missing? I see that status callbacks for SMS messages are typed as strings here.

@beebzz beebzz added type: question question directed at the library status: waiting for feedback waiting for feedback from the submitter labels Oct 17, 2022
@emagaram
Copy link
Author

I was referring to the HTTP body that the webhook sends. Something like this:

type SMSStatusWebhook = {
  SmsSid: string;
  SmsStatus: "accepted" | "scheduled" | "queued" | "sending" | "sent";
  MessageStatus: string;
  To: string;
  MessagingServiceSid: string;
  MessageSid: string;
  AccountSid: string;
  From: string;
  ApiVersion: string;
};

@beebzz
Copy link

beebzz commented Oct 19, 2022

Ah I see. We'll add this issue to our backlog to be prioritized (internal reference: DI-2383). +1s and comments on the issue summary will help it move up the backlog.

@childish-sambino childish-sambino added type: twilio enhancement feature request on Twilio's roadmap status: waiting for feature feature will be implemented in the future and removed type: question question directed at the library status: waiting for feedback waiting for feedback from the submitter labels Nov 22, 2022
@PCOffline
Copy link

PCOffline commented Jan 30, 2023

Bumping this, also I defined some types myself in one of my projects where I used Status Callbacks:

export enum OutboundSmsStatuses {
    sent = 'sent',
    delivered = 'delivered',
    undelivered = 'undelivered',
    failed = 'failed',
    queued = 'queued',
}

export enum InboundSmsStatuses {
  receiving = 'receiving',
  received = 'received',
}

export interface StatusCallback {
    AccountSid: `AC${string}`;
    MessageSid: `SM${string}`;
    SmsSid: `SM${string}`;
    MessageStatus: OutboundSmsStatuses | InboundSmsStatuses;
    SmsStatus: OutboundSmsStatuses | InboundSmsStatuses;
    From: `+${number}`;
    To: `+${number}`;
    ApiVersion: `${number}-${number}-${number}`;
}

As you may notice this is using TypeScript's Template Literal Types

@PCOffline
Copy link

PCOffline commented Jan 30, 2023

There are a few more statuses like 'accepted' and 'scheduled' that I am not sure where to place but this is the gist of it.
I am not sure if there are differences in fields' values like SmsSid vs MessageSid, MessageStatus and SmsStatus etc. but that's up to the reviewers

@vinicius73
Copy link

Previously, in v3 MessageStatus was exported.
Now in v4, is not exported anymore.

There is a reason for that?

b471067#diff-2adf184f135ba5d85051c5b5f187adf3d9eb878362c5a04be926ef951b1ff5afL477

@Hunga1
Copy link
Contributor

Hunga1 commented Feb 17, 2023

Hi @vinicius73. Thanks for pointing this out. We'll add this issue to our backlog to be prioritized (internal reference: DI-2576). +1s and comments on the issue summary will help it move up the backlog.

In the future, please open a new issue thread so that we can better triage the issue, help to avoid potentially missing your comment, and help track the progress individually from the OP.

@PCOffline
Copy link

And any news about adding Status Callback type, as per the suggestion above or in general?

@childish-sambino
Copy link
Contributor

@PCOffline We have this on our internal backlog (DI-2383).

@vinicius73
Copy link

Thanks @Hunga1

@claudiachua
Copy link

This issue has been added to our internal backlog to be prioritized as it changes generated configuration. +1s on the issue summary will help it move up the backlog (DI-2383).

@otowncaleb
Copy link

It would of course be quite nice if Twilio provided types for all the different webhook request bodies, including SMS and Voice. This issue has a common thread with #588 which I see has also been marked as DI-2383 on Twilio's internal backlog.

Can anyone (perhaps @claudiachua) speak to the current status of DI-2383? How far down the backlog is it? I would hope Twilio considers DX a priority. 🙂

@PCOffline
Copy link

PCOffline commented Dec 12, 2023

Yeah this issue has been stale for over a year. The change is small enough to take a day of work for me, which would include both research about every field and actual code, so I'd assume it'd take even less time for a Twilio employee familiar with the codebase and API.

@PCOffline
Copy link

Hey, @Hunga1, @claudiachua, any updates on this? I don't see a reason why such a small change would take over a year.

@otowncaleb
Copy link

Yeah this issue has been stale for over a year. The change is small enough to take a day of work for me, which would include both research about every field and actual code, so I'd assume it'd take even less time for a Twilio employee familiar with the codebase and API.

@PCOffline Would you perhaps have the bandwidth to submit a PR? I wonder if Twilio would take it given the right conditions.

@PCOffline
Copy link

@otowncaleb ill try :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting for feature feature will be implemented in the future type: twilio enhancement feature request on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

8 participants