spatie / mailcoach-support

Questions and support for Mailcoach
https://mailcoach.app
31 stars 2 forks source link

Tags & attributes data is not receiving via POST #259

Closed surjithctly closed 3 years ago

surjithctly commented 3 years ago

I did a POST test on postman to subscribe users.

I just added tags key and value (already added via app), but seems its not passing to the App. Same for attribute[key]

I tried adding first_name and last_name which works fine. I inspected the Horizon Logs and the json does not contain the word tags.

How can I fix this?

freekmurze commented 3 years ago

With only this information, it's hard to help you. Could you share the exact request you are performing and what the response is? Did you already generate a token that can be used? Did you try some other endpoints? What does https://your.app/mailcoach/api/user return?

Horizon is used for queues, it is not used on the API.

surjithctly commented 3 years ago

Hello,

I'm using postman for subscribe test. See below image & code.

The URL you've mentioned returns to Login Page.

Here's the log json from horizon ```json { mailable: { theme: "mailcoach::mails.layout.mailcoach", subscriber: { table: "mailcoach_subscribers", casts: { extra_attributes: "array", subscribed_at: "datetime", unsubscribed_at: "datetime" }, guarded: [ ], connection: "mysql", primaryKey: "id", keyType: "int", incrementing: true, with: [ ], withCount: [ ], perPage: 15, exists: true, wasRecentlyCreated: true, attributes: { email: "surjith+test4@gmail.com", email_list_id: 1, subscribed_at: null, unsubscribed_at: null, uuid: "09bf1ec1-b30b-44a1-9da2-fee810e15ee6", updated_at: "2020-10-10 09:40:13", created_at: "2020-10-10 09:40:13", id: 7 }, original: { email: "surjith+test4@gmail.com", email_list_id: 1, subscribed_at: null, unsubscribed_at: null, uuid: "09bf1ec1-b30b-44a1-9da2-fee810e15ee6", updated_at: "2020-10-10 09:40:13", created_at: "2020-10-10 09:40:13", id: 7 }, changes: [ ], classCastCache: [ ], dates: [ ], dateFormat: null, appends: [ ], dispatchesEvents: [ ], observables: [ ], relations: { emailList: { guarded: [ ], table: "mailcoach_email_lists", casts: { requires_confirmation: "boolean", allow_form_subscriptions: "boolean", send_welcome_mail: "boolean", welcome_mail_delay_in_minutes: "integer", report_campaign_sent: "boolean", report_campaign_summary: "boolean", report_email_list_summary: "boolean", email_list_summary_sent_at: "datetime" }, connection: "mysql", primaryKey: "id", keyType: "int", incrementing: true, with: [ ], withCount: [ ], perPage: 15, exists: true, wasRecentlyCreated: false, attributes: { id: 1, uuid: "84a9079e-4fe1-4f81-83eb-32e1a248a29a", name: "Web3Templates", campaigns_feed_enabled: "0", default_from_email: "hello@web3templates.com", default_from_name: "Web3Templates", default_reply_to_email: "hello@web3templates.com", default_reply_to_name: "Web3Templates", allow_form_subscriptions: 1, redirect_after_subscribed: null, redirect_after_already_subscribed: null, redirect_after_subscription_pending: null, redirect_after_unsubscribed: null, requires_confirmation: 1, confirmation_mail_subject: null, confirmation_mail_content: null, confirmation_mailable_class: null, campaign_mailer: "mailcoach", transactional_mailer: "mailcoach-transactional", send_welcome_mail: 1, welcome_mail_subject: "", welcome_mail_content: "", welcome_mailable_class: null, welcome_mail_delay_in_minutes: 0, report_recipients: "surjithctly@gmail.com", report_campaign_sent: 0, report_campaign_summary: 1, report_email_list_summary: 1, email_list_summary_sent_at: null, allowed_form_extra_attributes: null, created_at: "2020-10-09 14:27:55", updated_at: "2020-10-10 08:07:37" }, original: { id: 1, uuid: "84a9079e-4fe1-4f81-83eb-32e1a248a29a", name: "Web3Templates", campaigns_feed_enabled: "0", default_from_email: "hello@web3templates.com", default_from_name: "Web3Templates", default_reply_to_email: "hello@web3templates.com", default_reply_to_name: "Web3Templates", allow_form_subscriptions: 1, redirect_after_subscribed: null, redirect_after_already_subscribed: null, redirect_after_subscription_pending: null, redirect_after_unsubscribed: null, requires_confirmation: 1, confirmation_mail_subject: null, confirmation_mail_content: null, confirmation_mailable_class: null, campaign_mailer: "mailcoach", transactional_mailer: "mailcoach-transactional", send_welcome_mail: 1, welcome_mail_subject: "", welcome_mail_content: "", welcome_mailable_class: null, welcome_mail_delay_in_minutes: 0, report_recipients: "surjithctly@gmail.com", report_campaign_sent: 0, report_campaign_summary: 1, report_email_list_summary: 1, email_list_summary_sent_at: null, allowed_form_extra_attributes: null, created_at: "2020-10-09 14:27:55", updated_at: "2020-10-10 08:07:37" }, changes: [ ], classCastCache: [ ], dates: [ ], dateFormat: null, appends: [ ], dispatchesEvents: [ ], observables: [ ], relations: [ ], touches: [ ], timestamps: true, hidden: [ ], visible: [ ], fillable: [ ] } }, touches: [ ], timestamps: true, hidden: [ ], visible: [ ], fillable: [ ] }, confirmationUrl: "https://mail.web3creative.com/confirm-subscription/09bf1ec1-b30b-44a1-9da2-fee810e15ee6", locale: null, from: [ ], to: [ { name: null, address: "surjith+test4@gmail.com" } ], cc: [ ], bcc: [ ], replyTo: [ ], subject: null, markdown: null, html: null, view: null, textView: null, viewData: [ ], attachments: [ ], rawAttachments: [ ], diskAttachments: [ ], callbacks: [ ], mailer: "mailcoach-transactional" }, tries: null, timeout: null } ```

image

freekmurze commented 3 years ago

Did you enable subscriber tags for the list you are using? You must specify the allowed tags. This prevents your list from just any tag being used.

image
surjithctly commented 3 years ago

Okay. I have got what's wrong, Even after adding tags, I have to add allowed tags in List Settings.

Thanks for the screenshot. It helped.

By the way do you know why saving the attribute goes empty after a Save & reload?

image

freekmurze commented 3 years ago

👍 Glad the screenshot helped.

We'll fix that attribute field soon. Closing this issue as the original problem is resolved.

agusesetiyono commented 3 years ago

Hi, How to add tags via API on v3?