Coder Social home page Coder Social logo

bitrix24-java-api's Introduction

Bitrix24 Java API


This Java project is designed to be simple and efficient. Now you can work with **CRM Bitrix24.ru** using our API, that provide good functionality. Essentially, API provided work with Contact, Lead, Company, Product, Product Section and Chat. If you have any questions send me an email: [email protected]


Latest Version GitHub contributors HitCount Total Downloads

QUICK START

Step 1. Add dependency:

For Maven project:

<repositories>
	<repository>
	   <id>jitpack.io</id>
	   <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.JavaStream</groupId>
    <artifactId>bitrix24-java-api</artifactId>
    <version>v2022.3</version>
</dependency>

For Gradle project:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}
dependencies {
    implementation 'com.github.JavaStream:bitrix24-java-api:1.3'
}

Step 2. Create an account and webhook token

Screenshot

Step 3. Init Client in your project. You need insert yours Token, bitrix-account and rest_id. It's easy!

// Init Client
Client client = new Client("token", "your-account.bitrix24.ru", rest_id);

EXAMPLES

Contact

// CREATE (name and lastname are mandatory fields)
Contact contact = new Contact("Robert", "Kane"); 
contact.setTypeId(TypeIdContact.CLIENT.getCode());
contact.setPhones(phoneList);
contact.setAddress("USA, Delaware");
contact.setComments("best contact");
contact.setCompanyId("2");
client.contactService().add(contact);

// GET
Contact contact = client.contactService().get(74);

// DELETE
client.contactService().delete(72);

// UPDATE
contact.setCompanyId("2");
contact.setName("Джон");
client.contactService().update(contact);

Lead

// CREATE	
Lead lead = new Lead();
lead.setTitle("Test2");
lead.setSourceId(SourceIdType.ADVERTISING.getCode());
lead.setAddress("England, Rosenberg str, 100");
Phone phone = Phone.builder()
		.value("89110225686")
		.valueType(PhoneType.HOME.getCode())
		.build();
List<Phone> listPhones = new ArrayList<>();
listPhones.add(phone);
lead.setPhones(listPhones);
client.leadService().add(lead);

// GET
Lead lead = client.leadService().get(2);

// GET ALL
List<Lead> leads = client.leadService().getAll();
        
// DELETE
client.leadService().delete(8);

// UPDATE
lead.setName("Albert");
lead.setLastName("Shtein");
lead.setAddress("West Olympic Boulevard Apt. 100");
lead.setComments("Interested in price");
lead.setStatusId(StatusIdType.NEW.getCode());
lead.setCurrencyId(CurrencyIdType.EUR.getCode());
lead.setSourceId(SourceIdType.RECOMMENDATION.getCode());
client.leadService().update(lead);

Company

// CREATE
Company company = new Company();
company.setAddress("USA, Delaware");
company.setTitle("This is title"); 
client.companyService().add(company);

// GET
Company company = client.companyService().get(2);

// GET ALL
List<Company> companies = client.companyService().getAll();  

// DELETE
client.companyService().delete(4);

// UPDATE
company.setBankingDetails("r/s 40702810865698252");
company.setCompanyType(CompanyType.SUPPLIER.getCode());
company.setAddress("Olympic Boulevard Apt. 120");
company.setComments("Interested in price");
client.companyService().update(company);

Product

// CREATE
Product product = new Product();
product.setName("MainRouter");
client.productService().add(product);

// GET, DELETE, UPDATE 
Product product = client.productService().get(4);
client.productService().delete(6);
client.productService().update(product);

Product Section

// CREATE
ProductSection productSection = new ProductSection();
productSection.setSectionId(12); // Main category 
client.productSectionService().add(productSection);

// GET, DELETE, UPDATE 
ProductSection productSection = client.productSectionService().get(2);
client.productSectionService().delete(2);
client.productSectionService().update(productSection);

Chats with a Leads

Lead lead = client.leadService().get(42);                                      		  // Get a Lead (for example, id = 42)
Chat chat = client.chatService().get(lead);                                        	  // Get the chat whith this Lead
List<User> userList = client.chatService().getUsers(chat);                             	  // Get the list of users of this chat 
List<User> userList = client.chatService().getListBusinessUsers();                     	  // Get a list of all business users
client.chatService().muteNotifications(chat, ChatNotificationType.YES.getCode());    	  // Turn off chat notifications 

// ADD NEW CHAT FOR LEAD. The field message cannot be empty.
Chat chatNew = new Chat();
chatNew.setColor(ChatColorType.AZURE.getCode());
chatNew.setDescription("Conversation with a client #40");
chatNew.setMessage("Hello customer #40!");
chatNew.setTitle("Customer " + lead.getTitle());

client.chatService().createChat(chatNew, lead, userList);

bitrix24-java-api's People

Contributors

javastream avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.