Get Started with Truecaller API Integration

Author

Reads 517

Close-up Photo of a Mobile Phone Screen
Credit: pexels.com, Close-up Photo of a Mobile Phone Screen

Truecaller API integration is a game-changer for businesses looking to enhance their customer experience. By leveraging Truecaller's vast database of phone numbers, you can verify caller IDs, block spam calls, and even fetch user profiles.

First, you'll need to sign up for a Truecaller API key, which is free for developers. This will grant you access to the API's features, including phone number lookup and caller ID verification.

With the API key in hand, you can start building your integration by using the Truecaller API SDK, which supports popular programming languages like Java, Python, and JavaScript. This will make it easier to integrate the API into your existing application.

Usage and Examples

To use the Truecaller API, you'll need to install the truecallerjs package via npm. This is a straightforward process that gets you started with the project.

You can perform a simple search for a phone number using the truecallerjs package. This involves creating a search_data object with the necessary parameters, including the number, country code, and installation ID. Make sure to log in using the truecallerjs login command and obtain your installation ID using the truecallerjs -i command.

The Truecaller API offers several features that make it a valuable tool for your project. Here are some of the key features: Phone Number Lookup: Retrieve detailed information about a phone number, including the owner's name, location, and more.Support for Node.js, JavaScript, and TypeScript: TruecallerJS can be used in Node.js projects, as well as in JavaScript and TypeScript applications.Simple and Lightweight: TruecallerJS is designed to be easy to use and lightweight.

Broaden your view: Next Js Restful Api

Features

Mobile Trading App with Financial Market Charts
Credit: pexels.com, Mobile Trading App with Financial Market Charts

Truecaller's API offers a range of features that can be used in various applications.

The API provides reverse number lookup, allowing developers to attach a name to a known number. This feature is useful for call centres to identify who is calling before starting a call.

Truecaller's API also includes a 'Spam score' to indicate if a number is a likely spammer, and a 'True score' to indicate how important the number is. The 'True score' measures how popular a phone number is with Truecaller's users over time.

The API is designed to be easy to use and lightweight, making it a great option for developers.

Here are some of the key features of Truecaller's API:

  • Reverse number lookup
  • Spam score
  • True score

Truecaller charges developers to use some of the features of its API, with pricing starting at $299 per month and rising to $4,999.

Command Line Usage

To use TruecallerJS from the command line, you can run the truecallerjs command followed by the desired options and arguments. This can be done by typing truecallerjs login to log in to your Truecaller account.

Crop faceless male manager in formal wear sitting on marble bench and messaging on mobile phone during coffee break
Credit: pexels.com, Crop faceless male manager in formal wear sitting on marble bench and messaging on mobile phone during coffee break

The available options for the truecallerjs command include: truecallerjs -s [number] to search for a phone number and retrieve the caller name and related information, and truecallerjs --bulksearch, --bs to perform a bulk number search.

You can also use truecallerjs --help to view a list of all available options and their descriptions. This can be especially helpful if you're new to using the command line or are unsure about the correct syntax for a particular command.

Here are some examples of how to use the truecallerjs command:

For example, to perform a bulk search, you can use the truecallerjs --bulksearch, --bs command followed by the phone numbers you want to search, separated by commas. If the country code is not specified for a phone number, it will default to using your own country code.

Release and Access

Truecaller's API is released to handpicked developers who align with their mission and provide value to users. These developers are carefully selected and vetted to ensure they meet Truecaller's standards.

Credit: youtube.com, Truecaller AI Powered Caller ID | Smarter Protection in Real Time

The API is not available to companies associated with telemarketing or spam, and it doesn't include name search, which remains a feature of the mobile app only. Truecaller wants to maintain the integrity of their database and protect users' sensitive information.

Truecaller charges developers to use some of the features of their API, with pricing starting at $299 per month and rising to $4,999. This is part of their monetization strategy to make the API accessible to a select group of developers.

Cloud e-signing company Scrive has been trying out Truecaller's API, using it to validate the identity behind a phone number. This is just one example of how the API can be used to improve various services and processes.

Truecaller has a rigorous evaluation process for developers who want access to their API, testing their applications before granting access. This ensures that only developers who meet their standards get to use the API.

Limitations and SDK

Close-up of a cappuccino and smartphone displaying app interface on a table.
Credit: pexels.com, Close-up of a cappuccino and smartphone displaying app interface on a table.

The Truecaller SDK has its limitations, and understanding them is crucial for a seamless integration. One key limitation is that only one app key can be used for a particular combination of package name and SHA1, making it essential to generate and manage app keys for different app builds.

The Truecaller SDK requires specific permissions for certain functionalities, such as READ_CALL_LOG and READ_PHONE_STATE for non-Truecaller user verification. This is particularly important for developers who want to use the missed call based functionality, currently supported for India only.

Here are some common errors and their solutions:

  • Using a wrong app key: This can be resolved by generating and managing app keys for different app builds.
  • Using the right key with either or both wrong package name and fingerprint: This can be resolved by ensuring the correct combination of package name and SHA1.

Limitations

When using the --bulksearch option, it's essential to be aware of its limitations. The tool can only handle 30 or fewer phone numbers at once in a single request.

If you need to search more than 30 phone numbers, you'll have to split your input into multiple requests. This can be a bit tedious, but it's a necessary step to ensure the tool functions correctly.

Phone numbers must be correctly formatted and free of additional characters or spaces. The tool expects them to be provided in a comma-separated format.

Here are the key limitations to keep in mind:

  • Maximum Number of Phone Numbers: 30 or fewer
  • Formatting: Comma-separated format, no extra characters or spaces

Android App SDK

Mobile phone on wooden table showing installation screen for WHO Info app from World Health Organization.
Credit: pexels.com, Mobile phone on wooden table showing installation screen for WHO Info app from World Health Organization.

If you're looking to integrate Truecaller's Android App SDK into your app, you're in luck. Truecaller SDK v2.0 has two key functionalities that make it a powerful tool for verifying mobile numbers.

The 1-tap verification functionality allows you to verify the mobile number of any active Truecaller app user globally on your app. This is a game-changer for apps that need to verify user identities.

You can also use the missed call based functionality to verify mobile numbers of users who may not be active Truecaller app users. However, this feature is currently only available for the India market and on the Android platform.

To get started with integrating Truecaller SDK into your app, you'll need to refer to the technical documentation. This will walk you through the process of setting up and using the SDK.

One important thing to keep in mind is that one app key can only be used for a particular combination of package name and SHA1. If you try to use the wrong key or the right key with the wrong package name and fingerprint, you'll get an error.

Recommended read: Nextjs App Router Api

Free stock photo of amc, app, app interface
Credit: pexels.com, Free stock photo of amc, app, app interface

Here are some common errors you might encounter when implementing the user flow in your app using Truecaller SDK:

  • using a wrong app key
  • using the right key with either or both wrong package name and fingerprint

To fix these errors, you'll need to generate and manage app keys for different app builds. You can find more information on how to do this in the technical documentation.

The TruecallerSDK.getInstance().isUsable() method is also a useful tool for checking if the Truecaller SDK can be used for user verification. Depending on the "sdkOptions" scope you've defined while initializing the Truecaller SDK, the method will return different results.

For example, if you've defined the scope as WITH_OTP, the method will always return "true". If you've defined the scope as WITHOUT_OTP, the method will return "true" only if the user has the Truecaller app on their device.

When testing your app with Truecaller SDK integration, you'll need to follow some specific test scenarios and setup. You can find more information on this in the technical documentation.

In summary, Truecaller SDK is a powerful tool for verifying mobile numbers in your app. By following the technical documentation and understanding the common errors and solutions, you can successfully integrate the SDK into your app.

Here's an interesting read: Azure Api App

Frequently Asked Questions

How do I get the API key for Truecaller?

To obtain your Truecaller API key, log in to the Truecaller for Business console and navigate to the "Manage API Keys" section. From there, click "Create API Key" to generate a new key.

Cory Hayashi

Writer

Cory Hayashi is a writer with a passion for technology and innovation. He started his career as a software developer and quickly became interested in the intersection of tech and society. His writing explores how emerging technologies impact our lives, from the way we work to the way we communicate.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.