delighted / delighted-node Goto Github PK
View Code? Open in Web Editor NEWDelighted API Node Client
Home Page: https://delighted.com
License: MIT License
Delighted API Node Client
Home Page: https://delighted.com
License: MIT License
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.
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.
As suggested here https://delighted.com/docs/api/web
Is there a way to set the driver to "test"?
Is there an equivalent library for client side JS?
Would it be possible to create a way to the "properties" / tags of an existing users?
Hi, thank you for the library. Are you planning to add Typescript types?
Commit isn't being registered on NPM.
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.
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
Running npm install delighted
gives me an old version of the code.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.