Giter VIP home page Giter VIP logo

delighted-node's People

Contributors

againer avatar evantahler avatar geoff-parsons avatar kindjar avatar mkdynamic avatar rizalp1 avatar smcguinness avatar sorentwo avatar thierryung avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

delighted-node's Issues

Emoji in `delighted_email_subject` returns 500 Internal Server Error

I'm not sure if this is the best place for this issue, but since I'm encountering it in the node project I'll start it here.

When trying to pass an emoji character in the delighted_email_subject property of the delighted.person.create call, I receive a DelightedError of:

{
  type: 'GeneralAPIError',
  message: '{"status":500,"error":"Internal Server Error"}'
}

Sample code:

const params = {
                email: '[email protected]',
                name: 'Jim User',
                properties: {
                    delighted_email_subject: '๐ŸšŒ Jim, would you recommend us?'
                }
            }
delighted.person.create(params)

Simply removing the emoji character from the subject creates the record and sends the email with no issue.

I should also note that adding emoji's via the Delighted UI to the subject line works without any issue.

README details for integration test setup are out-of-date

The docs currently suggest setting up a mapping like this:

var mapping = {
  '/people': {
    status: 201,
    body: { email: '[email protected]' }
  }
};

But the test server looks up mapping entries using the HTTP method plus the url path:

var mapped = mapping[request.method + " " + request.url];

The require path for the test server also appears to be wrong.

Update existing users?

Would it be possible to create a way to the "properties" / tags of an existing users?

Typescript Types

Hi, thank you for the library. Are you planning to add Typescript types?

Need a 'catch' for errors

The promise created when making an API call to send a survey client.person.create(payload).then(...) has no catch(). If you send a payload which causes an API error (perhaps an invalid UTF8 char in the message payload), the API response never comes back... and the promise never resolves.

A catch() should be added to the API promise, and it should have a timeout.

Leaks Authorization headers within process

DEFAULT_HEADERS is updated with API keys at instantiation, but is not cloned at that point.

If you have a single process doing backfills for several API keys simultaneously using separate clients, each time a new client is created its API key will start to be used by all existing clients.

> a = require('delighted')('foo')
> a.config.headers.Authorization
'Basic Zm9vOg=='
> b = require('delighted')('bar')
> b.config.headers.Authorization
'Basic YmFyOg=='
> a.config.headers.Authorization
'Basic YmFyOg=='
> a.config.headers.Authorization === b.config.headers.Authorization
true

Workaround is to ensure DEFAULT_HEADERS are never used:

> a = require('delighted')('foo', {headers: {'Accept': 'application/json', 'Content-Type': 'application/json'}})
> a.config.headers.Authorization
'Basic Zm9vOg=='
> b = require('delighted')('bar', {headers: {'Accept': 'application/json', 'Content-Type': 'application/json'}})
> b.config.headers.Authorization
'Basic YmFyOg=='
> a.config.headers.Authorization
'Basic Zm9vOg=='
> a.config.headers.Authorization === b.config.headers.Authorization
false

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.