Skip to content

Send fails for Apps without advance User Profile Access #89

Description

@jorgeluiso

Most new apps won't have access to user extra data, so the API call will fail to execute if the api call requests any of these advance unapproved fields.
https://developers.facebook.com/docs/messenger-platform/identity/user-profile/

Suggestion

Let's include two new env variables that allow developers to setup if advance fields are available for the page and as well as setup their default preferred locale easily.

has_extra_user_field_accesss: process.env.HAS_EXTRA_USER_FIELD_ACCESSS || false,
default_locale: process.env.DEFAULT_LOCALE || 'en_US',

in https://github.com/fbsamples/original-coast-clothing/blob/master/services/config.js

Then use the above vars like:

let fields = 'first_name, last_name';
    if (config.has_extra_user_field_accesss) {
      fields = 'first_name, last_name, gender, timezone, locale';
    }

in https://github.com/fbsamples/original-coast-clothing/blob/master/services/graph-api.js#L138

if (users[senderPsid].locale != null) {
          i18n.setLocale(users[senderPsid].locale);
        } else {
          i18n.setLocale(config.default_locale);
        }

https://github.com/fbsamples/original-coast-clothing/blob/master/app.js#L131

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions