Learn about how to create an occasion in an occasion board using GraphQL.
Added in 23.10
You can create an occasion or event along with Occasion data which provides information on the Occasion's start and end times, timezone, location, and live stream URL (if applicable) on any occasion board using GraphQL query.
Note
The Occasion or Events feature is in Beta phase. Contact your Khoros representative to enable this feature.
Requirements
You must have the Post new events set to Grant by your administrator.
Basic Steps
- Open an occasion board where you want to create a new occasion.
- Identify the ID of an occasion board from the URL of the board as described in the Create a Forum.
- Ensure that you have the necessary permission to create a new occasion granted by the Administrator.
- Create a POST request to create a new occasion.
Example
Post a New Occasion
In this example, we are going to create a new occasion in the Monthly Event board using a GraphQL query.
After you have created a new occasion on the occasion board, make sure you have received success as a response.
- Sign in to your community.
- Go to the Monthly Event Board.
- Make a note of the ID of the board.
- Make a GraphQL POST request to the board.
The ID of the Klass Forum Board is monthly-event-board.
Here is the GraphQL POST request and response to create a new occasion.
mutation createOccasion {
createOccasion(
createInput: {
board: { id: "board:monthly-event-board" }
subject: "Khoros live @ 11"
body: "Welcome to our July event!"
occasionData: {
startTime: "2023-07-15T11:00:00Z"
endTime: "2023-07-15T11:45:00Z"
timezone: "Asia/Calcutta"
location: "https://www.google.com/maps/place/Khoros+India+R%26D+Pvt+Ltd/@12.9938275,77.6606259,15z/data=!4m6!3m5!1s0x3bae130815f20b37:0xe0e721a0416eb2d7!8m2!3d12.9938275!4d77.6606259!16s%2Fg%2F11c20ql762?entry=ttu"
isLiveStream: true
liveStreamUrl: "https://www.youtube.com/watch?v=jfKfPfyJRdk"
featuredGuests: { items: [{ id: "user:6" }, { id: "user:8" }] }
}
}
) {
errors {
__typename
... on OccasionValidationError {
key
message
fields
}
}
result {
id
subject
body
occasionData {
startTime
endTime
timezone
location
liveStreamUrl
featuredGuests {
id
login
}
}
}
}
}
Here is the response to the above GraphQL Mutation.
{
"data": {
"createOccasion": {
"errors": null,
"result": {
"id": "message:3523",
"subject": "Khoros live @ 11",
"body": "Welcome to our July event!",
"occasionData": {
"startTime": "2023-07-15T04:00:00.000+05:30",
"endTime": "2023-07-15T04:45:00.000+05:30",
"timezone": "Asia/Calcutta",
"location": "https://www.google.com/maps/place/Khoros+India+R%26D+Pvt+Ltd/@12.9938275,77.6606259,15z/data=!4m6!3m5!1s0x3bae130815f20b37:0xe0e721a0416eb2d7!8m2!3d12.9938275!4d77.6606259!16s%2Fg%2F11c20ql762?entry=ttu",
"liveStreamUrl": "https://www.youtube.com/watch?v=jfKfPfyJRdk",
"featuredGuests": [
{
"id": "user:6",
"login": "Ausoleum"
},
{
"id": "user:8",
"login": "Urn"
}
]
}
}
}
}
}
ATLAS
Comments