Subscribe setup
In Chawkbazar we implement Subscribe email through our API. To make this work properly in shop End. You have to configure it in the API (BackEnd).
Below .env variables are required to work Subscribe email. We will go through the whole process how you can get those env variable.
# Mailchimp NewslaterNEWSLETTER_API_KEY=NEWSLETTER_LIST_ID=
Implementation of Subscribe
In Chawkbazar we used spatie/laravel-Newsletter
package for as Newsletter manager. The spatie/laravel-newsletter
dependant on two Newsletter manager mailcoach
and mailchimp
. But in chawkbazar we used and configure only mailchimp
.
How to Get Mailchimp API Key
- Go to https://mailchimp.com/signup/ to signup for a mailchimp account.
- Once logged in, click on your profile name at the top right corner of the page. In the dropdown menu, select "Account."
- Within the Account page, navigate to the "Extras" dropdown menu and choose "API keys."
- On the API keys page, you'll see a section titled "Your API keys." If you have previously generated API keys, they will be listed here.
- If you don't have an existing API key, click on the "Create A Key" button. Otherwise, you can select an existing key from the list.
Mailchimp will generate a new API key for you. You'll see a string of letters and numbers similar to the following format:
1234567890abcdef1234567890abcdef-us1
- Click the "Copy" button to copy the API key to your clipboard. Make sure to securely store this key as it provides access to your Mailchimp account.
That's it! You now have your Mailchimp API key, which you can use to interact with the Mailchimp API and perform various tasks, such as managing subscribers, creating campaigns, and more.
How to Get Mailchimp List ID
- From the Audience dashboard, select the desired audience or create a new one by clicking on the "Manage Audience" dropdown and choosing "View Audience" or "Create Audience," respectively.
- Within the Audience page, click on the "Manage Audience" dropdown again and select "Signup forms."
- You will be presented with various options for your signup form. Choose
Embedded forms
for Form integrations."
- After selecting the desired form type, you'll be directed to the form builder. Click continue
- Locate the form code and look for the HTML snippet that contains the "form action" attribute. It should resemble the following code:
form action="https://yourusername.us#list-id-number.campaign-archive.com/subscribe/post?u=xxxxxxxx&id=xxxxxxxx"
In the HTML snippet, find the "id" parameter in the form action URL. The value after the "id=" is your List ID. It will be a combination of letters and numbers.
For example, in the above code snippet, the List ID would be represented by the "xxxxxxxx" placeholder.
That's it! You have now found the List ID for your Mailchimp newsletter subscription list.