Code Monkey home page Code Monkey logo

cwslack-slashcommands's People

Contributors

damiankw avatar jundis avatar shayughul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cwslack-slashcommands's Issues

Add BadStatus filtering

I don't need to get notifications for "> Closed" statuses and would like to filter them out, like BadBoard.

Allow wildcard in config search

We use configurations in CW that pull data on endpoints from Kaseya. I have modified our cwslack-config.php to pull in the data, including model, warranty, etc. Is there anyway to do a wildcard search in configs? Or at least search all configurations based on the name? I am looking through the code now but I am not as versed in CW.

for example, instead of having to type out /config name of client here|server123FS.root.cnd, I'd like to be able to type /config server12* and still allow the config to be found.

Add alerting to specific channel for actual hours > 1

Internal suggestion.

Effectively:

  1. Connectwise User A submits new ticket.
  2. cwslack-incoming.php generates new ticket message to whatever channel is set in Slack web panel.
  3. User A then adds a time entry for 30 minutes, if updates are enabled then it would post to same channel.
  4. User B then adds a 1 hour time entry, bringing the total to 1.5 which is greater than 1. This sends a new message to the channel specified in $dispatchchan alerting that the total time on a ticket is greater than 1 hour.
  5. User A then adds a 15 minute time entry, and it posts again to channel $dispatchchan.

This would all be controlled by a variable such as $posttime and allow for variable time if you want it to alert at 1.0 hours or maybe 1.5 hours.

/config replies with markup

All other integrations seem to be working fine, but when I try a config, I get the following. This is after adding
var_dump($answerTData);
to line 90 of cwslack-configs.php. Command given was: /config client|sales05

client name and my URL changed to protect the innocent.

string(2272) "HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.5
x-server-name: CWSERVER
Link: 
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sun, 25 Sep 2016 20:10:08 GMT
Content-Length: 1979

[{"id":11757,"name":"sales05.root.client","type":{"id":18,"name":"Managed Workstation","_info":{"type_href":"https://cw.MYCOMPANY.com/v4_6_release/apis/3.0/company/configurations/types/18"}},"status":{"id":1,"name":"Active","_info":{"status_href":"https://cw.MYCOMPANY.com/v4_6_release/apis/3.0/company/configurations/statuses/1"}},"company":{"id":923,"identifier":"client","name":"client","_info":{"company_href":"https://cw.MYCOMPANY.com/v4_6_release/apis/3.0/company/companies/923"}},"contact":null,"site":{"id":1109,"name":"Main","_info":{"site_href":"https://cw.MYCOMPANY.com/v4_6_release/apis/3.0/company/companies/923/sites/1109"}},"locationId":null,"businessUnitId":null,"deviceIdentifier":"KHJGHGJKH","serialNumber":"LKJKJGK","modelNumber":"7518E1U","tagNumber":null,"purchaseDate":null,"installationDate":"2015-09-24T13:30:00Z","installedBy":null,"warrantyExpirationDate":null,"vendorNotes":"","notes":null,"macAddress":"CC-52-AF-41-ED-B8","lastLoginName":"Sales06","billFlag":true,"backupSuccesses":null,"backupIncomplete":null,"backupFailed":null,"backupRestores":null,"lastBackupDate":null,"backupServerName":null,"backupBillableSpaceGb":null,"backupProtectedDeviceList":null,"backupYear":null,"backupMonth":null,"ipAddress":"192.168.4.165","defaultGateway":"192.168.4.1","osType":"7","osInfo":"Professional x64 Edition Service Pack 1 Build 7601","cpuSpeed":"1581 MHz x 4","ram":"8016 MB","localHardDrives":"     Free           Total  \r\nC: 287386 MB   465437 MB  \r\nQ: 1026 MB   9999 MB  \r\n","parentConfigurationId":null,"vendor":null,"manufacturer":{"id":12,"name":"Lenovo","_info":{"manufacturer_href":"https://cw.MYCOMPANY.com/v4_6_release/apis/3.0/procurement/manufacturers/12"}},"questions":null,"activeFlag":true,"managementLink":"341741014418654","remoteLink":null,"sla":null,"mobileGuid":"2b45f62e-fc0e-4ee5-b2be-d6735ce29ac3","_info":{"lastUpdated":"2016-09-24T08:07:53Z","updatedBy":"Kaseya"},"customFields":null}]"
<?xml version="1.0"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>0</int></value></member><member><name>faultString</name><value><string>Warning:Invalid argument supplied for foreach() in E:\PHP\CWSlack\cwslack-configs.php on line 112</string></value></member></struct></value></fault></methodResponse>{
   "parse": "full",
   "response_type": "in_channel",
   "attachments": [
       {
           "fallback": "Configuration Info for client\\sales05.root.client",
           "title": "Configuration: sales05.root.client",
           "pretext": "Configuration for:  client",
           "text": "*_Notes_*:\nNone\n*_Vendor Notes_*:\nNone\n*_Questions_*:\n",
           "mrkdwn_in": [
               "text",
               "pretext"
           ]
       }
   ]
}

CW version is v2016.5 (42287)

Submit new internal and external facing ticket notes.

Internal suggestion.

Would be using /note command, adding more to /t just makes it too cluttered and combined which is unlike how the rest of the scripts were created.

/note 431823 internal This is an internal note!
/note 443723 external Hello, external note!

vs

/t 512377 note internal "This is an external note!"
/t 412384 note external "Hello, external note!"

Project license

A lot of people ando companies won't touch code unless it's licensed, whether it be contributing or using, so it's something to consider. The MIT license is the friendliest for a lot of companies and people.

Check other info required in fallback and add it

I just noticed that the fallback is missing more detail (like who posted). It might be an idea to examine all of the outputs for -incoming and see what information can be added to the fallback, without making it look cluttered.

I'll probably get onto this myself over the next few days!

Integrate MySQL or other relational database

Goal would be to allow for the choice between flat file and MySQL/MariaDB/etc to allow for much better management. Future modules would rely 100% on database but existing modules would keep flat file compatibility.

Looking for feedback on this from users before diving into.

Pros:

  1. Easier management
  2. Better organization
  3. Better future proofing by avoiding a large swath of text files later down the road
  4. No issues with text file corruption or 1 line screwing up the entire thing
  5. Could move configuration to web interface.

Cons:

  1. Requires more server resources
  2. Longer setup process
  3. Requires back end management OR adding a multitude of admin commands to Slack or front end to configure.
  4. Possible database issues.
  5. Another layer of things to troubleshoot if things aren't working.

Add initial configuration to config.php

Initial MySQL config required for config.php, in case people do not use the install.php.

Probably can move this to a better spot, or require install.php or provide .sql files. Bad to have it run literally every call.

Better error detection for line 195 issues

Users receive error starting at line 195 if their Connectwise URL is incorrect in config.php. Need better error catching so it is understandable what the problem is.

Timezone error

in <b>/var/www/html/cwslack.php</b> on line <b>193</b><br /> <br /> <b>Warning</b>: date(): It is not safe to rely on the system's timezone settings. You are ​required​ to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.

CW Contact - Does not return "Site phone" or treturns markup if no email is specified

If I have a contact in CW, with a phone number type of "Site Phone" (the default company phone # i assume?) it does not pull that into the info returned into Slack. If that contact happens to not have an email set in CW, I get markup returned (I am guessing because $text is blank?)

]
string(2121) "HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Expires: -1
Server: Microsoft-IIS/7.5
x-server-name: CWSERVER
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Thu, 29 Sep 2016 20:37:01 GMT
Content-Length: 1836

[{"id":6758,"firstName":"Dick","lastName":"smithS","type":null,"company":{"id":81,"identifier":"CCCDP","name":"CompanyName","_info":{"company_href":"https://cw.url.here/v4_6_release/apis/3.0/company/companies/81"}},"site":{"id":83,"name":"Main","_info":{"site_href":"https://cw.url.here/v4_6_release/apis/3.0/company/companies/81/sites/83"}},"addressLine1":null,"addressLine2":null,"city":null,"state":null,"zip":null,"country":null,"relationship":{"id":0,"name":"","_info":{"relationship_href":"https://cw.url.here/v4_6_release/apis/3.0/company/contacts/relationships/0"}},"department":null,"inactiveFlag":false,"defaultMergeContactId":null,"securityIdentifier":null,"managerContactId":null,"assistantContactId":null,"title":null,"school":null,"nickName":null,"marriedFlag":false,"childrenFlag":false,"significantOther":null,"portalPassword":null,"portalSecurityLevel":null,"disablePortalLoginFlag":false,"unsubscribeFlag":null,"gender":null,"birthDay":null,"anniversary":null,"presence":null,"mobileGuid":"42a66a98-af5a-4017-82a5-cadeb6ad4f06","facebookUrl":null,"twitterUrl":null,"linkedInUrl":null,"communicationItems":null,"_info":{"lastUpdated":"2016-09-29T20:36:07Z","updatedBy":"MyName","communications_href":"https://cw.url.here/v4_6_release/apis/3.0/company/contacts/6758/communications","notes_href":"https://cw.url.here/v4_6_release/apis/3.0/company/contacts/6758/notes","tracks_href":"https://cw.url.here/v4_6_release/apis/3.0/company/contacts/6758/tracks","portalSecurity_href":"https://cw.url.here/v4_6_release/apis/3.0/company/contacts/6758/portalSecurity","image_href":"https://cw.url.here/v4_6_release/apis/3.0/company/contacts/6758/image?lastModified=2016-09-29T20:36:07Z"},"customFields":null}]"
<?xml version="1.0"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>0</int></value></member><member><name>faultString</name><value><string>Warning:Invalid argument supplied for foreach() in E:\dokuwiki\CWSlack\cwslack-contacts.php on line 104</string></value></member></struct></value></fault></methodResponse>{
   "parse": "full",
   "response_type": "in_channel",
   "attachments": [
       {
           "fallback": "Contact Info for Dick smithS",
           "title": "Company: CompanyName",
           "pretext": "Contact Info for Dick smithS",
           "text": "",
           "mrkdwn_in": [
               "text",
               "pretext"
           ]
       }
   ]
}

This is with var_dump($answerTData); added to line 91 of cwslack-contacts.php

CW 2016.6 Change of URL

I just recently installed this and was trying to get it working and realized the URL for the CW side is different. We use Hosted CW.

From the looks of it it changed from /v4_6_release/ to /v2016_6/

Now I tried to update the code and I still get an error inline in Slack saying:
"Array not returned in line 195. Please check your connectwise URL variable in config.php and ensure it is accessible via the web at https://api-na.myconnectwise.net/v2016_6/apis/3.0/se....."

I did try the other way also and get same error.
"Array not returned in line 195. Please check your connectwise URL variable in config.php and ensure it is accessible via the web at https://api-na.myconnectwise.net/v4_6_release/apis/3.0/service/tic....."

Sorry if this is not a place for this, the only comment section I found.

Parse error

I'm getting the following error:

Parse error: syntax error, unexpected 'APIKEYSHOWNHERE*' (T_STRING) in /var/www/html/CW/config.php on line 27

Is this an API configuration error, or a webserver issue ?

Appreciate any advice.

Expand feature set beyond Slack

This project seems relatively easily portable for use with other services that use a REST API, two services of particular interest, in my mind, are Office Planner and Trello. Half of the leg work is already done via facilitating HTTP requests to Connectwise and returning the JSON object.

Integrations such as these eliminate the need for tools like Kanbanize.com to bring Agile methodologies to the Connectwise PSA and would put forth a lot of value.

Create install script?

This is a concept issue. May not actually make it into the final 2.0 release, but depending on how useful I can make it we'll see.

Put the message body in the ticket notification

I can't be in front of CW all day, so I use the Slack integration mostly to avoid getting a million emails about ticket updates. The updates are a good start, but I'd love to see the message in the alert so I could see what the user has updated with to know if it's something I need to deal with now or can table till later.

NO FALLBACK DEFINED

Hi,

In the Slack notification, NO FALLBACK DEFINED is displayed. If I can figure out how to pull/push whatever to Github I will, but the fix is to add:

"fallback" => "Info on Ticket #" . $dataTData->id,

to the first line of each attachment in the array:

$return =array( "parse" => "full", "response_type" => "in_channel", "attachments"=>array(array( "fallback" => "Info on Ticket #" . $dataTData->id, //Return info string with ticket number. "title" => "<" . $ticketurl . $dataTData -> id . "&companyName=" . $companyname . "|#" . $dataTData->id . ">: " . $dataTData->summary, //Return clickable link to ticket with ticket summary. "pretext" => "Info on Ticket #" . $dataTData->id, //Return info string with ticket number. "text" => $dataTData->company->identifier . " / " . $contact . //Return "Company / Contact" string "\n" . $dateformat . " | " . $dataTData->status->name . //Return "Date Entered / Status" string "\n" . $dataTData->resources, //Return assigned resources "mrkdwn_in" => array( "text", "pretext" ) )) ); }

I guess you could add whatever you wanted, I only wanted the Ticket #

Remind users/specific channel of firm appointments

Need to setup a new script to run based on cron or scheduled tasks for Windows, that when called will check all firm appointments for the next hour, and check each to see if there is a reminder set on them. If so and the reminder threshold has been reached, send a reminder to Slack towards a specific channel or the user themselves.

Calling a contract results in error with markdown text, but pulls the contact

I've updated to 1.6 and the cw-contact seems to not be working on my system, but I'm sure it's just a misconfiguration on my end somewhere. When I perform "/cwcontacts Smith", I get the follow returned:

<br />
<b>Notice</b>:  Undefined property: stdClass::$communicationItems in <b>/var/www/html/cwslack-contacts.php</b> on line <b>100</b><br />
<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/var/www/html/cwslack-contacts.php</b> on line <b>104</b><br />
<br />
<b>Notice</b>:  Undefined property: stdClass::$name in <b>/var/www/html/cwslack-contacts.php</b> on line <b>115</b><br />
{
   "parse": "full",
   "response_type": "in_channel",
   "attachments": [
       {
           "fallback": "Contact Info for John Smith",
           "title": "Company: ",
           "pretext": "Contact Info for John Smith",
           "text": "",
           "mrkdwn_in": [
               "text",
               "pretext"
           ]
       }
   ]
}

Feature Request: Notify Followers on Ticket

Similar to what cwslack-follow is currently doing except instead of initiating the follow from Slack, I receive notifications if I "Follow" a ticket in CW. This I believe will require some way to map users in CW to users in Slack.

Project license

A lot of people ando companies won't touch code unless it's licensed, whether it be contributing or using, so it's something to consider.

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.