You can use our advanced config to have more functionality:
Usage:
var cotter =newCotter(config); // 👈 Put the config in here cotter.signInWithLink().showEmailForm().then(payload => {}).catch(err => {});
Config:
Here's an example of a complete configuration:
var config = {// Required Basic Configuration ApiKeyID:"<your-API-KEY-ID>", Type:"PHONE",// EMAIL or PHONE ContainerID:"cotter-container-signup", IdentifierField:"phone",// Change Country Code CountryCode: ["+62"],// IT HAS TO BE AN ARRAY// Styling ButtonBackgroundColor:"#000000", ButtonTextColor:"#ffffff", ButtonText:"Sign Up Now", ButtonBorderColor:"#D2D3FF",// don't specify for no border// Adding fields AdditionalFields: [ { label:"Full Name", name:"name", placeholder:"Enter your full name" } ],// Intercepting before authentication is processedOnBegin: payload => {if (payload.identifier !="+12345678910") {return"Phone Number is not allowed"; }returnnull; },// Add WhatsApp option to send verification code// (only for type = PHONE)// ################################################// # 👈Please read the section about WhatsApp 👈 #// # to comply with WhatsApp's Policy # // ################################################ PhoneChannels: ["SMS","WHATSAPP"],// default = ["SMS"]// WhatsApp Button Styling ButtonWAText:"Continue with", ButtonWATextSubtitle:"Tell your customer that you'll be sending the verification code via WhatsApp", ButtonWABackgroundColor:"#128C7E", ButtonWABorderColor:"#075E54", ButtonWATextColor:"#ffffff", ButtonWALogoColor:"white",};
Description
Field Name
Description
Required
ApiKeyID
your API_KEY_ID
Y
Type
"EMAIL" or "PHONE"
Y
ContainerID
id of the <div> where you want to serve Cotter Form.
Y
ButtonBackgroundColor
Button background color. Use HEX format (e.g. #000000)
N
ButtonTextColor
Button text color. Use HEX format (e.g. #FFFFFF)
N
ButtonText
Button text. Default is "Sign Up Without Password"
Additional fields that you want to include in the JSON obj. Check the specs for Additional Fields Object below
N
IdentifierField
Field name for the identifier to include in the JSON obj. For example, if you want to include the phone number in the JSON obj under key "phone", then fill in IdentifierField = "phone"
An Array of channels to send verification code to your users. Default value is ["SMS"].Available values are SMS and WHATSAPP. For example, to allow both SMS and WhatsApp, specify ["SMS", "WHATSAPP"]
N
Additional Fields
The additional fields will be used to generate more <input> fields for your users. The format is as following:
var config = {... AdditionalFields: [ { label:"Full Name", name:"name", placeholder:"Enter your full name" }, { label:"Address", name:"address", placeholder:"Enter your address" }, { label:"Prefilled Info", name:"prefilled", type:"hidden",// type can be "hidden", "text" or "number" initial_value:"autofill value" } ],}
Available types: hidden, text, number
This will be sent to you to the RedirectURL endpoint above as part of the JSON object. For example, with the fields above, you'll get a JSON object like the following.