Using query string parameter in Kentico marketing automation process - automation

I am trying to set up a marketing automation process that is kicked off when a user visits a particular web page on my site. The URL to that web page is going to be included in an email blast to a set of Kentico contacts.
I was hoping to be able to add a query string parameter to the end of the URL so that I can capture the e-mail address of the contact and store it in the Contact Email field,
i.e. http://example.com/mypage?email=xx#xxx.com.
My first attempt at this was setting up a marketing automation workflow that is triggered when the user visits the page, then using a 'Set Contact Property' step to set the contact's email address to the query string value, but I can't seem to be able to get the value of the query string parameter. I've tried {? email?}, {% QueryString.email%}, etc. with no luck.
Anyone have any ideas?

You are very close. Try this:
{% QueryString["nameOfQueryString"] %}
So if my URL were http://www.exmaple.com/mypage?email=testEmail#example.com, and I wanted to resolve the query string called "email" I would write:
{% QueryString["email"] %}
And it would resolve "testEmail#example.com".
Side Note: I would not recommend using your users' emails as the query string. I would use a GUID to build the URL and associate the user's email with a GUID in a SQL table.
So, if the email address "testEmail#exaple.com" was associated to the guid 25892e17-80f6-415f-9c65-7395632f0223, you would build a URL like this:
http://www.exmaple.com/mypage?id=25892e17-80f6-415f-9c65-7395632f0223
Then when the user visits this page, you can tell who they are by comparing the GUID to their email.

Related

AD B2C default signup-sign-in flow returns the "emails" claim with value type string instead of array

I am writing .Net Core API code that examines the value of the AD B2C built-in emails claim. I'm expecting this claim to show up on the ClaimsPrincipal as an IList<string> or similar, but it is instead of type string.
The Email Addresses claim is selected in the Azure portal and shows a data type of StringCollection and the emails claim appears on the ClaimsPrincipal but it is of type string. The data I am working with only has a single email address per user so I'm not sure what would happen if there were multiple email addresses.
I understand why AD returns an emails claim (plural) rather than an email claim (singular) so why is the emails claim value a string (the user's email address) instead of an array containing that single email address?
This:
emails: 'email#somedomain.com'
Instead of this:
emails: ['email#somedomain.com']
I'm currently on .NET Core 3.1
Updated to .NET 6 and I still experience the same thing. Am I missing a setting in AD or elsewhere? Is this the expected behavior?
When i tried i got the alternate email address in stringCollection format.
Please try to raise a support request if two or more mails when added are not reflecting in the emails claim else its not an issue AFAIK.

Getting a contact by email using the sendgrid api

I'm trying to retrieve contact id by email using the sendgrid 'Contacts API'. It looks like the way to do this is to POST to the /marketing/contacts/search endpoint.
I'm not familiar with SQL, does anybody know how I'd query the email field as explained here:
https://sendgrid.api-docs.io/v3.0/contacts/search-contacts
on the link that you provide there is a tab that is called "try it out" click there and you can try it out. Just add your Api token and there is already a query that you just need to add the email address
{
"query": "email LIKE 'ENTER_COMPLETE_OR_PARTIAL_EMAIL_ADDRESS_HERE'"
}
if you are adding a partial email address just add % before or/and after (depending which side is missing info)

Shopify - Making an API request to update user's email

Using the Shopify Admin API - I've been able to update a user's email address.
I've tested it with Postman, passing in a private app secret key.
Now I want to have this functionality on an actual page however have some questions:
I can't exactly store those private app keys on the JS code of the page itself as anyone would see. Neither can I make send a request with it as again anyone would have visbility.
Is it possible to create some sort of intermediary where I could make some sort of endpoint like POST /update/useremail sending across a customer ID
If the above is possible - I'm not sure how I could avoid any random person hitting that endpoint and updating other user's email addresses.
Has anyone had any experience/ideas/suggestions for a simply way to do this?
Any help appreciated.
Thanks.
Issue: Your issue is here that you want to verify if the email change request is a valid call or not? Then if you find it valid then you make the API call to update it.
My Solution
Create a page in Shopify with your form to update email. Show the page only to logged in users. When a user lands in the page show them the form to pass the new email they want. This where you need to add a few things so as to validate the requests. When the page loads create a hashed string from the Shopify Backend like below.
{% if customer != nil %}
{% assign timestamp = 'now' | date: "%s" %} //epoch time stamp
token = {{ customer.email | append: '<random_string>' | append: timestamp | sha256 }}
{% endif %}
Whenever a request is made for a change of email validate the SHA256 code at your end by creating a hash at your server. If the hash is valid update the email. Make sure you pass the timestamp and old email in the request you make.
Security issues you need to take care of -
You need to validate timestamp always For eg. It should not be 10 secs in the future or 10 secs in the past.
Your random string can also be brute forced. So keep updating the random string regularly using Assets API. It is very unlikely but why take the risk.

MVC user's full name in Url, how to handle duplicates

I want to setup the following url in my MVC4 website, using the user's full name in the url:
http://www.myapp.com/profile/steve-jones
I have setup the following route in Global.asax:
routeCollection.MapRoute(
"profile", "profile/{userName}",
new { controller = "myController", action = "profile", userName = string.Empty
});
And I can take the parameter 'steve-jones' and match it to a user with matching name. My only problem though is, what if there is more than one 'Steve Jones', how can I handle this?
Does anyone know of a workaround/solution to this so that I can use a user's full name as part of the url and still be able to retrieve the correct user in the controller method?
Am I forced into including the user's id with the url (something that I do not want to appear)?
The usual way of handling this is by appending a number when creating the profiles. So if "steve-jones" is already a name in the database, then make the user's display name "steve-jones2". You basically have to insist that all profile urls are unique, which includes updating any existing database and account creation code.
Alternatively (and/or additionally), if two same names are found then have the script reroute to a disambiguation page where the user is presented with links and snippet of profile info of the many existing Steve Joneseses so they can go to the full correct profile.
Another way of handling it is by giving all user profiles an additional numeric code on the end. At my university all logins are based on name, so they give everyone pseudo-random 3-digit extensions so that they are safe as long as they don't get 1000 people with the exact same names :)
Some people might be happier being steve-jones-342 if there is no steve-jones or steve-jones1, if you're concerned.

Shopify Get resourse_type at first when redirected to my application

My application is complete and work perfectly for Products.
Like i have an "application link" in the Products tab.On clicking, i get the SHOP name and ID of that product.Then i can successfully call the API because
GET /admin/products/#{id}/XXXX.json
by default i had use the "products" in path resolution.
Now the question is, at first I only got the ID with query parameter but don't know from which resource_type this belongs? i.e pages,themes etc.
Answer to this problem is that "you can append parameters to your query string" in Application Links.