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

Attachments: implementation and docs not corresponding with api specification for attachments #1259

Closed
jaun-rg opened this issue Feb 25, 2021 · 1 comment · Fixed by #1261
Labels
status: work in progress Twilio or the community is in the process of implementing type: docs update documentation change not affecting the code

Comments

@jaun-rg
Copy link

jaun-rg commented Feb 25, 2021

Issue Summary

implementation and docs not corresponding with api specification for attachments

Your documentation Email Use Cases: Attachments and types in this project consider using contentId for attachments;

The api's reference specifies content_id; please update implementation and docs

Steps to Reproduce

use example in Email Use Cases: Attachments

Code Snippet

using example

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
  to: '[email protected]',
  from: '[email protected]',
  subject: 'Hello attachment',
  html: '<p>Here’s an attachment for you!</p>',
  attachments: [
    {
      content: 'Some base 64 encoded attachment content',
      filename: 'some-attachment.txt',
      type: 'plain/text',
      disposition: 'attachment',
      contentId: 'mytext'
    },
  ],
};

using correct property

const sgMail = require('@sendgrid/mail');
sgMail.setApiKey(process.env.SENDGRID_API_KEY);
const msg = {
  to: '[email protected]',
  from: '[email protected]',
  subject: 'Hello attachment',
  html: '<p>Here’s an attachment for you!</p>',
  attachments: [
    {
      content: 'Some base 64 encoded attachment content',
      filename: 'some-attachment.txt',
      type: 'plain/text',
      disposition: 'attachment',
      content_id: 'mytext'
    },
  ],
};

Exception/Log

using example

Uncaught (in promise) ResponseError: Bad Request
at Request.http [as _callback] 
...

using correct property

Argument of type '(MailData & { text: string; }) | (MailData & { html: string; }) | (MailData & { templateId: string; }) | (MailData & { content: MailContent[] & { ...; }; })' is not assignable to parameter of type 'MailDataRequired'.

Technical details:

  • sendgrid-nodejs version: latest
  • node version: v10.22.0
@thinkingserious
Copy link
Contributor

Hello @jaun-rg,

Thank you for bringing this to our attention! I've updated the docs with PR #1261.

With best regards,

Elmer

@thinkingserious thinkingserious added status: work in progress Twilio or the community is in the process of implementing type: docs update documentation change not affecting the code labels Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: work in progress Twilio or the community is in the process of implementing type: docs update documentation change not affecting the code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants