mailchimp/Firebase

Adding date from Firebase Timestamp to Mailchimp Merge Field causes error.

TomJFox opened this issue · 7 comments

When I add a Firebase Timestamp field to a Mailchimp Merge Field (set to Date) the Extension fails to merge the data.

ext-mailchimp-firebase-sync-mergeFieldsHandler throws the following error:
Error: Your merge fields were invalid.
at Request._callback (/workspace/node_modules/mailchimp-api-v3/index.js:522:35)
at Request.self.callback (/workspace/node_modules/request/request.js:185:22)
at Request.emit (node:events:513:28)
at Request.emit (node:domain:552:15)
at Request. (/workspace/node_modules/request/request.js:1154:10)
at Request.emit (node:events:513:28)
at Request.emit (node:domain:552:15)
at IncomingMessage. (/workspace/node_modules/request/request.js:1076:12)
at Object.onceWrapper (node:events:627:28)
at IncomingMessage.emit (node:events:525:35)
at IncomingMessage.emit (node:domain:552:15)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
type: 'https://mailchimp.com/developer/marketing/docs/errors/',
title: 'Invalid Resource',
status: 400,
detail: 'Your merge fields were invalid.',
instance: 'a79ffb35-3c7f-2df2-13dd-e13e23a42352',
errors: [ { field: 'CREATEDATE', message: 'Please enter the date' } ],

I suspect this is because Timestamp is not converted to a String with only the date in one of the accepted Mailchimp formats.
The following was in the error message as the body of the call to Mailchimp:

body: '{"status_if_new":"subscribed","email_address":"wellformedemail@test.com","merge_fields":{"CREATEDATE":{"_seconds":1692572400,"_nanoseconds":233000000}}}',

Is it possible to update the code so it would pass the date portion of the Timestamp value to Mailchimp if the field is a Timestamp?

Hello!

I have a PR up that will cover the work requested, and handles some other considerations for working with different merge field types.

I've included this in the 0.5.4 release, which is due for release very soon.

Wonderful. I am looking forward to the update.

Hi @barticus,

When can we expect the new version to be released?

Hi @TomJFox , sorry I've been blocked by some new Firebase restrictions on how extensions get published. They are good changes but I needed some help from Firebase support to resolve an issue. Its been quite a long process but I've got through that part now (as of 5 minutes ago). I am hopeful it won't be too long of a wait, I have time tomorrow to progress this.

@barticus thanks for the update and good luck with the rest of the process.

This is in v0.5.4, currently sitting in "Sent for Review". Closing issue.

@barticus I installed this tonight and it worked great. 👍

Thanks again for the great support!