Truecaller Integration with React Native for both Android[SDK v3.0.0] and IOS[SDK v0.1.8]
npm install @kartikbhalla/react-native-truecaller
Generate client-id using Truecaller Android Guide
Add the following
<meta-data
android:name="com.truecaller.android.sdk.ClientId"
android:value="YOUR_CLIENT_ID"
/>
Generate AppKey using Truecaller IOS Guide
Add the entry truesdk under LSApplicationQueriesSchemes in into your Info.plist file
<key>LSApplicationQueriesSchemes</key>
<array>
<string>truesdk</string>
</array>
Add the associated domain provided by Truecaller in Your project -> Capabilities > Associated Domains. The prefix 'applinks:' is needed for universal links to function properly. Note that there is no http:// or https:// prefix when setting up the applinks:
Install pods to the project
pod install
Import the package using
import { useTruecaller, TRUECALLER_ANDROID_CUSTOMIZATIONS } from '@kartikbhalla/react-native-truecaller';
Use the truecaller hook
const { initializeTruecaller, openTruecallerModal, user, isTruecallerSupported } = useTruecaller({
iosAppKey: 'YOUR_IOS_APP_KEY',
iosAppLink: 'YOUR_IOS_APP_LINK',
androidButtonColor: '#FF0000',
androidButtonStyle: TRUECALLER_ANDROID_CUSTOMIZATIONS.BUTTON_STYLES.ROUND,
androidButtonText: TRUECALLER_ANDROID_CUSTOMIZATIONS.BUTTON_TEXTS.CONTINUE,
androidButtonTextColor: '#FFFFFF',
androidClientId: 'YOUR_ANDROID_CLIENT_ID',
androidConsentHeading: TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.LOG_IN_TO,
androidFooterButtonText: TRUECALLER_ANDROID_CUSTOMIZATIONS.FOOTER_BUTTON_TEXTS.SKIP,
});
Initialize trucaller using
useEffect(() => {
initializeTruecaller();
}, []);
You can verify if the truecaller is supported using
const isSupported = isTruecallerSupported();
Open truecaller modal using
openTruecallerModal();
Once submitted, the data will be available in the user object.
console.log(user);
Android supports customizations available in Android Truecaller SDK Customizations. To customize these, you can use the following constants available inside TRUECALLER_ANDROID_CUSTOMIZATIONS
TRUECALLER_ANDROID_CUSTOMIZATIONS.BUTTON_TEXTS.CONTINUE
TRUECALLER_ANDROID_CUSTOMIZATIONS.BUTTON_TEXTS.ACCEPT
TRUECALLER_ANDROID_CUSTOMIZATIONS.BUTTON_TEXTS.CONFIRM
TRUECALLER_ANDROID_CUSTOMIZATIONS.BUTTON_TEXTS.PROCEED
TRUECALLER_ANDROID_CUSTOMIZATIONS.BUTTON_STYLES.ROUND
TRUECALLER_ANDROID_CUSTOMIZATIONS.BUTTON_STYLES.RECTANGLE
TRUECALLER_ANDROID_CUSTOMIZATIONS.FOOTER_BUTTON_TEXTS.SKIP
TRUECALLER_ANDROID_CUSTOMIZATIONS.FOOTER_BUTTON_TEXTS.ANOTHER_MOBILE_NUMBER
TRUECALLER_ANDROID_CUSTOMIZATIONS.FOOTER_BUTTON_TEXTS.ANOTHER_METHOD
TRUECALLER_ANDROID_CUSTOMIZATIONS.FOOTER_BUTTON_TEXTS.MANUALLY
TRUECALLER_ANDROID_CUSTOMIZATIONS.FOOTER_BUTTON_TEXTS.LATER
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.LOG_IN_TO
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.SIGN_UP_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.SIGN_IN_TO
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.VERIFY_NUMBER_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.REGISTER_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.GET_STARTED_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.PROCEED_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.VERIFY_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.VERIFY_PROFILE_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.VERIFY_YOUR_PROFILE_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.VERIFY_PHONE_NO_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.VERIFY_YOUR_NO_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.CONTINUE_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.COMPLETE_ORDER_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.PLACE_ORDER_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.COMPLETE_BOOKING_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.CHECKOUT_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.MANAGE_DETAILS_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.MANAGE_YOUR_DETAILS_WITH
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.LOGIN_TO_WITH_ONE_TAP
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.SUBSCRIBE_TO
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.GET_UPDATES_FROM
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.CONTINUE_READING_ON
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.GET_NEW_UPDATES_FROM
TRUECALLER_ANDROID_CUSTOMIZATIONS.CONSENT_HEADING_TEXTS.LOGIN_SIGNUP_WITH
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT