MSGraph API
2 TopicsNotifications not received at callback uri for bot
Hi, I am trying to implement an app (acting as the bot) outside of teams client to received call notifications for incoming calls and direct them to appropriate agent based on business logic. I have the app registration and bot registration set up. For the bot, I have the teams channel set up with the calling webhook url set to my ngrok url, which tunnels to my local app. I am able to make outbound call with graph api to an internal user by specifying the userId in invitationParticipantInfo. I am also able to make inbound call from internal user to the bot through teams client by directly clicking on the call button for the bot. I can receive the callback notifications at the registered ngrok url in both cases. I have two resource accounts, a call queue and a ivr. Both have phone numbers assigned to them. Things I am stuck on: making an outbound call to PSTN from my app (https://learn.microsoft.com/en-us/graph/api/application-post-calls?view=graph-rest-1.0&tabs=http#example-9-create-peer-to-peer-pstn-call-with-service-hosted-media) making an outbound call on behalf of a queue to PSTN from my app receiving incoming call notification at my app when PSTN calls a resource account (queue or ivr) or a user Things I tried: I tried setting the source in Call object to the following, with id being queue account id, ivr account id, user account id, but all of them gave me an error "Call source identity invalid." with code "7507" and responseStatusCode "403". // initializing graph client ClientSecretCredential credential = new ClientSecretCredentialBuilder() .clientId(CLIENT_ID) .clientSecret(CLIENT_SECRET) .tenantId(TENANT_ID) .build(); GraphServiceClient graphClient = new GraphServiceClient(credential, "https://graph.microsoft.com/.default"); Call call = new Call(); // setting source ParticipantInfo source = new ParticipantInfo(); IdentitySet appIdentitySet = new IdentitySet(); HashMap<String, Object> additionalData = new HashMap<String, Object>(); Identity applicationInstance = new Identity(); applicationInstance.setDisplayName("Calling Bot"); applicationInstance.setId(<some id>); additionalData.put("applicationInstance", applicationInstance); appIdentitySet.setAdditionalData(additionalData); source.setIdentity(appIdentitySet); call.setSource(source); // setting target LinkedList<InvitationParticipantInfo> targets = new LinkedList<>(); InvitationParticipantInfo invitationParticipantInfo = new InvitationParticipantInfo(); IdentitySet phoneIdentitySet = new IdentitySet(); HashMap<String, Object> additionalDataForPhone = new HashMap<>(); Identity phone = new Identity(); phone.setId("+12223334444"); additionalDataForPhone.put("phone", phone); phoneIdentitySet.setAdditionalData(additionalDataForPhone); invitationParticipantInfo.setIdentity(phoneIdentitySet); targets.add(invitationParticipantInfo); call.setTargets(targets); // additional fields call.setCallbackUri("https://<domain>.ngrok-free.app/api/callbacks"); LinkedList<Modality> requestedModalities = new LinkedList<>(); equestedModalities.add(Modality.Audio); call.setRequestedModalities(requestedModalities); ServiceHostedMediaConfig mediaConfig = new ServiceHostedMediaConfig(); call.setMediaConfig(mediaConfig); call.setTenantId(TENANT_ID); // making the call Call result = graphClient.communications().calls().post(call); Questions: Which part of the configuration am I missing? I'm suspecting that it's because my bot is not linked to a resource account. There are some powershell commands that I'm supposed to run as part of the set up, which I didn't because of some company configuration that doesn't allow me to do it. I think creating the resource account in teams admin center is equivalent of creating an application instance. I would like to know whether this is indeed the problem. If it is due to not linking the app to my resource accounts, how do I do it without powershell? I can't find documentation online about it. Is it possible to receive incoming call notifications at my app that's linked to ngrok when the incoming call is for a specific user? Any help is appreciated! Thank you!102Views0likes5CommentsHow to get teams channel message from reply of a message id in ms graph?
Hi, I'm currently using the Microsoft Graph API to develop an app. I use https://graph.microsoft.com/v1.0/search/query to search for messages. I receive the results, which include both the original message and reply message. I want to use the message ID to retrieve the detailed message using this API: /teams/{team-id}/channels/{channel-id}/messages/{message-id}. If the message is the main message, it returns the details. However, if it's a reply, it returns a 404 error. Does this mean I need to obtain the main message ID from the reply? Is there any API or practical way I can use to retrieve it? Thank you!169Views1like3Comments