Skip to main content

Setup

You will need a Stream Chat account with a project configured. In Courier, navigate to the Stream Chat Integration page, enter your API key, API secret, and sender ID, then click “Save.”

Profile Requirements

To deliver a message to a recipient over Stream Chat, Courier must be provided a channelType and channelId, or a messageId (for updating an existing message). Include these in the recipient profile as streamChat.
{
  "message": {
    "to": {
      "streamChat": {
        "channelType": "messaging",
        "channelId": "my-channel-id"
      }
    }
  }
}
{
  "message": {
    "to": {
      "streamChat": {
        "messageId": "my-message-id"
      }
    }
  }
}

Overrides

You can override the request body, API credentials, and endpoint URL that Courier sends to Stream Chat.
  • Override any of the fields supported by Stream Chat’s POST /channels/{type}/{id}/message API endpoint. See all send request body fields here.
  • Override apiKey, apiSecret, and senderId via the config object.
  • Override baseUrl (defaults to https://chat-us-east-1.stream-io-api.com).
{
  "message": {
    "template": "NOTIFICATION_TEMPLATE_ID",
    "to": {
      "streamChat": {
        "channelType": "messaging",
        "channelId": "my-channel-id"
      }
    },
    "data": {
      "name": "Foo Bar"
    },
    "providers": {
      "stream-chat": {
        "override": {
          "body": {
            "skip_push": true
          },
          "config": {
            "baseUrl": "https://custom-stream-endpoint.example.com",
            "apiKey": "RUNTIME_API_KEY",
            "apiSecret": "RUNTIME_API_SECRET",
            "senderId": "RUNTIME_SENDER_ID"
          }
        }
      }
    }
  }
}