Re: Update Customer language (locale) with Shopify Flow & Send HTTP Request

Solved

Update Customer language (locale) with Shopify Flow & Send HTTP Request

momo514
Shopify Partner
14 0 1

Hi,

according to some other posts, it might be possible to update customer language (aka "locale"). Issue comes from the fact when a customer is imported, the notifications are sent in English. Not possible to specify "locale".

 

Someone suggested to use Shopify Flow and Send HTTP Request. I did try a few things, query is successful, but nothing is updated. I tried to use mutation customerUpdate, but not luck. Since Flow is out of scope for Shopify assistance, anybody have any hints, tips, adivices or solutions for this? 🙂

Accepted Solution (1)
paul_n
Shopify Staff
1313 148 299

This is an accepted solution.

OK, I tested this in Flow and confirmed that it works. One nuance that I forgot...because Flow uses Liquid you cannot use {{ or }} anywhere or Flow will interpret it as liquid (solved by adding a space in between). 

 

 

{"query":"mutation customerUpdate($input: CustomerInput!) {\n customerUpdate(input: $input) {\n userErrors {\n field\n message\n }\n  }\n }", "variables":{"input":{"id":"{{ customer.id}}","locale":"fr" } } }

 

And just in case, this is what the config looks like:

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.

View solution in original post

Replies 23 (23)

paul_n
Shopify Staff
1313 148 299

If you post more detail about your Send HTTP Request that would help. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

I tried tons of things, but latest:

 

{"query": "mutation { customerUpdate(input: {locale: \"{{customer.locale}}\",  locale: \"fr\"}) { customer { locale } }"}

 

paul_n
Shopify Staff
1313 148 299

We are you setting the locale twice? You are also missing the customer id. 

 

I'm also not sure that is the right syntax for a mutation. Have you tried it in something like Postman? 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

In fact, I'm not even sure it's possible. Initially, I tried the following (see below) and tried Shopify examples, but nothing works.

 

{
    "query": "mutation customerUpdate($input: CustomerInput!) { customerUpdate(input: $input) customer { id locale } } }",
     "variables": {
        "input": {
          "id": "gid://shopify/Customer/7025645551839",
          "locale": "fr"
        }
      }
    }

 

paul_n
Shopify Staff
1313 148 299

I tested in postman...this is a working example. You are missing at least one bracket (after customerUpdate).

{"query":"mutation updateLocale($input: CustomerInput!) {\n    customerUpdate(input: $input) {\n        userErrors {\n            field\n            message\n        }\n        customer {\n            id\n            locale\n        }\n    }\n}","variables":{"input":{"id":"gid://shopify/Customer/20952568692758","locale":"en"}}}
Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

Thanks. However, nothing is getting updated. At some points, I think it's just not possibe.

paul_n
Shopify Staff
1313 148 299

This is an accepted solution.

OK, I tested this in Flow and confirmed that it works. One nuance that I forgot...because Flow uses Liquid you cannot use {{ or }} anywhere or Flow will interpret it as liquid (solved by adding a space in between). 

 

 

{"query":"mutation customerUpdate($input: CustomerInput!) {\n customerUpdate(input: $input) {\n userErrors {\n field\n message\n }\n  }\n }", "variables":{"input":{"id":"{{ customer.id}}","locale":"fr" } } }

 

And just in case, this is what the config looks like:

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

Hello,

thanks. Body looks great. I have proper settings, but still no luck. Locale is just not updating. The flow is as follow:

 

Start when: Customer tags added

Check if: tag is equal to "something"

Do this: Sent HTTP request

 

In App Development, appropriate Admin API access scopes are added.

paul_n
Shopify Staff
1313 148 299

Are you sure the action is getting called? Can you show a workflow run where it didn't work?

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

You mean something like this:

 

Status: Succeeded
Action: 1 succeeded: Send HTTP request

 

flowsuccess.png

paul_n
Shopify Staff
1313 148 299

Ok, that looks fine.  Are you sure it's not working. The way I can tell is by this little bit of text in the Admin: 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

The language in customer page doesn't update. It stays to "English"

paul_n
Shopify Staff
1313 148 299

Ok, and can you share your send http request panel then?

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

sendhttpres.png

paul_n
Shopify Staff
1313 148 299

You are using an app's API token. That might be just blocked because you aren't providing all of the app details you need to in this API request. Since the request for GraphQL returns 200 even with errors but you can't see the errors in Flow, it looks successful. 

 

I'd recommend creating an API key for the shop (Settings / App and sales channels / develop apps / create an app) and make sure that API key can read and write customers. 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

I did create an app with: write_customers, read_customers. I'm using Admin API access token. 

paul_n
Shopify Staff
1313 148 299

I think you created a public app. I don't think you can just use the token generated for that app in another app.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

I created a "custom app" based on Shopify's documentation (and the same way you mentionned, by going to Settings / App and sales channels / develop apps / create an app). If that's not the way to get API token, how can it be done?

paul_n
Shopify Staff
1313 148 299

The instructions are above in this thread.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

You mean this:

 

I'd recommend creating an API key for the shop (Settings / App and sales channels / develop apps / create an app) and make sure that API key can read and write customers. 

 

It's what I did.

 

paul_n
Shopify Staff
1313 148 299

I *think* what is happening here is you need a privacy permission for that API key to access any customer data, but there doesn't appear to be a way to get it via the UI. Or there is some scope issue. I could be wrong...without shop data I can't really troubleshoot further. Mind if I convert this into a support ticket? 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
momo514
Shopify Partner
14 0 1

Sure it can be converted to a Support Ticket. 

Thanks,

paul_n
Shopify Staff
1313 148 299

Looks like the community doesn't have that feature any more...I think you need to submit the support ticket. Provide them with a link to this thread, a link to your workflow, and we should be good to investigate further.

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.