Code Monkey home page Code Monkey logo

mod_zeropush-mongooseim-'s Introduction

This is a zero_push module and also modified Mongooseim version of https://github.com/ZeroPush/mod_zeropush

mod_zeropush (Mongooseim)

Mongooseim Module for sending push notifications via ZeroPush

mod_zeropush sends an API request to ZeroPush when a message is sent to an offline user.

The notification contains the following URI-encoded payload:

{ "auth_token": "{config-auth_token}", "channel": "{recipient-jid}", "alert": "{chat-message-body}", "badge": "+1", "sound": "{config-sound}", "info": { "from": "{sender-jid}" } }

How to compile erl file to get mod_zeropush.beam :

Make sure you have erlang installed on the machine you are building from

  1. Clone latest Mongooseim from github
  2. Place mod_zero_push.erl file in Mongooseim source code path apps/ejabberd/src/
  3. sudo make

If you dont have souce repository and installed Mongooseim from executable file

Copy the *.beam files from the ebin directory to the location where the other modules are for your server( mail to me [email protected] to get beam file )

Add the configuration from below

Configuration

in ejabberd.cfg

{mod_zeropush, [ {sound, "default"}, {auth_token, "your-auth-token"}, {post_url, "https://api.zeropush.com/broadcast"} ]}

mod_zeropush-mongooseim-'s People

Contributors

aadimurthy avatar

Watchers

Neustradamus avatar James Cloos avatar  avatar

mod_zeropush-mongooseim-'s Issues

Can this be converted to pass the application/json format post request rather than application/url-encoded

Hello AADI,

Good one for the mongooseIM, Can we have the same mod_zeropush.erl file to give the conversion to JSON output, As we have the WCF server support which cant take this application/url-encoded.

Could you also put another for this. Will be great help.

Existing:

  1. httpc:request(post, {PostUrl, [], "application/url-encoded", list_to_binary(Post)},[],[]),
  2. if (Type == <<"chat">>) and (Body /= <<"">>) -> Sep = "&", Post = [ "alert=", url_encode(binary_to_list(Body)), Sep, "badge=", url_encode("+1"), Sep, "sound=", Sound, Sep, "channel=", To#jid.luser, Sep, "info[from]=", From#jid.luser, Sep, "auth_token=", Token], ?INFO_MSG("Sending post request to ~s with body \"~s\"", [PostUrl, Post]), httpc:request(post, {PostUrl, [], "application/json", list_to_binary(Post)},[],[]), ok; true -> ok end.

Modification:

  1. httpc:request(post, {PostUrl, [], "application/json", list_to_binary(Post)},[],[]),

  2. New to modify this and provide the erl if you can.

Thanks.

Issue compiling mod_zeropush on mongooseim version 2.1.0

Hi,
I am trying to compile the mod_zeropush.erl file for mongooseim 2.1.0.
The default git clone doesnt have the path apps/ejabberd/src/ so copied the erl file to the src folder inside the parent folder MongooseIM. But since the ejabberd.hrl does not exist inside the "include" folder the compilation fails.
Please let me know how I can compile this file.

Best Regards,
Prasanna

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.