Openfire Chat API - Chatroom Post

Good Day

Could anyone guide me to what i do wrong?

POST http://domain:7070/rest/api/restapi/v1/chat/rooms/chatroom

I send body as:

{“body”:“Hallo”}

Get following error: 405 Method Not Allowed.

Any help to POST message to chatroom?

Thank You

Albertus Geyser

Your Error suggest you are not using the correct method to call your api.

Please check what is mentioned in doc GET,POST,PUT?

Good Day

Thank You for replies, will test soon again.

What is sequence of api calls to implement FastPath?
Would like to try to create php backend that would make it possible to use FastPath.

Thank you

Albertus

Good Day

I tried to POST to room with following:

http://mydomain:7070/rest/api/restapi/v1/chat/ofchat0000000000/rooms/support

with following JSON: {“body” : “desired message”}

With Basic Auth

I get the following from Openfire Debug Log:

2019.08.01 12:45:02 org.apache.mina.filter.codec.ProtocolCodecFilter - Processing a MESSAGE_RECEIVED for session 3
2019.08.01 12:45:13 OpenfireConnection - sendRoomMessage support@conference.domain.co.za
{
"body" : "desired message"
}
2019.08.01 12:45:13 OpenfireConnection - sendPacket <message to='support@conference.domain.co.za' id='JdP2K-202' type='groupchat'><body>{
"body" : "desired message"
} </body></message>
2019.08.01 12:45:13 org.jivesoftware.openfire.stanzaid.StanzaIDUtil - Using newly generated value '1e9b9134-7c8a-45de-8942-cac75ab8acab' for stanza that has id 'JdP2K-202'.
2019.08.01 12:45:13 OpenfireConnection - SmackConnection - deliverRawText
<message xmlns="jabber:client" to="user@domain.co.za/user1751350270" id="JdP2K-202" type="error" from="support@conference.domain.co.za"><body>{
"body" : "desired message"
} </body><stanza-id xmlns="urn:xmpp:sid:0" id="1e9b9134-7c8a-45de-8942-cac75ab8acab" by="support@conference.domain.co.za"/><error code="403" type="auth"><forbidden xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/></error></message>
2019.08.01 12:45:13 OpenfireConnection - Received packet:
<message to='user@domain.co.za/user1751350270' from='support@conference.domain.co.za' id='JdP2K-202' type='error'><error type='auth'><forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/></error><body>{
"body" : "desired message"
} </body><stanza-id xmlns='urn:xmpp:sid:0' id='1e9b9134-7c8a-45de-8942-cac75ab8acab' by='support@conference.domain.co.za'></stanza-id></message>
2019.08.01 12:45:13 org.jivesoftware.openfire.plugin.rest.RESTServicePlugin - intercepted message from support to user, recipient is available true
{
"body" : "desired message"
} 

I get an error 403 according to log as i understand, but not sure how to fix.

Good Day

I added sending user on openfire in Permissions (Room Affiliations) and now sending messages on room.
But how would one allow visitors to enter the chatroom and send a message?

Thank You
Albertus Geyser

Good Day

I got it working without adding user in Permissions (Room Affiliations).
My room was Moderated and when removing that you can send without being added.

But still curious if one can add non registered users (visitors) on chatrooms as a nickname?

Thank You

Albertus Geyser

Good Day

Sorry for replying on my own messages, but like to reply progress and to see if anyone could help with next steps.

Regarding Fastpath i manage to call ask and accept with spark to get visitor to join fastpath conference with:

http://mydomain:7070/rest/api/restapi/v1/ask

with JSON:

{
“emailAddress”: "visitor@gmail.com",
“userID”: “visitor”,
“question”: “What is the meaning of life”,
“workgroup”: “demo”
}

I know what the chatroom id is, but cant post any messages to room from visitor side with api.

POST: http://mydomain:7070/rest/api/restapi/v1/chat/rooms/extkdh18

JSON:

{
“body” : “desired message”
}

It gives me: 405 Method Not Allowed

What do i miss?

Any help please.

Thank You

Albertus Geyser