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

Problem when using {key} as a substitution #264

Closed
LewisTheobald opened this issue Jul 16, 2016 · 7 comments
Closed

Problem when using {key} as a substitution #264

LewisTheobald opened this issue Jul 16, 2016 · 7 comments
Labels
status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap

Comments

@LewisTheobald
Copy link

Issue Summary

We've been using the { and } symbol as the wrapper around our substitution tags. When migrating to v3, these come back with a '400 Bad Request'. Though the request works fine if I remove the substitutions section.

Steps to Reproduce

The JSON payload for the personalistion section is:

"personalizations": [{
    "to": [{
        "email": "[email protected]"
    }],
    "substitutions": {
        "{id}": 1,
        "{name}": "Lewis Theobald",
        "{forename}": "Lewis",
        "{surname}": "Theobald"
    }
}]

The response is:

{
  "errors": [
    {
      "message": "Bad Request",
      "field": null,
      "help": null
    }
  ]
}

If I remove the substitutions block or change it to another symbol, we receive '202 Accepted'.

Technical details:

  • sendgrid-php Version: master (latest commit: [commit number])
  • PHP Version: 5.x
@LewisTheobald
Copy link
Author

Actually, it spanned from only the single item

"{id}": 1

Should actually be

"{id}":"1"

Requires all parameters to be sent over as string enclosed in quotes. Should make this aware somewhere in the Personalizations section

@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap status: help wanted requesting help from the community labels Jul 18, 2016
@thinkingserious
Copy link
Contributor

Thank you @LewisTheobald!

I will leave this ticket open until we update the docs and code to clarify.

@csaroff
Copy link

csaroff commented Sep 27, 2016

I will leave this ticket open until we update the docs and code to clarify.

Can you update the the error object that is sent back to include more information than

{"errors":[{"message":"Bad Request","field":null,"help":null}]}

I didn't find this to be very useful in diagnosing the problem

@thinkingserious
Copy link
Contributor

@csaroff,

Yes, that will be part of the update.

Thanks for taking the time to provide feedback!

@ejames17
Copy link

@LewisTheobald thanks saved me a few hours of debugging.

@thinkingserious
Copy link
Contributor

@LewisTheobald,

Please take a moment to fill out this form so we can send you some swag :)

With Best Regards,

Elmer

@thinkingserious
Copy link
Contributor

This has been moved here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

4 participants