Is it possible to send the same email multiple times?
I tried via API to add email to queue, but I cannot remove it anyway. And if I don't, I get message "You've already sent this email to the subscriber." There was answer in another question. However, I need to be able to send email many (not constant) times, thus creating N amount of campaigns does not work for me. Therefore, the only option was to remove subscriber from list and add it back again, however, also doing this did not trigger the email to be sent.
Am I out of luck with MailChimp, is there a way or am I doing something wrong?
You are doing rigth, it is one of mailchimp 'smart' restrictions, like 'no more than 255 symbols in merge field'. You can workaround it, just create new campaign with one email.
I post example below, replace placeholders with rigth values. You can find TEMPLATE_ID in browser address bar when you edit template. (templates/design?tid=TEMPLATE_ID)
POST https://usX.api.mailchimp.com/3.0/campaigns
{
"type" : "regular",
"recipients" : {
"list_id" : "${LIST_ID}",
"segment_text" : "${SUBJECT}",
"segment_opts" : {
"match" : "all",
"conditions" : [ {
"condition_type" : "TextMerge",
"op" : "is",
"field" : "EMAIL",
"value" : "${USER_EMAIL}"
} ]
}
},
"settings" : {
"subject_line" : "${SUBJECT}",
"title" : "${SUBJECT}",
"from_name" : "${YOUR_COMPANY}",
"reply_to" : "${YOUR_COMPANY_EMAIL}",
"to_name" : "*|FNAME|* *|LNAME|*",
"template_id" : ${TEMPLATE_ID}
}
}
after creating, check subscriber count ( should be "recipient_count":1), save campaign id and start campaign.
POST https://usX.api.mailchimp.com/3.0/campaigns/${CAMPAIGN_ID}/actions/send
after that, wait some time, no less than 1 min, and delete campaign with
DELETE https://usX.api.mailchimp.com/3.0/campaigns/${CAMPAIGN_ID}
Related
Issue:
I am using Prismic to send data through to my website.
In Prismic I have a Type (testimonial_list) that consists of a group of content-relation fields (Prismic Type testimonials).
To query the data on the inner Types I need to access them via the document field in graphql and use inline-fragments.
I have followed as instructed here:
https://github.com/angeloashmore/gatsby-source-prismic#Query-Content-Relation-fields
Inside graphql I have managed to navigate to the testimonial data-fields (on the document field) but the document field returns null, this is where I'm stuck. I can't work out why it would return null as the content exists and the fields are clearly being found in graphql.
Info:
My project is built using Gatsby and I'm using the plugin gatsby-source-prismic v3.1.1
Here you can see I can access the correct field data and I am getting the right number of nodes returned but document is empty:
This is the JSON for the testimonial_list Type on Prismic:
{
"Main" : {
"prismic_title" : {
"type" : "StructuredText",
"config" : {
"single" : "heading6",
"label" : "Title (only used to name entry in Prismic list)",
"placeholder" : "Prismic list title (otherwise \"undefined\")"
}
},
"page" : {
"type" : "Select",
"config" : {
"options" : [ "Homepage", "Option 2", "Option 3" ],
"label" : "Website page to appear on:"
}
},
"testimonial_list" : {
"type" : "Group",
"config" : {
"fields" : {
"testimonial" : {
"type" : "Link",
"config" : {
"select" : "document",
"customtypes" : [ "testimonial" ],
"label" : "testimonial"
}
}
},
"label" : "Testimonial List"
}
}
}
}
Thank you for any help, if there is any more info I can supply to help deduce the issue please let me know.
In the end, the issue turned out to be a typo in my gatsby-config where I was requiring the schema.
It was a daft mistake but stare at something too long and these things happen I guess.
In case anybody else has a similar issue you must ensure the property names of your Prismic schemas inside your gatsby-config are exactly the same as in Prismic.
For example if your Type in Prismic is called "my_type" then you must use that exact syntax - so for example don't use "myType".
Hey it might be something related to the gatsby-source-prismic plugin
I would directly open an issue for it here if I were you: https://github.com/angeloashmore/gatsby-source-prismic/issues
Hiting the endpoint:
https://maps.googleapis.com/maps/api/place/findplacefromtext/json?input=Hoboken%20NJ&fields=formatted_address,name&inputtype=textquery&key=xxxxxxxxxxxxxxxxxxx
Getting the result:
{
"candidates" : [
{
"formatted_address" : "New Jersey, USA",
"name" : "Hoboken"
}
],
"debug_log" : {
"line" : []
},
"status" : "OK"
}
What bugs me is that I can't find a way to separate out the region and country - Yes, I know I can parse the result myself. But is there an option I get shoot out to Google Places API to have the response separate out city/state(or region)/country in the returned JSON?
Something like:
{
"candidates" : [
{
"state" : "New Jersey",
"country" : "USA",
"name" : "Hoboken"
}
],
"debug_log" : {
"line" : []
},
"status" : "OK"
}
As far as I know, it isn't possible, you'll have to parse it. Places API is designed to search businesses and POIs at first place.
Google does have, however a geocoding API which seems to give out Postal Code, Country, State, Address, separetely.
There are also some free alternatives
Say I have documents stored like below.
document 1
{
id : '1',
title : "This is a test document1",
list : ["value1" , "value2"],
...
}
document 2
{
id : '2',
title : "This is a test document2",
valueList : ["value1" , "value2"],
...
}
I need to add some more elements to the valueList in the documents with a list of document ids using bulk api. The resulting should look like
document 1
{
id : '1',
title : "This is a test document1",
list : ["value1" , "value2", "value3"],
...
}
document 2
{
id : '2',
title : "This is a test document2",
valueList : ["value1" , "value2" , "value3"],
...
}
What can I do to achieve this?
I tried using the scripts but it only updates a single document.
Sorry am really new to elastic search. I could even be stupid on this question. Please forgive and make me clear with this question.
See Updating Document. It should be straightforward. You need to use _update and just to give you an idea, even though the documentation is nearly perfect, it could look like this:
POST /your_index/your_type/document1/_update
{
id : '1',
title : "This is a test document1",
list : ["value1" , "value2", "value3"]
}
This will update document1.
In case of bulk updates you should read Batch Processing and have a look at the Bulk API.
From the docs:
POST /your_index/your_type/_bulk
{ "update" : {"_id" : "document1", "_type" : "your_type", "_index" : "your_index"}}
{ "doc" : {"myfield" : "newvalue"} }
{ "update" : {"_id" : "document2", "_type" : "your_type", "_index" : "your_index"}}
{ "doc" : {"myfield" : "newvalue"} }
Please note that you can just use _update for Partial Updates.
The simplest form of the update request accepts a partial document as
the doc parameter, which just gets merged with the existing document.
Objects are merged together, existing scalar fields are overwritten,
and new fields are added.
I am trying to use watcher API to send alerts.
https://www.elastic.co/guide/en/elasticsearch/reference/5.5/watcher-api-put-watch.html
I am able to set an example as explained above. When I check my mail, I can see the "subject" line correctly. But I need the output of a query as body of the email.
How is this achieved using x-pack?
In the example at the documentation, it only specifies the subject.
You can see an example with body in this page:
https://www.elastic.co/guide/en/x-pack/5.5/actions-email.html
It specifies the body, and adds the response in JSON format to the attachment of the email.
...
"actions" : {
"email_administrator" : {
"email" : {
"to" : "sys.admino#host.domain",
"subject" : "Encountered {{ctx.payload.hits.total}} errors",
"body" : "Too many error in the system, see attached data",
"attachments" : {
"attached_data" : {
"data" : {
"format" : "json"
}
}
},
"priority" : "high"
}
}
]
...
I need store id(store_id) to pass the value in this API.
/ecommerce/stores/{store_id}/carts
You need to first add a store to MailChimp using below API. Whatever id you pass in this request will be your store id for the subsequent requests.
https://usX.api.mailchimp.com/3.0/ecommerce/stores:
{
"id" : "store_001",
"list_id" : "205d96e6b4",
"name" : "Freddie's Jokes",
"domain" : "www.freddiesjokes.com",
"email_address" : "merchandise#freddiesjokes.com",
"currency_code" : "USD"
}
You can further check the Api at:
https://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/