bbPress Slack integration inconsistencies

Home Forums Web Hosting Forum bbPress Slack integration inconsistencies

This topic contains 7 replies, has 1 voice, and was last updated by  Keith Taylor 2 years, 10 months ago.

  • Author
    Posts
  • #2719

    Keith Taylor
    Keymaster
    Ŧollars: Ŧ 1 ,161.56



    I’ve started using Josh Pollock’s JP bbPress Slack Integration plugin, so I can monitor new forum topics and replies from my phone.

    I tested it OK this morning, but now noticing inconsistencies. On investigation, these seem to be size related. I.e. short messages go through, but longer ones don’t – no good for wafflers like me.

    I can’t find any reference to message size limits for incoming webhooks on Slack. However, in the plugin code, there is a 500 character limit imposed. Maybe that’s too big? I’m going to experiment with smaller numbers to see if I can work this out.

  • #2720

    Keith Taylor
    Keymaster
    Ŧollars: Ŧ 1 ,161.56

    Whatever the limit is, it seems to be less than 490. Time for a better strategy, so I’ll try 400. If that doesn’t work, I’ll work up from the size of a message that has gone through OK.

    Live troubleshooting in action!

    It’s one of those typical problems with tech. If I new what the limit was called, I might be able to find it. If not, good old trial and error has to work eventually.

    This would be less tedious if the bbPress editor had a character counter. Without that, copy and paste into http://www.charactercountonline.com/ is working.

  • #2721

    Keith Taylor
    Keymaster
    Ŧollars: Ŧ 1 ,161.56

    Nope! No success with 400 characters – assuming I’ve hacked the WordPress plugin code OK??!!

    Biggest message I can see that has gone through so far is 131 characters. I wonder if Twitter is an influence here? Let’s try 100, just to test the hacking principle.

  • #2722

    Keith Taylor
    Keymaster
    Ŧollars: Ŧ 1 ,161.56



    Yo! success! 😀

    I can confirm there is probably a bug in the WordPress JP bbPress Slack Integration plugin. It’s a simple plug-in, which I’ll probably just adopt as a Code snippet. The offending lines are:

    		$excerpt = wp_trim_words( $post->post_content );
    		if ( 100 < strlen( $excerpt ) ) {
    			$excerpt = substr( $excerpt, 0, 100 );
    

    Which started at 500, and failed at 400. 100 is OK, so the next logical attempt is 250.

  • #2723

    Keith Taylor
    Keymaster
    Ŧollars: Ŧ 1 ,161.56

    Nope! 250 too high. And why did the code get scrambled?

    		if ( 250 < strlen( $excerpt ) ) {
    			$excerpt = substr( $excerpt, 0, 250 );
    		}
    

    Let’s try another binary chop at 175.

    I need the character counter check, to make sure my message is bigger than the limit I’m testing.

  • #2724

    Keith Taylor
    Keymaster
    Ŧollars: Ŧ 1 ,161.56

    Maybe my Twitter thought is relevant? 175 doesn’t work. In desperation I’ll try half way between 131 and 175. Surely, I can have 153 characters? Even Twitter is more generous than that.

  • #2725

    Keith Taylor
    Keymaster
    Ŧollars: Ŧ 1 ,161.56

    Yippee! 153 is probably enough for my purposes. I only want to know if a message has arrived. Maybe I should have stuck at 153, but I can’t resist one last attempt.

    Can I send 160 characters from a bbPress forum to Slack?

  • #2726

    Keith Taylor
    Keymaster
    Ŧollars: Ŧ 1 ,161.56

    Yes I can! 😀

    bbPress Slack Webhook Message Limit bbPress Slack Webhook Message Limit: Slack screenshot

    • This reply was modified 2 years, 10 months ago by  Keith Taylor. Reason: Screenshot of Slack messages that got through
    • This reply was modified 2 years, 10 months ago by  Keith Taylor.
    • This reply was modified 2 years, 10 months ago by  Keith Taylor.
    • This reply was modified 2 years, 10 months ago by  Keith Taylor. Reason: bbPress will need tweaking if it is to display WP media with caption!

You must be logged in to reply to this topic.