setContactKey

Sets the contact key for the device's user.

Syntax

MCReactModule.setContactKey(contactKey);

Parameters

Parameter Type Description
contactKey string The value to be set as the contact key of the device's user.

Returns

  • void - No return value.

Example

import { MCReactModule } from "react-native-marketingcloudsdk";

const setUserContactKey = () => {
  try {
    MCReactModule.setContactKey("user123@example.com");
    console.log("Contact key set successfully");
  } catch (error) {
    console.error("Error setting contact key:", error);
  }
};

See Also