Users are created in two different ways.
When a user is automatically created because they send their first message, all of their information is available in the webhook payload their message triggers (and in all subsequent webhook payloads triggered by that user).
"appUser": {
"_id": "c7f6e6d6c3a637261bd9656f"
...
}
the canonical Sunshine Conversations ID used to identify that user is available as the _id
property of the appUser
JSON property of the webhook payload.
It’s possible to create a user before they send a message. Check out the API reference docs.
You might want to do this because
Note, that it isn’t possible to pre-contact users over channels like Facebook Messenger, because social platforms only allow their users to initiate conversations with businesses, and not the other way around.
When you create a user, you need to specify a userId
property. The userId
is a canonical ID used to reference the user, and is interchangeable with the _id
property that Sunshine Conversations creates for each user.
Here’s the minimum required call to create a user (see the API reference for more options):
curl https://api.smooch.io/v1.1/appusers \
-X POST \
-d '{"userId":"some-user-id"}' \
-H 'content-type: application/json' \
-H 'authorization: Bearer your-app-scoped-jwt'