Create a user

POST /v1/accounts/{license_code}/users
Host: api.webengage.com

Request

Parameter
Type
Description
Is mandatory

userId

String

UserId to identify a user uniquely. Either userId or anonymousId is mandatory.

No

anonymousId

String

Id to identify anonymous users, those who've not logged in yet. Either userId or anonymousId is mandatory. In case both ids are sent, anonymous id will be ignored.

No

firstName

String

First name of the user

No

lastName

String

Last name of the user

No

birthDate

String

Birth date of the user in a valid date format

No

gender

String

Gender of the user. Valid inputs are male, female or others

No

email

String

Email address of the user

No

emailOptIn

Boolean

Choice of user to receive emails.

No

phone

String

Phone number of the user

No

smsOptIn

Boolean

Choice of user to receive text messages.

No

company

String

Name of the company the user works for

No

hashedEmail

String

Encrypted email address for use with a private ESP

No

hashedPhone

String

Encrypted phone number for use with a private SSP

No

attributes

Object

Other attributes of user in key:value pair. For example
{ "isPaidUser": true, "userPlan": "Premium" }

No

Sample Request

{
  "userId": "jburnett",
  "firstName": "Jackson",
  "lastName": "Burnett",
  "birthDate": "1980-11-11T15:47:00+0530", //dateTime with timezone
  "gender":"male",
  "email":"james.burnett@burnettinc.com",
  "phone":"+11234567890",
  "company":"Burnett Inc.",
  "attributes": {
    "Profile Avatar Link":"http://burnettinc.com/user/4092"
  }
}
{
  "userId": "jburnett",
  "firstName": "Jackson",
  "lastName": "Burnett",
  "birthDate": "1980-11-11T15:47:00+0000",
  "gender":"M", // invalid input type, will result in HTTP 400 response.
  "email":"james.burnett@burnettinc.com",
  "phone":"+11234567890",
  "company":"Burnett Inc.",
  "attributes": {
    "Profile Avatar Link":"http://burnettinc.com/user/4092"
  }
}

Response

HTTP Status 201 - application/json

{
	"response": {
		"status": "queued"
	}
}

HTTP Status 400 - application/json. 1) If the userId & anonymousId both are missing or the values are not valid. 2) If any extra field is sent in request. 3) If invalid value for gender is used (other than male,female,others). Casesensitive

{
  "response": {
    "message": "{ERROR_MESSAGE}", //e.g. "Error: userId and anonymousId cannot be empty"
    "status": "error"
  }
}
{
  "response": {
    "message": "Unknown json property named \"abcdef\" in input message",
    "status": "error"
  }
}
{
  "response": {
    "message": "Error: Invalid value for type gender. Allowed values are 'male','female','others'. Case-sensitive.",
    "status": "error"
  }
}

Update a user

PUT /v1/accounts/{license_code}/users
Host: api.webengage.com

Request

Parameter
Type
Description
isMandatory

userId

String

UserId to identify a user uniquely

Yes

Parameter name

Type as mentioned in the user create API

The value can be a valid value for the paremeter or empty/null. In case of empty or null value the parameter will be deleted from the user

Yes

Sample Request

{
  "userId": "jburnett",
  "phone":"+19876543210",
  "attributes": {
    "Profile Avatar Link":"http://burnettinc.com/user/1234"
  }
}

Response

HTTP Status 200 - application/json

{
	"response": {
		"status": "success"
  }
}

HTTP Status 400 - application/json. If the userId is missing or the parameter values are not valid.

{
	"response": {
		"message": "{ERROR_MESSAGE}", //e.g. "Error: userId cannot be empty"
		"status": "error"
	}
}

User