You need to sign in to do that
Don't have an account?
Deep Smith
Email-to-Case to recognize IP and associate with a Country from their use sending email.
Is it possible for the Email-to-Case functionality to recognise the Country of the originating Email by IP Address?
When Email-to-Case creates a Case, we would like to automatically update the Country (custom picklist) field on case object based on IP address. or if any other way to do it I please let me know.
Any thoughts would be greatly appreciated.
Thanks!
An idea was created earlier to add more fields to the Email to case functionality (https://ideas.salesforce.com/s/idea/a0B8W00000GdlopUAB/more-emailtocase-settings-for-case-fields).
Beacuse the email will contain only headers from the email service provider there is no way we can extract location or country information from it.
However, I can suggest a workaround that I have tested it in my personal org which is as below:
2. Create and associate a email template to auto response
4. Extract all the information required and store it in custom fields.
Let me know the concerns in this approach if any. We can discuss further on pradeepgore60@gmail.com. If you honestly feel the time invested in reseraching and the approach found out works for you, please do not ignore it without mentioning it as the best answer.
Thanks,
Pradeep
public static String getCountry(String ip) {
Http http = new Http();
HttpRequest request = new HttpRequest();
request.setEndpoint('https://api.ipdata.co/'+ip+'?api-key=test');
request.setMethod('GET');
HttpResponse response = http.send(request);
if (response.getStatusCode() == 200) {
Map<String, Object> json = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
return (String) json.get('country_name');
} else {
return 'Error';
}
}
}