/deltachat-node-legacy

[WIP] Node bindings for deltachat-core

Primary LanguageC++GNU General Public License v3.0GPL-3.0

deltachat-node

A Node.js API for deltachat-core's native C library. This is a WORK IN PROGRESS.

npm install deltachat-node

Usage

Set up

var deltachat = require('deltachat-node')

function my_delta_handler(mailbox, ev, data1, data2) {
  return 0
}

var mailbox = deltachat.mrmailbox_new(my_delta_handler, null, null)

deltachat.mrmailbox_set_config(mailbox, "addr", "alice@delta.chat") // use some real test credentials here
deltachat.mrmailbox_set_config(mailbox, "mail_pw", "***") 

deltachat.mrmailbox_configure_and_connect(mailbox)

Sending a message

var contact_id = deltachat.mrmailbox_create_contact(mailbox, NULL, "bob@delta.chat") // use a real testing address here
var chat_id = deltachat.mrmailbox_create_chat_by_contact_id(mailbox, contact_id)
deltachat.mrmailbox_send_text_msg(mailbox, chat_id, "Hi, here is my first message!");

There are many more functions available that further manage and retrieve contacts, messages, and chats. Learn about all of the functions in API in the deltachat C documentation.

Developing

npm install should be enough to setup the project and involves doing:

  • Updating and compiling the deltachat-core code base
  • Compiling the native addon and linking it with the deltachat-core

License

GPLv3