This package has been deprecated

Author message:

use @broid/kik instead

broid-kik

1.1.4 • Public • Published

npm node deps tests bithound bithoundscore nsp-checked

Broid Kik Integration

Broid Integrations is an open source project providing a suite of Activity Streams 2 libraries for unified communications among a vast number of communication platforms.

Connect your App to Multiple Messaging Channels with One OpenSource Language.

gitter

Message types supported

Simple Image Video Buttons Location Phone number

Buttons, Location, Phone number are platform limitations.

Getting started

Connect to Kik

import broidKik from 'broid-kik'
 
const kik = new broidKik({
  username: '<not_name>',
  token: "<api_key>",
  http: {
    webhookURL: "http://127.0.0.1/"
  }
})
 
kik.connect()
  .subscribe({
    next: data => console.log(data),
    error: err => console.error(`Something went wrong: ${err.message}`),
    complete: () => console.log('complete'),
  })

Options availables

name Type default Description
serviceID string random Arbitrary identifier of the running instance
logLevel string info Can be : fatal, error, warn, info, debug, trace
token string Your API Key
username string Your bot name
http object { "port": 8080, "http": "0.0.0.0", "webhookURL": "127.0.0.1" } WebServer options (host, port, webhookURL)

Buttons supported

Kik support simple quick reply button

Receive a message

kik.listen()
  .subscribe({
    next: data => console.log(`Received message: ${data}`),
    error: err => console.error(`Something went wrong: ${err.message}`),
    complete: () => console.log('complete'),
  })

Post a message

To send a message, the format should use the broid-schemas.

const message_formated = '...'
 
kik.send(message_formated)
  .then(() => console.log("ok"))
  .catch(err => console.error(err))

Examples of messages

Message received

  • A message received from Sally
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "published": 1483677146,
  "type": "Create",
  "generator": {
    "id": "67c9cb10-8a74-42c8-ba55-294d0447cdf9",
    "type": "Service",
    "name": "kik"
  },
  "actor": {
    "id": "Sally Doe",
    "type": "Person",
    "name": "sally2"
  },
  "target": {
    "id": "e03458b44ed4d35823917871a5c62865428a7f900aa14a0ef57ee24c4cbb7b62d",
    "type": "Person",
    "name": ""
  },
  "object": {
    "type": "Note",
    "id": "f59bee1c-d519-402f-8933-e548cdbd6f4e",
    "content": "Hello world"
  }
}
  • A video/image received from Sally
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "published": 1483677146,
  "type": "Create",
  "generator": {
    "id": "67c9cb10-8a74-42c8-ba55-294d0447cdf9",
    "type": "Service",
    "name": "kik"
  },
  "actor": {
    "id": "Sally Doe",
    "type": "Person",
    "name": "sally2"
  },
  "target": {
    "id": "e03458b44ed4d35823917871a5c62865428a7f900aa14a0ef57ee24c4cbb7b62d",
    "type": "Person",
    "name": ""
  },
  "object": {
  "type": "Image",
  "id": "f59bee1c-d519-402f-8933-e548cdbd6f4e",
  "url": "http://images.nationalgeographic.com/wpf/media-live/photos/000/090/cache/african-elephant-standing_9033_600x450.jpg"
  }
}

Send a message

  • Send a simple message
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "generator": {
    "id": "f6e92eb6-f69e-4eae-8158-06613461cf3a",
    "type": "Service",
    "name": "kik"
  },
  "object": {
    "type": "Note",
    "content": "hello world"
  },
  "to": {
    "type": "Person",
    "id": "sally2"
  }
}
  • Send a message with quick reply buttons
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "generator": {
    "id": "f6e92eb6-f69e-4eae-8158-06613461cf3a",
    "type": "Service",
    "name": "kik"
  },
  "object": {
    "type": "Note",
    "content": "hello world",
    "attachment": [
      {
        "type": "Button",
        "name": "How are you?",
        "url": "How are you?",
      }
    ]
  },
  "to": {
    "type": "Person",
    "id": "sally2"
  }
}
  • Send a image
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "generator": {
    "id": "f6e92eb6-f69e-4eae-8158-06613461cf3a",
    "type": "Service",
    "name": "kik"
  },
  "object": {
    "type": "Image",
    "content": "hello world",
    "url": "https://www.broid.ai/images/fake.png",
    "preview": "https://www.broid.ai/images/fake.png"
  },
  "to": {
    "type": "Person",
    "id": "sally2"
  }
}
  • Send a video
{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Create",
  "generator": {
    "id": "f6e92eb6-f69e-4eae-8158-06613461cf3a",
    "type": "Service",
    "name": "kik"
  },
  "object": {
    "type": "Video",
    "content": "hello world",
    "url": "https://www.broid.ai/videos/echo-hereweare.mp4",
    "preview": "https://www.broid.ai/images/fake.png"
  },
  "to": {
    "type": "Person",
    "id": "sally2"
  }
}

Contributing to Broid

Broid is an open source project. Broid wouldn't be where it is now without contributions by the community. Please consider forking Broid to improve, enhance or fix issues. If you feel like the community will benefit from your fork, please open a pull request.

And because we want to do the better for you. Help us improving Broid by sharing your feedback on our Integrations GitHub Repo and let's build Broid together!

Code of Conduct

Make sure that you're read and understand the Code of Conduct.

Copyright & License

Copyright (c) 2016-2017 Broid.ai

This project is licensed under the AGPL 3, which can be found here.

Readme

Keywords

none

Package Sidebar

Install

npm i broid-kik

Weekly Downloads

2

Version

1.1.4

License

AGPL-3.0+

Last publish

Collaborators

  • broidy
  • killix
  • dustinblackman