Watson Workspace will no longer be available after February 28, 2019. Learn more.

Developers

Post a message in to a space

Comments

12 comments

  • Official comment
    Avatar
    Miguel Estrada

    Hello Bernd,

    Thanks for the feedback on the need to increase clarity in our documentation around the AppMessage data structure and sending messages to a conversation in general.  We have something in the works that will help clarify this some more.

    To review what we currently have:

    Currently there are two parts where this structure is referenced in developer.watsonwork.ibm.com

    1.  In the guide about sending a message where actor is described as follows:

    "In addition to message and decoration you can include an actor as part of your message, though this is optional. An actor represents the person or entity that is responsible for the message. The name property is a string that represents the actor’s name, and the avatar property is a string that is the url for the image of the actor. The url property is the location for this entity (e.g. a person’s LinkedIn URL)"

    2. In the API reference where each element of the structure is described.  (I did see that the "type": "AppMessage" property was missing from the API reference and will have that addressed shortly.)

     

    I addition to improving on the above, we will very soon (1-2 week at most) have a tutorial style document that should help with an end to end flow. 

    In the meantime, the concept of "actor" is used to represent or identify a person when such person is not part of the system.  For example:  The integration we did with Slack allows us to plug in the actor name the slack user name and in actor avatar their picture as identified in Slack.  We did not use the actor url in this case.  In other app integrations this person could be one from another system such as LinkedIn, etc and may include a URL to that person's profile.

    Thanks again for the feedback and hope the above helped answer your concerns.

  • Avatar
    Carsten Gericke

    You are a few steps ahead from me.

    My registered app is not part of my space and can not be added to the space. My space show slack and ifttt only.

    What do you mean by "add Member to a Space" Pattern? How did you add your app to your space?

  • Avatar
    Christian Guedemann (Edited )

    I used the graphQL console with the following pattern:

    mutation updateSpaceAddMembers {
      updateSpace(input: { id: "space-id", title: "Space title",  members: ["user3-id", "user4-id"], memberOperation: ADD}){
        memberIdsChanged
        space {
          title
          membersUpdated
          members {
            items {
              email
              displayName
            }
          }
        }
      }
    }



    Instead of user-id-3, I used the ID of my app and space-id was replaced with the ID of my space.

  • Avatar
    Carsten Gericke

    OK. One step closer.

    Now my app is member of my space too and I can perform graphql queries from my Java program. But it still doesn't show as app like slack and IFTTT does.

    I will attempt to post a message now and will let you know, about my findings.

    But many thanks so far.

  • Avatar
    Bernd Gewehr

    Please post your JSON payload as the message structure is not exactly described in the docs.

  • Avatar
    Bernd Gewehr

    @CarstenGericke we have a business app that could be a good candidate for a WW app to bring the business activity stream into the conversation. Something like a ERP bot telling if my contract was approved or my invoice paid. Can we exchange on building apps?

  • Avatar
    Christian Guedemann

    I've finished my work (and now it works). The python script is as OpenSource available (under Apache V2 License)

    see https://github.com/OpenCode4Workspace/WWAPI

    All comments are welcome!

    Happy coding

    (Java Code is coming soon maybe this weekend)

  • Avatar
    David Brooks

    The UI to see your app listed in the Apps menu and add through the Space settings panel will get deployed to production today.     Check back soon.

  • Avatar
    Bernd Gewehr (Edited )

    @david that works, great.

    Now I managed to get a message posted but wondering why the api description does not contain a referenze on the appMessage structure scheme.

    I used the following payload:

        {"type": "appMessage",
        "version": 1.0,
        "annotations": [{
        "type": "generic",
        "version": 1.0,
        "color": "#0000FF",
        "title": "New event:",
        "text": "[click here](https://anyURL)",
        "actor": {
        "name": "Vössing SelfService Business bot",
        "avatar": "avatar",
        "url": "http://www.voessing.de/files/.../logo_head_voessing.png"
        }}]
        }

    The meaning of avatar and actor url is absolutely unclear. Are there even more keys to use in this context?

  • Avatar
    Bernd Gewehr (Edited )

    Hi Miguel, thank you for caring. Pls help on one more thing: in the section sending a Message to a space there is a link to the spaces structure. There is a table of the message sending procedure which ends with a link to "#message". This link leads back to the start of the whole page and does not lead to the message structure table, right? (I tried on IOS mostly) There may be something wrong with the page sections. Please check.

  • Avatar
    Miguel Estrada

    Hi Bernd,

    Correct.  These are the 3 parts that are being addressed :

    1. Message link in API reference links to top of doc
    2. Message data structure not in proper order
    3. Message data structure missing "type": "AppMessage" property
  • Avatar
    Vadiraj Joshi

    Hi Chris,

    Thanks for the python script, it helped to understand. Can you please share Java version for posting msg into workspace?

    Regards,

    VJ

Please sign in to leave a comment.