-
Notifications
You must be signed in to change notification settings - Fork 256
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
Partner: blend ai: Add authorization header #2189
Conversation
* resolve conflict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mihaa1 ,
It looks like you were sending all settings and mapping config in the body of your request (as well as payload data). I don't think you intended to do this. So the correct way to send just the payload is as below.
perform: (request, {payload, settings}) => {
return request(baseUrl + 'sendData', {
headers: { Authorization: `Bearer ${settings.apiKey}` },
json: { payload }
})
}
Done! |
hi @mihaa1 - I just looked at this again. Usually the payload object will have data in it, but in your case you don't have any fields defined to populate the payload data. So you are probably just grabbing all the data you need from the rawData object. This isn't the way we designed the platform to be used, but since you already have it that way we should leave as is. Can you revert back to your original PR and I'll approve it please? |
@joe-ayoub-segment thanks for the feedback |
Ah OK, if you are rewriting it to work in the way our platform expects, then you should define some fields to specify which bits of data you want to collect from the payload. If you want to grab the entire payload in a single field you can, but again that's not recommended. For example here is a single field capturing the entire payload:
To drop this into the body of your request you would do this in the perform function:
Again, the 'correct' thing to do is to be selective about the parts of the payload you want to send to your platform, and have separate fields which pick out just those bits of data. You can then compose the json body you want to send to your platform in the perform() function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mihaa1 - left some comments.
hi @mihaa1 - I think the neatest way to do this would be to add a new Action which has all the fields defined for data points you want to allow customers to send to your platform. Does that make sense? There is no good way to update the existing Action to work in both the old and new way unfortunately. Best regards, |
That sounds great - I created a new action, and reverted all changes in old one. |
packages/destination-actions/src/destinations/blend-ai/trackEvents/index.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/blend-ai/trackEvents/index.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/blend-ai/trackEvents/index.ts
Show resolved
Hide resolved
@joe-ayoub-segment fixed everything! |
{ | ||
name: 'Send Data to Blend', | ||
name: 'Send Data to Blend - Depracated', | ||
subscribe: 'type = "identify" or type = "page" or type = "screen" or type = "track"', | ||
partnerAction: 'sendData', | ||
mapping: defaultValues(sendData.fields), | ||
type: 'automatic' | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @mihaa1 - just remove this preset please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the events from existing clients still be sent if I remove this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the events from existing clients still be sent if I remove this?
yes they will
packages/destination-actions/src/destinations/blend-ai/trackEvents/generated-types.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/blend-ai/trackEventsAction.types.ts
Outdated
Show resolved
Hide resolved
packages/destination-actions/src/destinations/blend-ai/trackEvents/index.ts
Outdated
Show resolved
Hide resolved
* more fixes
hi @mihaa1 this PR has been deployed. Can you please confirm that the change looks good? |
@joe-ayoub-segment the old integration works. We will need to test with new 1 to see. |
* Update README.md * x * blend updated version * new update * fixing preset * * add auth header * resolve conflict * fix from comment * modify sending structure * refactor & formatting * Remove .tool-versions file * remove required on new fields * * created new action /trackEvents - to replace /sendData action * more revert * remove * comment * added properties according to comments * generated types * * added depreacted to sendData action * more fixes --------- Co-authored-by: Yuval Zandbank <126495947+yuvlaz@users.noreply.github.com> Co-authored-by: Yuval <yuval@blnd.ai> Co-authored-by: joe-ayoub-segment <45374896+joe-ayoub-segment@users.noreply.github.com> Co-authored-by: spiderman <spiderman@Michaels-MacBook-Pro.local>
* Update README.md * x * blend updated version * new update * fixing preset * * add auth header * resolve conflict * fix from comment * modify sending structure * refactor & formatting * Remove .tool-versions file * remove required on new fields * * created new action /trackEvents - to replace /sendData action * more revert * remove * comment * added properties according to comments * generated types * * added depreacted to sendData action * more fixes --------- Co-authored-by: Yuval Zandbank <126495947+yuvlaz@users.noreply.github.com> Co-authored-by: Yuval <yuval@blnd.ai> Co-authored-by: joe-ayoub-segment <45374896+joe-ayoub-segment@users.noreply.github.com> Co-authored-by: spiderman <spiderman@Michaels-MacBook-Pro.local>
A summary of your pull request, including the what change you're making and why.
Testing
Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.