Use locales for different media (e.g. website, chatbot)?

We’re thinking about using Contentful to manage content for a website and a chatbot. Much of the content is identical. In some cases, chatbot content needs to be shorter.

Locales would seem to support this, e.g. EN-us and EN-chat. If EN-chat isn’t specified, fall back to EN-us. (In practice, we would select a random unused locale to represent EN-chat.)

Is this a good use of locales? Or is there a better way to do this?

Hi @chris2,

The actual distribution of locales seem to be a good approach, but could you explain in more detail why exactly separate the content of your website and chatbot?

Don’t you think it would be a more reasonable approach to instead use a different content type, and thus different field types and names?

Eventually, we will have 4 possible values for a given paragraph of text:

  • Website
  • Chatbot - regular (shorter)
  • Chatbot - SMS (shortest)
  • Voicebot (different phrasing)

In many cases, the website content can be used unchanged.

I like the way locales offer fallbacks — if there is no SMS content, fall back to regular chatbot; if there is no regular chatbot content, fall back to website.

But maybe I’m thinking about this wrong, and we can do as you said — just have additional fields. And we can handle the fallbacks programmatically on our side. It sounds like that is the typical approach?

You’ve got a good handle on the possibilities available and it definitely seems reasonable to use locales to achieve what you are talking about. This is one specific use case that I hear about every so often for which locales with their fallback logic are perfect. Otherwise you have to do as you mentioned: implement the fallback logic programmatically in your frontend code. The only downside to using locales for this is if you need/want to use multilingual content - as you’ve co-opted the normal, intended use of locales for a separate “dimension” of your content, it’ll be costly to also have multiple languages.

PRO TIP: you can programmatically make custom locales that aren’t available in the webapp by calling the CMA directly. Here’s the documentation which describes how to do that. One note - you can’t have a custom locale as the default locale of a space.

1 Like

Although, I am not an experienced Contentful user just yet. But below is my suggestion -

Following the seperation of concern model and the actual use of “Space” in contentful, my understanding is that you should seperate different content for channels in different “Spaces”. To answer your question then, maybe it would make sense to have a space for “chatbot” and a space for actual-website.