{"id":13582560,"url":"https://github.com/davidnewhall/motifini","last_synced_at":"2026-03-08T01:32:32.553Z","repository":{"id":45558050,"uuid":"164203331","full_name":"davidnewhall/motifini","owner":"davidnewhall","description":"Events-driven, notification subscription system, with SecuritySpy and iMessage integration.","archived":false,"fork":false,"pushed_at":"2024-04-16T16:51:54.000Z","size":202,"stargazers_count":9,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-10T06:17:22.812Z","etag":null,"topics":["ffmpeg-libraries","go","golang","imessagebot","imessages","imessages-extensions","indigo","ipcamera","securityspy"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidnewhall.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-05T10:08:32.000Z","updated_at":"2024-04-16T16:51:59.000Z","dependencies_parsed_at":"2024-06-19T05:23:22.459Z","dependency_job_id":"1377313b-edc5-44aa-9e0b-da73cb8cb751","html_url":"https://github.com/davidnewhall/motifini","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidnewhall%2Fmotifini","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidnewhall%2Fmotifini/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidnewhall%2Fmotifini/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidnewhall%2Fmotifini/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidnewhall","download_url":"https://codeload.github.com/davidnewhall/motifini/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248924213,"owners_count":21184039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ffmpeg-libraries","go","golang","imessagebot","imessages","imessages-extensions","indigo","ipcamera","securityspy"],"created_at":"2024-08-01T15:02:50.594Z","updated_at":"2026-03-08T01:32:30.318Z","avatar_url":"https://github.com/davidnewhall.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Motifini\n\nThis application has a few features.\n\n- Allows you to send messages via `iMessage` using `Messages.app` with\nan HTTP API call.\n- The webserver is optional.\n- iMessages is optional. Telegram is optional too, but one is required.\n- It also integrates with ffmpeg to capture videos from SecuritySpy.\n- Allows subscribing to motion notifiations on SecuritySpy cameras.\n- You can receive a video in Messages.app or Telegram when there is motion.\n- SecuritySpy is not optional, and is the main feature of this application.\n\nThis code is still very crude, under construction and lacking full documentation.\nTelegram was recently added (12/22021), and works very well with SecuritySpy.\n\nMy wife and I use this to receive videos in Telegram for cameras we care about.\nI have a couple other family members relying on this app; they also use SecuritySpy.\n\nI used to only use iMessage, but Montery broke sending files via messages with AppleScript.\nIf you don't use Montery this works just fine with Messages.app.\n\n# SecuritySpy\n\nThis library taps into the SecuritySpy API and Event Stream. You do not need to do\nmuch besides provide a URL. You can then subscribe to any camera.\nIt works with iMessages and/or Telegram simultaneously.\n\nAdd an account to securityspy, and give it access to your cameras.\nI probably used admin, but you can certainly tune the permissions.\nSorry, I do not know what they are right now. :(\n\nPut the url, username and password into the config file.\n\n# iMessage\n\nOne of the optional feature in this application is to send iMessages from an HTTP API.\nThis is how. You must use a dedicated iMessage Apple ID for this to work _properly_.\n\n1.  Make sure Messages has an iMessage account configured (Apple ID signed in).\n1.  Send a message. Like this:\n```shell\ncurl \"http://127.0.0.1:8765/api/v1.0/send/imessage/msg/user@email1.com,user@email2.com\u0026msg=Office%20Window%20Closed\"\n```\n\nLater versions of macOS add restrictions. You may have to give motifini full disk access.\nAt least access to the chat database (path found in the config file). And you'll have to give\nit access to \"control\" Messages.app with AppleScript. You should get a pop-up for that.\n\nThe ability to send files (videos and images) through Messages.app using AppleScript\n[broke](https://apple.stackexchange.com/questions/429586/applescript-messages-app-monterey-problem)\nwith macOS 12.0 Montery. It may or may not get fixed; no idea. 12/2021.\n\n# Telegram\n\nAdd a bot token and set a password in the config.\nOnce the app fires up, message your bot `/id \u003cpassword\u003e`.\nThen message it `/help`.\n\n# Example Config File\n\nThe only requirement in the config file for using the iMessages HTTP API is an `allowed_to` list.\nBe sure to add your iMessage handle here or you cannot send yourself messages.\nOnly addresses added to the config can have messages sent to them.\nThis is also true if you want to use this to send things to Telegram (you do!).\n\n-   Location: `/usr/local/etc/motifini.conf`\n-   Example: [examples/motifini.conf.example](examples/motifini.conf.example)\n\n**Setting `clear_messages` to true will delete every conversation in Messages.app.**\n\n# HTTP Endpoints\n\nIf you enable the webserver, these are (some) of the endpoints.\n\n-   /api/v1.0/send/imessage/video/{to}/{camera}\nUses FFMPEG to capture a video from an IP camera (or other URL).\n    - **`to` (csv), list of message recipients**\n    - **`cam` (string), camera name**\n    - `width` (int), frame size, default: `1280`\n    - `height` (int), frame size, default: `720`\n    - `quality` (int), h264 quality setting, default: `20`\n    - `time` (int), max video duration in seconds, default `15`\n    - `rate` (int), output frame rate, default `5`\n    - `size` (int), max file size, default: `2500000` (~2.5MB)\n\n-   /api/v1.0/send/imessage/picture/{to}/{camera}\nThis method requires SecuritySpy be running.\n    - **`to` (csv), list of message recipients**\n    - **`cam` (string), camera name**\n\n-   /api/v1.0/send/imessage/msg/{to}?msg={msg}\nJust sends a plain-ol' message with iMessage.\n    - **`to` (csv), list of message recipients**\n    - **`msg` (string), text to send**\n\n# IndigoDomo\n\nThis is an example showing how to trigger this app to send a picture or\nmessage to someone via iMessage from [Indigo](http://indigodomo.com).\nThis works, and also works with Telegram now.\nYou can directly trigger \"send a picture or video snippet to someone\nvia telegram or imessages\" by hitting an http endpoint as shown here.\n\nCreate two variables in Indigo.\nName one variable `Subscribers` and the other `SendMessage`\nCreate a trigger when `SendMessage` changes to run an Action.\n\nRun this Action; replace the variable IDs with your own:\n```python\nimport urllib\nimport urllib2\nimport socket\ntimeout = 1\nsocket.setdefaulttimeout(timeout)\n\nsubs = urllib.quote(indigo.variables[1891888064].value, \"\")\nmsg = urllib.quote(indigo.variables[1023892794].value, \"\")\nurl = \"http://127.0.0.1:8765/api/v1.0/send/imessage/msg/\"+subs+\"?msg=\"+msg\n\ntry:\n    urllib2.urlopen(url)\n    indigo.server.log(u\"Dropped off message with Motifini!\")\nexcept Exception as err:\n    indigo.server.log(u\"Error with Motifini: {}\".format(err))\n\n```\n\n# TODO\n\n-   Better Usage/Install Documentation\n-   Some reasonable way to add and control events, and how they fire.\n    -   For instance if you want a motion detector to fire a camera, or two, or a text message, how do you define and action that?\n    -   Or any combination of \"event -\u003e take some cool action (ie. send a specific type of notification)\"\n    -   notifications currently supported: text, video, picture.\n-   Add more info to expvar data: events, cameras, subscribers, telegram stats.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidnewhall%2Fmotifini","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidnewhall%2Fmotifini","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidnewhall%2Fmotifini/lists"}