Common Scenario
Just a solution that most of the developers are looking for



List of all organization's Students

The school with ClassApp has their entities IDs. Therefore, for integration works well, you might need to build some relation table to associate your IDs to ClassApp IDs:

StudentSchool IDSchool ID (ClassApp)Entity IDEntity ID (ClassApp)

Bill Gates

11200981012

Linus Torvalds

11200991013

Steve Jobs

10199901011

POST as x-www-form-urlencoded:

https://joy.classapp.co/graphql?access_token=YOUR_TOKEN_HERE


query {
  node(id: $classappSchoolID) {
    ... on Organization {
      fullname
      entities(type: STUDENT) {
        totalCount
        nodes {
          id: dbId
          fullname
          eid
        }

      }
    }
  }
}
Try it!

Import Student attributes and related fields

Student at classapp calls Entity with type Student. To import a Student at ClassApp, you'll need to collect some datas:

Student

Fullname
Groups
Student Phonenumber
Student Email
Related Fields

School ID
Responsable Phonenumber
Responsable Email
Others Responsables Contacts

POST as x-www-form-urlencoded:

https://joy.classapp.co/graphql?access_token=YOUR_TOKEN_HERE


mutation {
  importEntity( input: {
    organizationId: $classappSchoolID,
    fullname: $studentName,
    type:STUDENT,
    eid: $externalID,
    addresses:[
      {
      address: $email,
      type: EMAIL,
      tags: [
          {name: $emailTag},
        ],
      },
      {
      address: $phonenumber,
      type: PHONE,
      tags: [
          {name: $phoneTag}
        ],
      },
    ],
    groups:[
      {name: $groupName}
    ],
    attach:[
      "groups",
      "addresses"
    ]
    }){
    entity{
      dbId
      fullname
      eid
    }
  }
}
Try it!



Multiple Insertions
It's possible to add 10 mutations/request to maximize your application performance, use a "clientMutationId", It's useful to track error request. To handle error report is best practice to save payload request with an Error message object and send to us to evaluate your situation.

Send a message in ClassApp

To send a message using ClassApp API, you need to understand Entity and Tag associaction.

Entity
is the way to find their Responsable or Parents users. Use the relation table to find Entity ID relative to Student at your system.
Tag
is responsible to direct the message for the correct user. If an address X (e-mail or phone) belongs to a parent, It has an associative tag such as: "Parent", "Responsable" or "Financial Officer".

POST as x-www-form-urlencoded:

https://joy.classapp.co/graphql?access_token=YOUR_TOKEN_HERE


mutation {
  createMessage(input:{
    entityId: $messageAuthor,
    subject: $messageTitle,
    content: $messageBody,
    recipients:{
      entityIds: [$studentIDs],
      groupIds: [$groupIDs],
      eids: [$externalIDs]
    },
    tags: [
      {id: $whichUserOfEntity}
    ],
  }){
    message{
      dbId
      subject
      recipientsCount
      recipients{
        nodes{
          entityId
        }
      }
    }
  }
}
Try it!

Send a message with PDF attached

To send a PDF file attached to a message using our API, you'll need to UPLOAD the file to your server, get the new file name and then use the file name in createMessage mutation input.

POST as form-data:

https://joy.classapp.co/graphql?access_token=YOUR_TOKEN_HERE&target=media

Send this mutation in body as
query
and PDF as
file

mutation {
  createMedia(input:{
    clientMutationId: $clientMutationId
  }){
    media{
      filename
      uri
      origName
    }
  }
}
Media Limit Size
Do not send a PDF file bigger than 10MB
POST as x-www-form-urlencoded:

https://joy.classapp.co/graphql?access_token=YOUR_TOKEN_HERE

Just add PDF reference when compose de message
Medias
filename

mutation {
  createMessage(input:{
    entityId: $messageAuthor,
    subject: $messageTitle,
    content: $messageBody,
    recipients:{
      entityIds: [$studentIDs]
    },
    tags: [
      {id: $whichUserOfEntity}
    ],
    medias: [
      {
        filename: $fileName,
        type: FILE
      }
    ],
  }){
    message{
      dbId
      subject
      medias{
        nodes{
          dbId
          filename
        }
      }
      recipientsCount
      recipients{
        nodes{
          entityId
        }
      }
    }
  }
}
Try it!